fix: don't duplicate built-in tools in system prompt when MCP tools present#11068
Open
shanevcantwell wants to merge 1 commit intocontinuedev:mainfrom
Open
fix: don't duplicate built-in tools in system prompt when MCP tools present#11068shanevcantwell wants to merge 1 commit intocontinuedev:mainfrom
shanevcantwell wants to merge 1 commit intocontinuedev:mainfrom
Conversation
…resent Fix continuedev#11064 When MCP/dynamic tools are registered alongside built-in tools, generateToolsSystemMessage() listed ALL tools through toolToSystemToolDefinition instead of only the dynamic ones. Built-in tools appeared twice — once via their systemMessageDescription (predefined section) and again via the dynamic section. Found while auditing the system message tools framework for local model compatibility. Duplicate definitions waste context tokens and send contradictory format information that frontier models silently handle but local models struggle with. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Mar 5, 2026
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.
Summary
generateToolsSystemMessage()duplicates all built-in tools in the system prompt when any MCP/dynamic tool is registered alongside themThe bug
buildToolsSystemMessage.tsline 43 iteratestools(all tools) instead ofwithDynamicMessage(only tools withoutsystemMessageDescription). When thewithDynamicMessage.length > 0branch fires, every built-in tool gets listed twice:createSystemMessageExampleCall()(usingsystemMessageDescription.prefix+ example args)toolToSystemToolDefinition()(usingtool_definitioncodeblock format)The
withDynamicMessagevariable is computed on lines 18-20 for exactly this purpose — it just wasn't used.Context
Found while auditing the system message tools framework for local model compatibility. Duplicate definitions waste context tokens and send contradictory format information (predefined uses example calls, dynamic uses
tool_definitionblocks). Frontier models silently handle the redundancy; local models with smaller context windows are disproportionately affected.Changes
core/tools/systemMessageTools/buildToolsSystemMessage.tstools→withDynamicMessageon line 43core/tools/systemMessageTools/toolCodeblocks/buildSystemMessage.vitest.tsTest plan
🤖 Generated with Claude Code
Continue Tasks: 🔄 7 running — View all
Summary by cubic
Fix duplicated built-in tool definitions in the system prompt when MCP/dynamic tools are present, reducing token waste and conflicting instructions. Fixes #11064 by listing only dynamic tools in the additional definitions section and adds a test to ensure no duplicates.
Written for commit 9702f31. Summary will update on new commits.