Tools¶
Tool discovery, schemas and invocation.
registry
¶
Tool resolution and execution across local functions and MCP servers.
Supports local Python modules, MCP stdio subprocesses, and MCP HTTP endpoints.
ToolError
¶
Bases: RuntimeError
Raised when a tool cannot be resolved or fails during execution.
ToolSpec
dataclass
¶
Specification of a tool callable by agents.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Tool name. |
provider |
str
|
Name of the provider providing the tool. |
description |
str
|
Explanation of what the tool does. |
parameters |
dict[str, Any]
|
JSON schema dictionary describing input arguments. |
signature
¶
Returns a Python-like signature representation for prompting.
Source code in python/src/science_adk/tools/registry.py
to_dict
¶
Serializes the ToolSpec to a dictionary.
LocalBackend
¶
McpStdioBackend
¶
Communicates with an MCP server subprocess via stdio JSON-RPC.
Source code in python/src/science_adk/tools/registry.py
list_tools
¶
Lists tools exposed by the stdio MCP server.
Source code in python/src/science_adk/tools/registry.py
call
¶
Executes a tool on the stdio MCP server.
Source code in python/src/science_adk/tools/registry.py
close
¶
Terminates the subprocess.
Source code in python/src/science_adk/tools/registry.py
McpHttpBackend
¶
Communicates with a remote MCP server over HTTP.
Source code in python/src/science_adk/tools/registry.py
list_tools
¶
Lists tools exposed by the remote HTTP MCP server.
Source code in python/src/science_adk/tools/registry.py
call
¶
Executes a tool on the remote HTTP MCP server.
ToolRegistry
¶
Aggregates and resolves tools across all configured providers.
Source code in python/src/science_adk/tools/registry.py
from_project
classmethod
¶
specs
¶
Returns all ToolSpecs from all active providers.
Source code in python/src/science_adk/tools/registry.py
resolve
¶
Resolves a tool by qualified or unqualified name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Qualified ('provider.tool') or bare tool name. |
required |
Returns:
| Type | Description |
|---|---|
ToolSpec
|
Matching ToolSpec. |
Raises:
| Type | Description |
|---|---|
ToolError
|
If tool is missing or name is ambiguous. |
Source code in python/src/science_adk/tools/registry.py
call
¶
Invokes a tool by name with arguments.
close
¶
Closes all active provider backends.