feat(everything): add trigger-agentic-sampling tool#3163
feat(everything): add trigger-agentic-sampling tool#3163olaservo wants to merge 12 commits intomodelcontextprotocol:mainfrom
Conversation
Adds a new tool that demonstrates sampling with tools capability (MCP 2025-11-25). The tool sends prompts to the LLM with tools available, handles tool_use responses in an agentic loop, and executes tools locally until a final response is received. 🦉 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update features.md and structure.md to document the new trigger-agentic-sampling tool. Also adds missing documentation for trigger-elicitation-request. 🦉 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
cliffhall
left a comment
There was a problem hiding this comment.
Can't test with the Inspector yet (saw your mention of an issue with the SDK on that), but review did turn up a few minor things.
Address PR review feedback: remove console.log statements that would interfere with STDIO JSON-RPC output. Registration now silently skips when client doesn't support sampling.tools (matching other conditional tools). Remaining debug logs changed to console.error. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Match the pattern used by other conditional tools: wrap registerTool
in `if (clientSupports...) { }` instead of early return.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Hi @olaservo. If you could resolve the conflicts and include some screenshots, it would be helpful. I'm still not fully up to speed on what this looks like for the Inspector side of things, so I need to do some reseach. |
Resolve conflicts in tools/index.ts and docs/features.md by including both the new trigger-agentic-sampling tool (SEP-1577) and the task-based tools (SEP-1686) from main. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Fixed the conflicts, working on some screenshots from my custom client to illustrate the flow (I think I might update the example here too in the process). |
…history Retain complete LLM response (text + tool_use blocks) in message history instead of filtering to only tool_use blocks. This preserves chain-of-thought reasoning context for subsequent turns in multi-step agentic loops. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add MCP-spec compliant annotations to echo and add tools indicating they are read-only, non-destructive, idempotent, and closed-world. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@claude review |
|
Claude finished @cliffhall's task in 3m 49s —— View job PR Review: feat(everything): add trigger-agentic-sampling tool
Overall this is a well-structured implementation of the SEP-1577 agentic sampling loop. The build passes cleanly and the core logic is sound. A few issues to address before merging: Issues1. Inconsistent indentation in the handler body (style) [ 2. Variable shadowing (code smell) [ const tools: Tool[] = availableTools
.filter((name) => name in AVAILABLE_TOOL_DEFINITIONS) // shadows outer `name`
.map((name) => AVAILABLE_TOOL_DEFINITIONS[name]); // shadows outer `name`Rename to 3. README.md not updated The checklist marks "I have updated the server's README accordingly" but 4. Decorative comment banners don't match repo style (minor) The file uses heavy Looks Good
|
Description
Adds support for SEP-1577 (Sampling With Tools) to the Everything server by introducing a new
trigger-agentic-samplingtool that demonstrates the agentic sampling loop pattern.This tool:
tool_useresponses and executes tools locallysampling.toolscapabilityServer Details
Motivation and Context
Issue: #3040
SEP-1577 adds tool calling support to the MCP sampling API, enabling servers to provide tools that the LLM can use during sampling requests. This creates an "agentic loop" where:
sampling/createMessagewith atoolsarraystopReason: "toolUse", the server executes the toolsThe Everything server is a reference implementation that demonstrates all MCP features, so it should include this capability.
How Has This Been Tested?
sampling.toolscapability checktrigger-sampling-request,trigger-elicitation-request)(We can wait to merge until I've had a chance to add a screengrab if that's preferred.)
Breaking Changes
No
Types of changes
Checklist
Additional context
References
Implementation Notes
The tool includes simple local implementations of
echoandaddtools for demonstration purposes. In a production scenario, tools could likely be reused via:server.server.callTool()callsI thought about trying to re-use existing tools already defined in the everything server, but then decided to keep it self-contained instead.