feat(virtual-mcp): auto-adopt MCP server prompt as agent instructions#3164
Open
feat(virtual-mcp): auto-adopt MCP server prompt as agent instructions#3164
Conversation
When a virtual MCP agent has no metadata.instructions set, automatically resolve the system prompt from the connected MCP server's named prompts. Resolution order: 1. metadata.instructions (explicit, wins always) 2. Prompt whose name matches the agent title slug (e.g. "CEO Agent" → "ceo") 3. First available prompt from connected MCPs 4. undefined (no instructions) This allows MCP servers to own their system prompt in code (prompt.md) without requiring manual copy-paste into the studio database. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Contributor
Release OptionsSuggested: Minor ( React with an emoji to override the release type:
Current version:
|
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
metadata.instructionsset, the server now automatically resolves the system prompt from the connected MCP server's named promptsmetadata.instructionsif explicitly set, (2) prompt matching agent title slug, (3) first available prompt, (4)undefinedmetadata.instructionsalways winsMotivation
MCP servers should own their system prompt in code (e.g.
prompt.md). Previously, there was no bridge between a server's declared prompt and the studio'smetadata.instructionsfield — requiring manual copy-paste that was never done. This change closes that gap automatically.Test plan
metadata.instructionsset → still uses it, no changemetadata.instructions, connected MCP has a prompt named"ceo"(matches title "CEO Agent") → uses that prompt as instructionsmetadata.instructions, connected MCP has prompts but none match → uses first availablemetadata.instructions, connected MCP has no prompts → falls through gracefully,undefined🤖 Generated with Claude Code
Summary by cubic
Automatically uses the connected MCP server’s named prompt as the agent’s system instructions when a virtual MCP agent has no
metadata.instructions. This removes manual copy-paste and keeps agents aligned with serverprompt.md.metadata.instructions> prompt matching agent title slug (lowercased, alphanumeric) > first available prompt > undefined.instructionstocreateServerFromClient; existing behavior unchanged.Written for commit f447f7b. Summary will update on new commits.