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

Function _assert_tool_runner_calls

tests/lib/test_vertex.py:137–153  ·  view source on GitHub ↗
(calls: List[MockRequestCall])

Source from the content-addressed store, hash-verified

135
136
137def _assert_tool_runner_calls(calls: List[MockRequestCall]) -> None:
138 assert len(calls) == 2
139 for call in calls:
140 assert call.request.url == TOOL_RUNNER_URL
141 assert call.request.headers["Authorization"] == "Bearer my-access-token"
142 assert "anthropic-version" not in call.request.headers
143 body = json.loads(call.request.content)
144 assert "model" not in body and "stream" not in body and "output_format" not in body
145 assert body["anthropic_version"] == ANTHROPIC_API_VERSION
146 second = json.loads(calls[1].request.content)
147 assert [m["role"] for m in second["messages"]] == ["user", "assistant", "user"]
148 assert second["messages"][1]["content"][0]["type"] == "tool_use"
149 assert second["messages"][2]["content"][0] == {
150 "type": "tool_result",
151 "tool_use_id": "toolu_01",
152 "content": "sunny in Paris",
153 }
154
155
156class TestAnthropicVertex:

Calls

no outgoing calls

Tested by

no test coverage detected