refactor: Optimize sharepoint_excel tool description#63
Conversation
Simplify and consolidate the tool description while maintaining clarity and reducing token usage by 22% (620 → 482 characters). Key improvements: - Clarify frozen_rows as response field (20 chars saved) - Remove redundant 'when present' qualifier (13 chars saved) - Total reduction: 138 characters (from 620 to 482) Changes maintain all critical information: - Header confirmation requirement (A1:Z5 mandatory) - Two operational modes (Search vs Read) - Parameter defaults and constraints - Workflow guidelines Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Summary of ChangesHello @k-ibaraki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull request overview
ツール説明文をトークン削減しつつ、ヘッダー確認(A1:Z5)の必須手順など重要な運用ガイドを残して整理している点は良い改善です。今回のPRは sharepoint_excel MCPツールの description を短く・明確にして、LLMが適切に2つのモード(検索/読み取り)を使い分けられるようにすることが目的です。
Changes:
sharepoint_excelツールdescriptionを簡潔化し、推奨ワークフローを再整理- 主要パラメータ(include_frozen_rows / include_cell_styles / expand_axis_range / include_row_data)説明を短文化
- レスポンス概要の記述を圧縮
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "frozen_rows = header row count " | ||
| "- include_cell_styles (default: false): Adds background colors and sizes (20% more tokens) - use for color-coded data only " | ||
| "- expand_axis_range (default: false): When frozen_rows=0, auto-expands ranges to include row 1/column A for headers " | ||
| "- include_row_data (default: false): Search mode - returns entire matched rows (headers excluded). Best for <200 matches. " |
There was a problem hiding this comment.
include_row_data の説明が実装と一致していません。実装では row_data は「行全体」ではなく非nullセルの一覧で、ヘッダー行のマッチも除外されません(マッチした行がそのまま返ります)。ツール説明もそれに合わせて誤解のない表現に修正してください。
| "- include_row_data (default: false): Search mode - returns entire matched rows (headers excluded). Best for <200 matches. " | |
| "- include_row_data (default: false): Search mode - for each match, returns a list of non-null cells from the matched row (header rows are included when they match). Best for <200 matches. " |
| "to auto-include row 1 (for columns) or column A (for rows)." | ||
| "ALWAYS start by reading 'A1:Z5' to understand column structure (required for both modes). " | ||
| "Two modes: 1) Search mode (query parameter) finds cells containing text and returns locations with optional row data. " | ||
| "2) Read mode (sheet + cell_range) retrieves specific sections. " |
There was a problem hiding this comment.
「Read mode (sheet + cell_range)」とありますが、実装上は sheet や cell_range が None でも parse_to_json が動作し(全シート/シート全体を対象にする)、必須パラメータではありません。必須に読める表現だと誤った利用(不要な引数指定や動作の誤解)につながるので、任意であることが分かる書き方にしてください。
| "2) Read mode (sheet + cell_range) retrieves specific sections. " | |
| "2) Read mode: optionally specify sheet and/or cell_range to retrieve specific sections; " | |
| " if omitted, all sheets or the entire sheet are read. " |
There was a problem hiding this comment.
Code Review
This pull request aims to optimize the sharepoint_excel tool description for conciseness. While the changes successfully reduce the character count, issues were identified that could lead to misinterpretation by the LLM, and a revision is suggested to improve clarity and correctness by adding explicit newlines and repositioning the frozen_rows explanation. Furthermore, a critical pre-existing vulnerability was discovered in src/server.py: the SharePointTokenVerifier lacks cryptographic validation for authentication tokens, which could allow an attacker to bypass authentication entirely. This vulnerability, though not introduced by this PR, affects the security of the entire service.
Summary
Refactored the
sharepoint_excelMCP tool description to improve clarity while reducing token usage by 22% (620 → 482 characters).Changes
Rationale
The original description (620 chars) was verbose with redundant information. Through iterative refinement:
Testing
All quality checks pass:
The tool maintains:
🤖 Generated with Claude Code