Skip to content

Conversation

@olaservo
Copy link
Member

Description

Adds support for SEP-1577 (Sampling With Tools) to the Everything server by introducing a new trigger-agentic-sampling tool that demonstrates the agentic sampling loop pattern.

This tool:

  • Sends a prompt to the client's LLM with tools available
  • Handles tool_use responses and executes tools locally
  • Loops until a final text response is received or max iterations reached
  • Only registers if the client supports sampling.tools capability

Server Details

  • Server: everything
  • Changes to: tools

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:

  1. Server sends sampling/createMessage with a tools array
  2. If the LLM returns stopReason: "toolUse", the server executes the tools
  3. Server sends tool results back and continues until final response

The Everything server is a reference implementation that demonstrates all MCP features, so it should include this capability.

How Has This Been Tested?

(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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

References

Implementation Notes

The tool includes simple local implementations of echo and add tools for demonstration purposes. In a production scenario, tools could likely be reused via:

  • Internal server.server.callTool() calls
  • Connecting to other MCP servers as a client
  • Shared business logic functions

I thought about trying to re-use existing tools already defined in the everything server, but then decided to keep it self-contained instead.

olaservo and others added 2 commits December 28, 2025 21:29
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 <[email protected]>
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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant