MCPcopy Create free account
hub / github.com/github/copilot-sdk / test_handler_receives_invocation

Method test_handler_receives_invocation

python/test_tools.py:83–105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

81 assert received_params.count == 42
82
83 async def test_handler_receives_invocation(self):
84 class Params(BaseModel):
85 pass
86
87 received_inv = None
88
89 @define_tool("test", description="Test tool")
90 def test_tool(params: Params, invocation: ToolInvocation) -> str:
91 nonlocal received_inv
92 received_inv = invocation
93 return "ok"
94
95 invocation = ToolInvocation(
96 session_id="session-123",
97 tool_call_id="call-456",
98 tool_name="test",
99 arguments={},
100 )
101
102 await test_tool.handler(invocation)
103
104 assert received_inv.session_id == "session-123"
105 assert received_inv.tool_call_id == "call-456"
106
107 async def test_zero_param_handler(self):
108 """Handler with no parameters: def handler() -> str"""

Callers

nothing calls this directly

Calls 2

ToolInvocationClass · 0.90
handlerMethod · 0.45

Tested by

no test coverage detected