MCPcopy Index your code
hub / github.com/google/adk-python / _build_mcp_test_runner

Function _build_mcp_test_runner

tests/unittests/telemetry/test_functional.py:530–547  ·  view source on GitHub ↗

Builds a single-turn agent runner whose only tool source is ``toolset``. Single-turn (one ``Part.from_text`` response) so the assertion on ``list_tools_call_count`` is unambiguous: exactly one agent invocation is performed.

(toolset: McpToolset)

Source from the content-addressed store, hash-verified

528
529
530def _build_mcp_test_runner(toolset: McpToolset) -> TestInMemoryRunner:
531 """Builds a single-turn agent runner whose only tool source is ``toolset``.
532
533 Single-turn (one ``Part.from_text`` response) so the assertion on
534 ``list_tools_call_count`` is unambiguous: exactly one agent invocation
535 is performed.
536 """
537 mock_model = MockModel.create(
538 responses=[Part.from_text(text="text response")]
539 )
540 test_agent = Agent(
541 name="some_root_agent",
542 description="A sample root agent.",
543 instruction="you are helpful",
544 model=mock_model,
545 tools=[toolset],
546 )
547 return TestInMemoryRunner(node=test_agent)
548
549
550@pytest.mark.asyncio

Calls 2

TestInMemoryRunnerClass · 0.50
createMethod · 0.45

Tested by

no test coverage detected