Skip to content

Added Sampling Example to README #698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 30, 2025
Merged

Conversation

RishiNandha
Copy link
Contributor

@RishiNandha RishiNandha commented Jun 25, 2025

Motivation and Context

I had opened #697 earlier today when I was trying to find out how to send sampling requests to MCP Clients from an MCP Server made using our SDK. There is no explicit mention of "Sampling" in the README while the SDK supports this function.

How Has This Been Tested?

I have tested the example I've added into README to work. The received result in the attached example is of the below format when used with VS Code's Github Co-Pilot as the client:

{
    "model" : "github.copilot-chat/gpt-4.1",
    "role" : "assistant",
    "content": {
        "type" : "text",
        "text" : "text response"
    }
}

Breaking Changes

No Breakages

Types of changes

  • [ x ] Documentation update

Checklist

  • [ x ] I have read the MCP Documentation
  • [ x ] My code follows the repository's style guidelines
  • [ NA ] New and existing tests pass locally
  • [ NA ] I have added appropriate error handling
  • [ x ] I have added or updated documentation as needed

@RishiNandha RishiNandha changed the title Added Sampling Examples to README Added Sampling Example to README Jun 25, 2025
@ihrpr ihrpr added this to the docs milestone Jun 26, 2025
Copy link
Contributor

@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this. There are a few things that need to be updated, for example McpServer.server.createMessage should actually calling to an server object. I'll add it on top

@ihrpr ihrpr merged commit fb4d07f into modelcontextprotocol:main Jun 30, 2025
2 checks passed
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.

2 participants