Skip to content

refactor: Optimize sharepoint_excel tool description#63

Merged
k-ibaraki merged 1 commit intomainfrom
refactor/optimize-excel-description
Feb 11, 2026
Merged

refactor: Optimize sharepoint_excel tool description#63
k-ibaraki merged 1 commit intomainfrom
refactor/optimize-excel-description

Conversation

@k-ibaraki
Copy link
Copy Markdown
Member

Summary

Refactored the sharepoint_excel MCP tool description to improve clarity while reducing token usage by 22% (620 → 482 characters).

Changes

  • Clarify frozen_rows as a response field instead of a parameter
  • Remove redundant "when present" qualifier from response structure
  • Maintain all critical information for correct tool usage

Rationale

The original description (620 chars) was verbose with redundant information. Through iterative refinement:

  1. Initial attempt (420 chars, 32% reduction) caused LLM to skip header confirmation step
  2. Recovery phase (515 chars, 17% reduction) restored critical information
  3. Final optimization (482 chars, 22% reduction) removes only safe, redundant elements

Testing

All quality checks pass:

  • ✅ Type checking
  • ✅ Linting
  • ✅ Tests

The tool maintains:

  • ✅ Header confirmation requirement (A1:Z5 mandatory)
  • ✅ Two operational modes (Search vs Read) clearly distinguished
  • ✅ Parameter defaults and constraints
  • ✅ 4-step workflow guidelines

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings February 11, 2026 09:26
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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 sharepoint_excel tool's description to be more concise and understandable. The primary goal was to reduce the token count for the description without sacrificing critical information, ensuring that the tool's usage, parameters, and workflow are clearly communicated to users. This optimization aims to improve the efficiency of language models interacting with the tool.

Highlights

  • Tool Description Optimization: Refactored the sharepoint_excel tool description, reducing its length by 22% (from 620 to 482 characters) while enhancing clarity.
  • Parameter Clarification: Clarified that frozen_rows is a response field indicating header row count, rather than a parameter.
  • Redundancy Removal: Eliminated redundant "when present" qualifiers from the response structure description.
  • Workflow and Parameter Details: Streamlined the explanation of key parameters (include_frozen_rows, include_cell_styles, expand_axis_range, include_row_data) and the recommended 4-step workflow for using the tool.

🧠 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
  • src/server.py
    • Optimized the sharepoint_excel tool description for brevity and clarity.
    • Rephrased the explanation of frozen_rows to correctly identify it as a response field.
    • Removed superfluous phrases like "when present" from the description of response elements.
    • Restructured the description to clearly outline key parameters and a recommended workflow.
Activity
  • The pull request author has confirmed that all quality checks, including type checking, linting, and tests, have passed.
  • The author has verified that the tool maintains its critical functionalities, such as header confirmation requirements, distinction between operational modes, parameter defaults, constraints, and the 4-step workflow guidelines.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. "
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include_row_data の説明が実装と一致していません。実装では row_data は「行全体」ではなく非nullセルの一覧で、ヘッダー行のマッチも除外されません(マッチした行がそのまま返ります)。ツール説明もそれに合わせて誤解のない表現に修正してください。

Suggested change
"- 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. "

Copilot uses AI. Check for mistakes.
"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. "
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「Read mode (sheet + cell_range)」とありますが、実装上は sheet や cell_range が None でも parse_to_json が動作し(全シート/シート全体を対象にする)、必須パラメータではありません。必須に読める表現だと誤った利用(不要な引数指定や動作の誤解)につながるので、任意であることが分かる書き方にしてください。

Suggested change
"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. "

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@k-ibaraki k-ibaraki merged commit b78cdcc into main Feb 11, 2026
7 checks passed
@k-ibaraki k-ibaraki deleted the refactor/optimize-excel-description branch February 11, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants