> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aion.to/llms.txt
> Use this file to discover all available pages before exploring further.

# Google ADK MCP API

> API reference for Aion MCP helpers in aion-authoring-adk.

The Google ADK MCP helpers live in the `aion-authoring-adk` package and are imported from
`aion.adk.authoring`.

They are thin framework bindings over the shared `aion-mcp` endpoint helpers. The package does not
own Aion control-plane addressing models; those live in `aion-api-client`.

## Install

```bash theme={null}
pip install aion-authoring-adk
```

The helpers create ADK `McpToolset` instances and a context-aware ADK `BaseToolset`.

## Exports

```python theme={null}
from aion.adk.authoring import (
    aion_adk_mcp_toolset,
    aion_adk_mcp_toolsets_sync,
    default_adk_runtime_context,
)
```

## `aion_adk_mcp_toolset`

Creates a context-aware ADK `BaseToolset`. ADK calls `get_tools(readonly_context)` at runtime, and
the Aion toolset resolves MCP endpoints from that request context.

```python theme={null}
from google.adk.agents import Agent

from aion.adk.authoring import aion_adk_mcp_toolset, aion_lite_llm
from aion.api import (
    CapabilityReference,
    CapabilitySubjectSource,
    RuntimeCapabilityReference,
)

agent = Agent(
    name="research_agent",
    model=aion_lite_llm("model-id-from-control-plane"),
    tools=[
        aion_adk_mcp_toolset(
            capability_references=[
                CapabilityReference.global_mcp(),
            ],
            runtime_capability_references=[
                RuntimeCapabilityReference.primary_mcp(
                    CapabilitySubjectSource.INCOMING_DISTRIBUTION
                ),
            ],
        )
    ],
)
```

| Parameter                       | Purpose                                                                   |
| ------------------------------- | ------------------------------------------------------------------------- |
| `capability_references`         | Explicit subject-kind-key references, including the global control plane. |
| `runtime_capability_references` | Templates resolved from ADK's per-request context.                        |
| `principal_selector`            | Optional explicit principal selector for all endpoints.                   |
| `jwt_manager`                   | Optional async token manager.                                             |
| `base_url`                      | Optional Aion API base URL override.                                      |
| `context_provider`              | Optional function that extracts `AionRuntimeContext` from ADK context.    |
| `tool_filter`                   | Optional filter forwarded to ADK `McpToolset`.                            |
| `tool_name_prefix`              | Optional prefix forwarded to ADK `McpToolset`.                            |
| `require_confirmation`          | Confirmation policy forwarded to ADK `McpToolset`.                        |

## Runtime context extraction

By default, `default_adk_runtime_context` checks these locations on the ADK readonly context:

```python theme={null}
readonly_context.aion_runtime_context
readonly_context.runtime_context
readonly_context.state["aion_runtime_context"]
readonly_context.state["runtime_context"]
```

Pass `context_provider` if your ADK runtime stores the Aion context somewhere else.

```python theme={null}
def from_invocation(readonly_context):
    return readonly_context.invocation_context.session.state["aion_runtime_context"]


toolset = aion_adk_mcp_toolset(context_provider=from_invocation)
```

## `aion_adk_mcp_toolsets_sync`

Creates direct ADK `McpToolset` instances when the `AionRuntimeContext` is already known.

```python theme={null}
from aion.adk.authoring import aion_adk_mcp_toolsets_sync

toolsets = aion_adk_mcp_toolsets_sync(
    runtime_context,
    capability_references=[
        CapabilityReference.global_mcp(),
    ],
)
```

Use this for setup paths where you already have the request context and want explicit ADK
`McpToolset` instances instead of a dynamic `BaseToolset`.

## Related pages

* [Google ADK MCP Guide](/sdk/google-adk/guides/mcp)
* [aion-mcp](/sdk/python/packages/aion-mcp)
* [aion-api-client](/sdk/python/packages/aion-api-client)
