Skip to content

can we call tools and return steaming output? #472

Closed as not planned
Closed as not planned

Description

@guanyang-nb

such as
@mcp.tool()
async def function(text: str):

url =URL

headers = {
    "User-Agent": USER_AGENT
}

async with httpx.AsyncClient() as client:
    try:
        async with client.stream("POST", url, headers=headers, json={"text": text}, timeout=100) as response:
            response.raise_for_status()
            async for chunk in response.aiter_bytes():
                yield chunk
    except Exception as e:
        print("error", e)

Activity

  1. guanyang-nb commented on Apr 11, 2025

    @guanyang-nb
    Author

    response
    <async_generator object func at 0x107641ec0>

    just return this

  2. shihanmax commented on Apr 11, 2025

    @shihanmax

    need this feature

  3. reqyou commented on Jun 25, 2025

    @reqyou

    Raise this Topic.

    A Tool without Streaming Response makes just no sense!

  4. artursanntos commented on Jun 25, 2025

    @artursanntos

    This seems like a very important feature since it's a really common use case of tools.

  5. lloorree commented on Aug 18, 2025

    @lloorree

    As far as I know this isn't supported by the model context protocol itself. It's in the roadmap, and there's an open issue at that level (modelcontextprotocol/modelcontextprotocol#117). The best option right now for this is progress reporting, e.g.

    for progress_percent in range(0, 100, 5):
                await ctx.report_progress(progress=progress_percent, 
                          total=100, message=f"Generating, {progress_percent}% done...")
    
  6. added
    questionFurther information is requested
    enhancementRequest for a new feature that's not currently supported
    ready for workEnough information for someone to start working on
    P0Broken core functionality, security issues, critical missing feature
    and removed
    questionFurther information is requested
    on Oct 6, 2025
  7. felixweinberger commented on Oct 6, 2025

    @felixweinberger
    Contributor

    More details on potential API in the Python SDK #784

  8. leohuai commented on Dec 15, 2025

    @leohuai

    May I ask if this issue has already been resolved? Is there a planned release date? Thank you.

  9. maxisbey commented on Dec 15, 2025

    @maxisbey
    Contributor

    Thanks for all the interest here. Streaming tool results isn't currently supported by the MCP spec - the Streamable HTTP transport's SSE response is for delivering a single JSON-RPC response plus server-initiated messages, not partial content.

    What exists today for long-running scenarios:

    • Progress notifications (notifications/progress) - informational status updates, no partial results
    • Elicitation/Sampling - server can request input from client mid-tool-call via SSE
    • Tasks (experimental) - status polling for long-running operations, but the final result is still atomic

    None of these support streaming partial tool content like LLM token streaming.

    Active spec proposals:

    • Issue #117 - Original streaming tool results issue
    • PR #776 - Partial results with _meta.hasMore approach
    • PR #1905 - Task result streaming proposal

    The key blocker is that JSON-RPC doesn't natively support streaming responses, so the spec needs to define how this works first.

    Closing since this requires spec changes - if you're interested in this feature, I'd encourage following or contributing to the spec discussions above.

    AI Disclaimer

  10. added
    P2Moderate issues affecting some users, edge cases, potentially valuable feature
    and removed
    P0Broken core functionality, security issues, critical missing feature
    on Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Moderate issues affecting some users, edge cases, potentially valuable featureenhancementRequest for a new feature that's not currently supportedready for workEnough information for someone to start working on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions