Repository navigation
MCP Sampling with Tools #286648
Description
Activity
vs-code-engineering commented
on Jan 9, 2026 ContributorMore actionsThanks for creating this issue! It looks like you may be using an old version of VS Code; the latest stable release is 1.108.0. Please try upgrading to the latest version and checking whether this issue remains.
Happy Coding!
yup, this is blocked on #277472 which I expect to resolve this iteration
- addedfeature-requestRequest for new features or functionalityRequest for new features or functionality
on Jan 9, 2026 HansBouwmeester commented
on Jan 10, 2026 AuthorMore actionsI tried it with 1.108.0 however it responds with the same error. Would be good to understand whether it should work or not. In case it should be supported already I can file a bug report with a minimal example illustrating the issue.
Reacted by Enrique Ortuño and ScatterTempleI tried it with 1.108.0 however it responds with the same error. Would be good to understand whether it should work or not. In case it should be supported already I can file a bug report with a minimal example illustrating the issue.
Same error here with a MCP implemented using FastMCP
I encountered the same issue with my own MCP tool that includes sampling with tool calls, implemented using the Python MCP SDK, and that led me to this issue.
I updated VS Code to version 1.108.2, but in the example below, the
generate_weather_reporttool results in the same error:
Error executing tool generate_weather_report: Client does not support sampling tools capability.from mcp.server.fastmcp import Context, FastMCP from mcp.server.session import ServerSession from mcp.types import SamplingMessage, TextContent import mcp.types as types # Create an MCP server mcp = FastMCP("Demo") @mcp.tool() async def weather_report(location: str, ctx: Context[ServerSession, None]) -> str: """Returns tommorow's weather. :param location: location. :type location: str :return: Weather. :rtype: str """ prompt = "Write a random weather term." result = await ctx.session.create_message( messages=[ SamplingMessage( role="user", content=TextContent(type="text", text=prompt), ) ], max_tokens=100, ) return result.content.text @mcp.tool() async def generate_weather_report(ctx: Context[ServerSession, None]) -> str: """Generate a weather report using LLM sampling.""" prompt = "Write a short report about tommorow's weather." tools = await mcp.list_tools() available_tools = [t for t in tools if t.name == "weather_report"] tool_choice: types.ToolChoice = types.ToolChoice(mode="required") result = await ctx.session.create_message( messages=[ SamplingMessage( role="user", content=TextContent(type="text", text=prompt), ) ], max_tokens=100, tools=available_tools, tool_choice=tool_choice, ) # Returns dummy string return "The tommorow Tokyo's weather is sunny." if __name__ == "__main__": mcp.run(transport="stdio")
Same issue when delegating tools via MCP Sampling:
result = await ctx.session.create_message( messages=messages, system_prompt=_TRIAGE_SYSTEM_PROMPT, max_tokens=4096, include_context="none", tools=_SCOPED_TOOLS, tool_choice=ToolChoice(mode="auto"), )
tools.triage - ERROR - MCP sampling failed for triage: Client does not support sampling tools capabilityMoving to 1.113 since this does not seem like a candidate for 1.112. Please move it back if this is incorrect
This is still an issue in 1.115.0
jfyi I don't plan to work on this at the moment as sampling overall is potentially going to be deprecated in the next MCP version.
The MCP PR that deprecates sampling as been merged. Thus I don't plan to do work here, sorry.
- added*out-of-scopePosted issue is not in scope of VS CodePosted issue is not in scope of VS Code
on May 15, 2026
Type: Feature Request
The latest versions of the Model Context Protocol and FastMCP support "sampling WITH TOOLS" (see: https://modelcontextprotocol.io/specification/2025-11-25/client/sampling and https://gofastmcp.com/servers/sampling#sampling-with-tools). When trying this with VS-Code an error is reported:
Client does not support sampling with tools. The client must advertise the sampling.tools capability.. It would be nice to see this supported.VS Code version: Code 1.107.1 (Universal) (994fd12, 2025-12-17T14:15:14.850Z)
OS version: Darwin arm64 25.1.0
Modes: