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

Function tool_use

tests/lib/threads/helpers.py:189–193  ·  view source on GitHub ↗
(tool_use_id: str, name: str = "get_weather")

Source from the content-addressed store, hash-verified

187
188
189def tool_use(tool_use_id: str, name: str = "get_weather") -> BetaMessageParam:
190 return {
191 "role": "assistant",
192 "content": [{"type": "tool_use", "id": tool_use_id, "name": name, "input": {"location": "San Francisco"}}],
193 }
194
195
196def tool_result(tool_use_id: str, content: str = "Sunny in San Francisco") -> BetaMessageParam:

Calls

no outgoing calls