Skip to content

API Reference parrot.tools.spec

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.tools.spec

View source

Agent tooling specs (FEAT-593): the one shape for toolkit / MCP configuration.

Class AgentMCPServerSpec

Agent-level MCP server; headers/auth_config/env live in the vault.

Fields:

Field Type Default Description
name str
transport str 'http'
url str | None None
command str | None None
args list[str]
allowed_tools list[str] | None None
blocked_tools list[str] | None None
description str | None None
auth_type str | None None
params dict[str, Any]
secret_refs dict[str, str]
vault_owner str | None None

Attribute MCP_SECRET_FIELDS

Type: tuple[str, ...]

Class NormalizedTooling

Output of :func:normalize_tooling.

Fields:

Field Type Default Description
tools list[Any]
toolkits list[ToolkitSpec]
mcp_servers list[AgentMCPServerSpec]

Attribute SECRET_MASK

Type: str

Class ToolkitSpec

Agent-level (or per-user override) configuration of one toolkit.

Fields:

Field Type Default Description
slug str
params dict[str, Any]
user_overridable list[str]
secret_refs dict[str, str]
vault_owner str | None None

Function agent_tooling_ref

Immutable tooling identity: bot._tooling_ref for Studio agents, else bot.name (legacy).

agent_tooling_ref(bot: Any) -> str

Parameter Type Default Description
bot Any

Returns: str

Function hydrate_mcp

Return MCPServerConfig kwargs with headers/auth_config/env restored from the vault.

hydrate_mcp(spec: AgentMCPServerSpec) -> dict[str, Any]

Parameter Type Default Description
spec AgentMCPServerSpec

Returns: dict[str, Any]

Function hydrate_params

Return a deep copy of spec.params with vault secrets restored.

Raises KeyError (missing vault entry) / RuntimeError (vault unconfigured). Never logs values.

hydrate_params(spec: ToolkitSpec) -> dict[str, Any]

Parameter Type Default Description
spec ToolkitSpec

Returns: dict[str, Any]

Attribute logger

Function mask_mcp

API dump of an MCP spec: each vaulted field rendered as SECRET_MASK.

mask_mcp(spec: AgentMCPServerSpec) -> dict[str, Any]

Parameter Type Default Description
spec AgentMCPServerSpec

Returns: dict[str, Any]

Function mask_spec

API dump: every secret_refs key rendered as SECRET_MASK inside params.

mask_spec(spec: ToolkitSpec) -> dict[str, Any]

Parameter Type Default Description
spec ToolkitSpec

Returns: dict[str, Any]

Function mcp_vault_name

Return f"mcp_agent_{server}_{agent_ref}" (never collides with per-user mcp_).

mcp_vault_name(server: str, agent_ref: str) -> str

Parameter Type Default Description
server str
agent_ref str

Returns: str

Function normalize_tooling

Merge every legacy shape into (tools, toolkit specs, mcp specs).

Bare strings in toolkits become ToolkitSpec(slug=s); dicts are validated. toolkit_config is the DB JSONB map {slug: spec-dict} (slug key optional). A slug that is both a plain tool name and a spec is emitted once, as the spec. Duplicate specs for one slug: the last one wins (WARNING). Invalid entries → WARNING, dropped.

normalize_tooling(tools: Sequence[Any] | None, toolkits: Sequence[Any] | None = None, mcp_servers: Sequence[Any] | None = None, *, toolkit_config: dict[str, dict[str, Any]] | None = None) -> NormalizedTooling

Parameter Type Default Description
tools Sequence[Any] | None
toolkits Sequence[Any] | None None
mcp_servers Sequence[Any] | None None
toolkit_config dict[str, dict[str, Any]] | None None

Returns: NormalizedTooling

Alias retrieve_vault_credential

Re-exported from parrot.security.vault_utils.retrieve_vault_credential.

Function tooling_revision

sha256 of the canonical JSON of both lists (secret values are never in a spec).

tooling_revision(toolkits: Sequence[ToolkitSpec], mcp_servers: Sequence[AgentMCPServerSpec]) -> str

Parameter Type Default Description
toolkits Sequence[ToolkitSpec]
mcp_servers Sequence[AgentMCPServerSpec]

Returns: str

Function toolkit_override_vault_name

Per-user override vault name (spec §2.5c): f"toolkit_{slug}_{agent_ref}_user".

toolkit_override_vault_name(slug: str, agent_ref: str) -> str

Parameter Type Default Description
slug str
agent_ref str

Returns: str

Function toolkit_vault_name

Return f"toolkit_{slug}_{agent_ref}" (agent_ref = tooling ref; a legacy agent's ref is its name).

toolkit_vault_name(slug: str, agent_ref: str) -> str

Parameter Type Default Description
slug str
agent_ref str

Returns: str

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally