Pass Context, not ToolContext (#610)

This commit is contained in:
Eric Gustin 2025-10-08 10:16:15 -07:00 committed by GitHub
parent b780e5b807
commit 20ea8cbddd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions

9
.vscode/launch.json vendored
View file

@ -22,6 +22,15 @@
"jinja": true,
"justMyCode": true,
"cwd": "${workspaceFolder}"
},
{
"name": "Run `python server.py`",
"type": "debugpy",
"request": "launch",
"program": "server.py",
"console": "integratedTerminal",
"cwd": "/absolute/path/to/your/mcp_server",
"args": []
}
]
}

View file

@ -513,7 +513,7 @@ class Tools(_ContextComponent):
definition=tool.definition,
input_model=tool.input_model,
output_model=tool.output_model,
context=tool_context,
context=self._ctx,
**params,
)
return cast(ToolCallOutput, result)

View file

@ -664,7 +664,7 @@ class MCPServer:
definition=tool.definition,
input_model=tool.input_model,
output_model=tool.output_model,
context=tool_context,
context=mctx if mctx is not None else tool_context,
**input_params,
)