refactor: remove request_ctx ContextVar, thread Context explicitly (#2203)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
This commit is contained in:
parent
62575edabd
commit
cc22bf5464
2 changed files with 484 additions and 413 deletions
0
tests/server/mcpserver/tools/__init__.py
Normal file
0
tests/server/mcpserver/tools/__init__.py
Normal file
10
tests/server/mcpserver/tools/test_base.py
Normal file
10
tests/server/mcpserver/tools/test_base.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from mcp.server.mcpserver import Context
|
||||
from mcp.server.mcpserver.tools.base import Tool
|
||||
|
||||
|
||||
def test_context_detected_in_union_annotation():
|
||||
def my_tool(x: int, ctx: Context | None) -> str:
|
||||
raise NotImplementedError
|
||||
|
||||
tool = Tool.from_function(my_tool)
|
||||
assert tool.context_kwarg == "ctx"
|
||||
Loading…
Reference in a new issue