Skip to content

API Reference parrot.tools.toolkit

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

parrot.tools.toolkit

View source

AbstractToolkit for creating collections of tools from class methods.

Alias AbstractPermissionResolver

Re-exported from parrot.auth.resolver.AbstractPermissionResolver.

Alias AbstractTool

Re-exported from parrot.tools.abstract.AbstractTool.

Alias AbstractToolArgsSchema

Re-exported from parrot.tools.abstract.AbstractToolArgsSchema.

Class AbstractToolkit

Abstract base class for creating toolkits - collections of related tools.

A toolkit automatically converts all public async methods into tools. Each method becomes a tool with:

  • Name: method name
  • Description: method docstring
  • Schema: automatically generated from type hints
Parameter Type Default Description
**kwargs {} Additional configuration

Attributes:

Attribute Type Description
input_class type[BaseModel] | None
json_encoder type[Any]
json_decoder type[Any]
exclude_tools tuple[str, ...]
tool_prefix str | None
prefix_separator str
confirming_tools frozenset
llm_dependent_tools frozenset
auto_open bool
config_model type[BaseModel] | None
secret_params frozenset[str]
default_user_overridable frozenset[str]
options_params frozenset[str]
tenant_bound bool
read_tools frozenset[str]
return_direct bool
base_url str
credential_provider str | None

Method AbstractToolkit.start

Optional startup logic for the toolkit. Override in subclasses if needed.

start() -> None

Method AbstractToolkit.stop

Optional shutdown logic for the toolkit. Override in subclasses if needed.

stop() -> None

Method AbstractToolkit.cleanup

Optional cleanup logic for the toolkit. Override in subclasses if needed.

cleanup() -> None

Method AbstractToolkit.get_tools

Get all tools from this toolkit, optionally filtered by permissions.

Inspects all public methods and converts them to tools.

.. note::

Permission filtering requires ``await`` because resolvers are
async.  Use :meth:`get_tools_filtered` for the async path.
When *permission_context* and *resolver* are passed here the
method returns **all** tools (backward-compatible) — callers
must migrate to ``get_tools_filtered()`` for actual filtering.

get_tools(permission_context: Optional[PermissionContext] = None, resolver: Optional[AbstractPermissionResolver] = None) -> list[AbstractTool]

Parameter Type Default Description
permission_context Optional[PermissionContext] None Ignored (kept for signature compat). Use :meth:get_tools_filtered instead.
resolver Optional[AbstractPermissionResolver] None Ignored (kept for signature compat).

Returns: list[AbstractTool] — List of AbstractTool instances (unfiltered).

Method AbstractToolkit.get_tools_filtered

Get tools filtered by async permission resolver.

This is the async-aware version of :meth:get_tools that supports Layer 1 preventive filtering through the resolver.

get_tools_filtered(permission_context: PermissionContext, resolver: AbstractPermissionResolver) -> list[AbstractTool]

Parameter Type Default Description
permission_context PermissionContext User context for permission filtering.
resolver AbstractPermissionResolver Permission resolver for checking access (async).

Returns: list[AbstractTool] — Filtered list of AbstractTool instances the user may execute.

Method AbstractToolkit.get_tools_sync

Synchronous alias for get_tools(). Returns all tools (unfiltered).

get_tools_sync(permission_context: Optional[PermissionContext] = None, resolver: Optional[AbstractPermissionResolver] = None) -> list[AbstractTool]

Parameter Type Default Description
permission_context Optional[PermissionContext] None
resolver Optional[AbstractPermissionResolver] None

Returns: list[AbstractTool]

Method AbstractToolkit.get_tool

Get a specific tool by name.

get_tool(name: str) -> AbstractTool | None

Parameter Type Default Description
name str Tool name

Returns: AbstractTool | None — AbstractTool instance or None if not found

Method AbstractToolkit.list_tool_names

Get a list of all tool names in this toolkit.

list_tool_names() -> list[str]

Returns: list[str] — List of tool names

Method AbstractToolkit.config_schema

Return the FEAT-593 JSON Schema envelope {slug, class_name, source, schema}.

config_schema(slug: str) -> dict[str, Any]

Parameter Type Default Description
slug str

Returns: dict[str, Any]

Method AbstractToolkit.config_options

Dynamic choices for param (FEAT-593). Never exposed as an LLM tool.

config_options(param: str) -> list[ConfigOption]

Parameter Type Default Description
param str

Returns: list[ConfigOption]

Raises:

  • NotImplementedError — the toolkit offers no dynamic options for param.

Method AbstractToolkit.get_toolkit_info

Get information about this toolkit.

get_toolkit_info() -> dict[str, Any]

Returns: dict[str, Any] — Dictionary with toolkit information

Alias BASE_STATIC_URL

Re-exported from parrot.conf.BASE_STATIC_URL.

Alias ConfigOption

Re-exported from parrot.tools.config_schema.ConfigOption.

Alias PermissionContext

Re-exported from parrot.auth.permission.PermissionContext.

Alias ServerManagedToolkit

Re-exported from parrot.tools.execution_gates.ServerManagedToolkit.

Class ToolkitTool

A specialized AbstractTool that wraps a method from a toolkit.

Parameter Type Default Description
name str Tool name
bound_method callable The bound coroutine method to wrap
description str None Tool description
args_schema type[BaseModel] None Pydantic model for arguments
**kwargs {} Additional arguments

Alias checked_args_schema

Re-exported from parrot.tools.execution_gates.checked_args_schema.

Alias checked_executor

Re-exported from parrot.tools.execution_gates.checked_executor.

Function effective_access

Effective access of toolkit method method_name: "read", "write" or None.

"read" when listed in cls.read_tools; "write" (fail-safe) for other methods of a host toolkit; None for built-ins (unchanged behaviour).

effective_access(cls: type, method_name: str) -> Optional[str]

Parameter Type Default Description
method_name str

Returns: Optional[str]

Alias toolkit_server_params

Re-exported from parrot.tools.execution_gates.toolkit_server_params.

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