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

Method test_params_only_handler

python/test_tools.py:151–175  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

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"""
153
154 class Params(BaseModel):
155 value: str
156
157 received_params = None
158
159 @define_tool("test", description="Test tool")
160 def test_tool(params: Params) -> str:
161 nonlocal received_params
162 received_params = params
163 return "ok"
164
165 invocation = ToolInvocation(
166 session_id="s1",
167 tool_call_id="c1",
168 tool_name="test",
169 arguments={"value": "hello"},
170 )
171
172 await test_tool.handler(invocation)
173
174 assert received_params is not None
175 assert received_params.value == "hello"
176
177 async def test_handler_error_is_hidden_from_llm(self):
178 class Params(BaseModel):

Callers

nothing calls this directly

Calls 2

ToolInvocationClass · 0.90
handlerMethod · 0.45

Tested by

no test coverage detected