-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
P1Significant bug affecting many users, highly requested featureSignificant bug affecting many users, highly requested featuredocumentationImprovements or additions to documentationImprovements or additions to documentationquestionFurther information is requestedFurther information is requestedready for workEnough information for someone to start working onEnough information for someone to start working on
Description
Question
Hey Team,
I have a question regarding cancelling the tool call from client when the MCP server is created from FastMCP class.
I see the test - test_cancel_handling but this one uses low level server.
My question is specifically on how we can get the request_id which the client needs for cancelling the call tool request on server.
await client.send_notification(
ClientNotification(
CancelledNotification(
params=CancelledNotificationParams(
requestId={request_id},
reason="Reson",
),
)
)
)
Do we have to get the request id from call_tool request? like below?
request_id = None
mcp = FastMCP(
name="Simple gRPC Server",
)
@mcp.tool()
def get_temperature(city: str, ctx: Context[ServerSession, None]) -> float:
# fetching request id from context
request_id = ctx.request_context.request_id
return 22.5
Or is there another way?
Additional Context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1Significant bug affecting many users, highly requested featureSignificant bug affecting many users, highly requested featuredocumentationImprovements or additions to documentationImprovements or additions to documentationquestionFurther information is requestedFurther information is requestedready for workEnough information for someone to start working onEnough information for someone to start working on