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

Method test_invocation_only_handler

python/test_tools.py:129–149  ·  view source on GitHub ↗

Handler with only invocation: def handler(invocation) -> str

(self)

Source from the content-addressed store, hash-verified

127 assert result.text_result_for_llm == "ok"
128
129 async def test_invocation_only_handler(self):
130 """Handler with only invocation: def handler(invocation) -> str"""
131 received_inv = None
132
133 @define_tool("test", description="Test tool")
134 def test_tool(invocation: ToolInvocation) -> str:
135 nonlocal received_inv
136 received_inv = invocation
137 return "ok"
138
139 invocation = ToolInvocation(
140 session_id="s1",
141 tool_call_id="c1",
142 tool_name="test",
143 arguments={},
144 )
145
146 await test_tool.handler(invocation)
147
148 assert received_inv is not None
149 assert received_inv.session_id == "s1"
150
151 async def test_params_only_handler(self):
152 """Handler with only params: def handler(params) -> str"""

Callers

nothing calls this directly

Calls 2

ToolInvocationClass · 0.90
handlerMethod · 0.45

Tested by

no test coverage detected