Tools#

This page presents all APIs and classes related to tools in PyAgentSpec.

Base Tool class#

class pyagentspec.tools.tool.Tool(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v25_4_1, max_agentspec_version=AgentSpecVersionEnum.v25_4_1, inputs=None, outputs=None)#

Bases: ComponentWithIO

A tool specifies a function made available to an agent or a flow.

It can be bound to one or more agents, which will use it when desired. It can be used in a flow by a dedicated tool execution step

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • inputs (List[Property] | None) – List of inputs accepted by this component

  • outputs (List[Property] | None) – List of outputs exposed by this component

Client Tool#

class pyagentspec.tools.clienttool.ClientTool(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v25_4_1, max_agentspec_version=AgentSpecVersionEnum.v25_4_1, inputs=None, outputs=None)#

Bases: Tool

A tool that needs to be run by the client application.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • inputs (List[Property] | None) – List of inputs accepted by this component

  • outputs (List[Property] | None) – List of outputs exposed by this component

Remote Tool#

class pyagentspec.tools.remotetool.RemoteTool(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v25_4_1, max_agentspec_version=AgentSpecVersionEnum.v25_4_1, inputs=None, outputs=None, url, http_method, api_spec_uri=None, data=<factory>, query_params=<factory>, headers=<factory>)#

Bases: Tool

A tool that is run remotely and called through REST.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • inputs (List[Property] | None) – List of inputs accepted by this component

  • outputs (List[Property] | None) – List of outputs exposed by this component

  • url (str) – The url of the API to which the call should be forwarded. Allows placeholders, which can define inputs

  • http_method (str) – The HTTP method to use for the API call (e.g., GET, POST, PUT, …). Allows placeholders, which can define inputs

  • api_spec_uri (str | None) – The uri of the specification of the API that is going to be called. Allows placeholders, which can define inputs

  • data (Dict[str, Any]) – The data to send as part of the body of this API call. Allows placeholders in dict values, which can define inputs

  • query_params (Dict[str, Any]) – Query parameters for the API call. Allows placeholders in dict values, which can define inputs

  • headers (Dict[str, Any]) – Additional headers for the API call. Allows placeholders in dict values, which can define inputs

api_spec_uri: str | None#

The uri of the specification of the API that is going to be called. Allows placeholders, which can define inputs

data: Dict[str, Any]#

The data to send as part of the body of this API call. Allows placeholders in dict values, which can define inputs

headers: Dict[str, Any]#

Additional headers for the API call. Allows placeholders in dict values, which can define inputs

http_method: str#

The HTTP method to use for the API call (e.g., GET, POST, PUT, …). Allows placeholders, which can define inputs

query_params: Dict[str, Any]#

Query parameters for the API call. Allows placeholders in dict values, which can define inputs

url: str#

The url of the API to which the call should be forwarded. Allows placeholders, which can define inputs

Server Tool#

class pyagentspec.tools.servertool.ServerTool(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v25_4_1, max_agentspec_version=AgentSpecVersionEnum.v25_4_1, inputs=None, outputs=None)#

Bases: Tool

A tool that is registered to and executed by the orchestrator.

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • inputs (List[Property] | None) – List of inputs accepted by this component

  • outputs (List[Property] | None) – List of outputs exposed by this component

MCP Tool#

class pyagentspec.mcp.tools.MCPTool(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v25_4_1, max_agentspec_version=AgentSpecVersionEnum.v25_4_1, inputs=None, outputs=None, client_transport)#

Bases: Tool

Class for tools exposed by MCP servers

Parameters:
  • id (str) – A unique identifier for this Component

  • name (str) – Name of this Component

  • description (str | None) – Optional description of this Component

  • metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component

  • min_agentspec_version (AgentSpecVersionEnum) –

  • max_agentspec_version (AgentSpecVersionEnum) –

  • inputs (List[Property] | None) – List of inputs accepted by this component

  • outputs (List[Property] | None) – List of outputs exposed by this component

  • client_transport (ClientTransport) – Transport to use for establishing and managing connections to the MCP server.

client_transport: ClientTransport#

Transport to use for establishing and managing connections to the MCP server.