Home / Function/ test_server_side_tool() — anthropic-sdk-python Function Reference

test_server_side_tool() — anthropic-sdk-python Function Reference

Architecture documentation for the test_server_side_tool() function in test_runners.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  1c6ca369_cb5f_4c3d_c97c_9419f2c3dac6["test_server_side_tool()"]
  6847e1ae_03a4_3e19_19ff_ea808e74d94c["TestSyncRunTools"]
  1c6ca369_cb5f_4c3d_c97c_9419f2c3dac6 -->|defined in| 6847e1ae_03a4_3e19_19ff_ea808e74d94c
  style 1c6ca369_cb5f_4c3d_c97c_9419f2c3dac6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/lib/tools/test_runners.py lines 515–548

    def test_server_side_tool(
        self,
        client: Anthropic,
        respx_mock: MockRouter,
    ) -> None:
        def tool_runner(client: Anthropic) -> BetaToolRunner[None]:
            runner = client.beta.messages.tool_runner(
                model="claude-haiku-4-5",
                messages=[{"role": "user", "content": "What is the weather in SF?"}],
                tools=[
                    {
                        "type": "web_search_20250305",
                        "name": "web_search",
                    }
                ],
                max_tokens=1024,
            )

            message = next(runner)

            content_types = [content.type for content in message.content]

            assert "server_tool_use" in content_types
            assert "web_search_tool_result" in content_types

            return runner

        make_snapshot_request(
            tool_runner,
            content_snapshot=external("uuid:a0a711eb-ee0e-4a42-88d6-5c7f83c0f25a.txt"),
            path="/v1/messages",
            mock_client=client,
            respx_mock=respx_mock,
        )

Subdomains

Frequently Asked Questions

What does test_server_side_tool() do?
test_server_side_tool() is a function in the anthropic-sdk-python codebase, defined in tests/lib/tools/test_runners.py.
Where is test_server_side_tool() defined?
test_server_side_tool() is defined in tests/lib/tools/test_runners.py at line 515.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free