MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / make_tool_searcher

Function make_tool_searcher

examples/tools_runner_search_tool.py:47–61  ·  view source on GitHub ↗

Returns a tool that Claude can use to search through all available tools

(tools: List[BetaFunctionTool[Any]])

Source from the content-addressed store, hash-verified

45
46
47def make_tool_searcher(tools: List[BetaFunctionTool[Any]]) -> BetaFunctionTool[Any]:
48 """Returns a tool that Claude can use to search through all available tools"""
49
50 @beta_tool
51 def search_available_tools(*, keyword: str) -> BetaFunctionToolResultType:
52 """Search for useful tools using a query string"""
53
54 results: list[BetaToolReferenceBlockParam] = []
55 for tool in tools:
56 if keyword in json.dumps(tool.to_dict()):
57 results.append({"type": "tool_reference", "tool_name": tool.name})
58
59 return results
60
61 return search_available_tools
62
63
64def main() -> None:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected