-
Notifications
You must be signed in to change notification settings - Fork 273
Trim MCP server tool payloads to reduce token consumption #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ll_request_threads, list_pull_request_thread_comments, and reply_to_comment Co-authored-by: nikolapeja6 <[email protected]>
Co-authored-by: nikolapeja6 <[email protected]>
Copilot finished work on behalf of
nikolapeja6
July 11, 2025 08:03
nikolapeja6
reviewed
Jul 22, 2025
nikolapeja6
reviewed
Jul 22, 2025
nikolapeja6
reviewed
Jul 22, 2025
Co-authored-by: nikolapeja6 <[email protected]>
Co-authored-by: nikolapeja6 <[email protected]>
Copilot finished work on behalf of
nikolapeja6
July 22, 2025 17:20
nikolapeja6
reviewed
Jul 22, 2025
nikolapeja6
reviewed
Jul 22, 2025
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
1 similar comment
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Copilot finished work on behalf of
nikolapeja6
July 22, 2025 18:18
nikolapeja6
approved these changes
Jul 22, 2025
danhellem
approved these changes
Jul 22, 2025
This is a pretty big change to merge straight into main, no? Especially as the default on, but only for certain tools. |
I believe it should be fine - the results of some tools were already being trimmed, this is just a continuation of that. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements trimmed responses for Azure DevOps MCP server tools to dramatically reduce LLM token consumption while maintaining backward compatibility.
Problem
The MCP server tools were returning full REST API JSON payloads, causing unnecessary token burn and making it difficult for weaker LLMs to extract relevant information. For example:
ado_resolve_comment
was returning 4200+ character responses when a simple "resolved" message would sufficeado_list_pull_request_threads
was returning verbose payloads with_links
objects, deleted comments, and unnecessary author propertiesSolution
Added a
fullResponse
parameter (defaults tofalse
) to key repository tools that provides two response modes:Trimmed Mode (Default)
resolve_comment
,reply_to_comment
) return simple success messageslist_pull_request_threads
,list_pull_request_thread_comments
) return filtered data excluding:_links
objectsFull Mode (Opt-in)
fullResponse: true
to get complete REST API responses for debugging or advanced use casesToken Savings
Real-world examples show dramatic improvements:
Example Usage
Modified Tools
repo_resolve_comment
- Simple success message vs full thread JSONrepo_reply_to_comment
- Simple success message vs full comment JSONrepo_list_pull_request_threads
- Filtered thread data vs complete responserepo_list_pull_request_thread_comments
- Filtered comment data vs complete responseAll changes maintain full backward compatibility via the optional
fullResponse
parameter.Fixes #36.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.