Skip to content

ADK does not support MCP Sample #2893

@shivsant

Description

@shivsant

Describe the bug
When I add the sample to mcp, I can utilize it in other clients, but not in adk.
I get the error - ValueError: Client does not support sampling

To Reproduce
Steps to reproduce the behavior:

  1. Install - google-adk[a2a]==1.13.0, fastmcp==2.12.2,
  2. Run - create the mcp server as https://gofastmcp.com/servers/sampling
mcp = FastMCP("SamplingDemo")

@mcp.tool
async def analyze_sentiment(text: str, ctx: Context) -> dict:
    """Analyze the sentiment of text using the client's LLM."""
    prompt = f"""Analyze the sentiment of the following text as positive, negative, or neutral. 
    Just output a single word - 'positive', 'negative', or 'neutral'.
    
    Text to analyze: {text}"""
    
    # Request LLM analysis
    response = await ctx.sample(prompt)
    
    # Process the LLM's response
    sentiment = response.text.strip().lower()
    
    # Map to standard sentiment values
    if "positive" in sentiment:
        sentiment = "positive"
    elif "negative" in sentiment:
        sentiment = "negative"
    else:
        sentiment = "neutral"
    
    return {"text": text, "sentiment": sentiment}
  1. See error
    Expected behavior
    google adk should also support fastmcp native features.
Image

Desktop (please complete the following information):

  • OS: sles15
  • Python version(python -V): 3.11.1
  • ADK version(pip show google-adk): 1.13.0

Model Information:
openai/gpt4o, claude-sonnet-4

Additional context
Created discussion also, but no help.
#2892

Metadata

Metadata

Labels

help wanted[Community] Extra attention is neededmcp[Component] Issues about MCP support

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions