Repository navigation
perf(mcp): pin the tools sessions use, unpin the ones they do not - #96
Merged
Merged
Conversation
The 53 pinned definitions cost 87.8K characters on every turn of every session. Pins the inbox conversation reads and the media presigned URL (searched for by 6-13% of sessions) and moves 13 tools that almost no session calls (queue, tracking tags, usage, ...) behind search_tools. Clients now see 44 tools and 75.5K characters instead of 55 and 89.4K. A guessed name now also suggests pinned tools that share its words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… guesses Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
Review (code-review high --fix)
QA
Metrics
Post-deploy check: same 2 h window a day later in |
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
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.
Why
Every pinned tool definition is sent on every turn of every session: the 53 pinned tools cost 87.8K characters (~22K tokens). Several are almost never called, while three hidden tools are reached through
search_toolsby 6-13% of sessions, each search costing a model turn and ~14.7K characters (Axiomzernio-mcp, 2 h, 1,226 sessions; Sentry, 7 d).What
messages_list_inbox_conversations(13% of sessions),media_get_media_presigned_url(8%),messages_get_inbox_conversation_messages(6%).queue_*, the 2tracking_tags_*,usage_get_usage,validate_post_length,mentions_reply_to_mention,posts_bulk_upload_posts,accounts_move_account_to_profile,account_groups_list_account_groups. They stay reachable throughsearch_tools/call_tooland by direct name.inbox_list_conversationsstill points to the now-pinned tool.call_toolstill reaches newly pinned tools, so agents that already call them by name throughcall_toolkeep working (test).🤖 Generated with Claude Code