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

Method test_function_style_api

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

Source from the content-addressed store, hash-verified

198 assert result.error == "secret error message"
199
200 async def test_function_style_api(self):
201 class Params(BaseModel):
202 value: str
203
204 tool = define_tool(
205 "my_tool",
206 description="My tool",
207 handler=lambda params, inv: params.value.upper(),
208 params_type=Params,
209 )
210
211 assert tool.name == "my_tool"
212 assert tool.description == "My tool"
213
214 result = await tool.handler(
215 ToolInvocation(
216 session_id="s",
217 tool_call_id="c",
218 tool_name="my_tool",
219 arguments={"value": "hello"},
220 )
221 )
222 assert result.text_result_for_llm == "HELLO"
223
224 def test_function_style_can_create_declaration_only_tool(self):
225 class Params(BaseModel):

Callers

nothing calls this directly

Calls 3

define_toolFunction · 0.90
ToolInvocationClass · 0.90
handlerMethod · 0.45

Tested by

no test coverage detected