MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _capture_tool

Function _capture_tool

tests/test_streaming_executor_race.py:34–47  ·  view source on GitHub ↗

A tool whose ``call`` records the abort_controller it received.

(name: str, captured: list, *, concurrent: bool = True)

Source from the content-addressed store, hash-verified

32
33
34def _capture_tool(name: str, captured: list, *, concurrent: bool = True) -> Tool:
35 """A tool whose ``call`` records the abort_controller it received."""
36
37 def _call(_inp, ctx):
38 captured.append(ctx.abort_controller)
39 return ToolResult(name=name, output=f"ok:{name}")
40
41 return build_tool(
42 name=name,
43 input_schema={"type": "object", "properties": {}},
44 call=_call,
45 is_concurrency_safe=lambda _: concurrent,
46 is_read_only=lambda _: concurrent,
47 )
48
49
50def _make_context(tools: list[Tool], abort: AbortController) -> ToolContext:

Calls 1

build_toolFunction · 0.90

Tested by

no test coverage detected