Tool Manifest Protocol¶
Overview¶
The tool registry manages external tool discovery, versioning, and lifecycle. Tools are fetched from registered sources, stored locally, and pinned to immutable catalog revisions that runs reference at creation time.
Entities¶
ToolSource¶
A registered endpoint that exposes tool manifests.
| Field | Type | Description |
|---|---|---|
service_id | VARCHAR(128) | Logical name of the source service |
base_url | VARCHAR(1024) | URL to fetch the tool manifest from |
status | ENUM | active, inactive, error |
last_synced_at | TIMESTAMP | Last successful sync timestamp |
error_message | TEXT | Last error (if status is error) |
Tool¶
A single tool definition discovered from a source.
| Field | Type | Description |
|---|---|---|
tool_source_id | BIGINT | FK to the parent ToolSource |
tool_id | VARCHAR(255) | Unique identifier within the source |
name | VARCHAR(255) | Human-readable tool name |
description | TEXT | Tool description for model context |
parameters_schema | JSONB | JSON Schema defining tool parameters |
enabled | BOOLEAN | Whether the tool is available for runs |
Uniqueness: (tool_source_id, tool_id).
ToolCatalogRevision¶
An immutable snapshot of the entire tool catalog at a point in time.
| Field | Type | Description |
|---|---|---|
revision | INT | Monotonically increasing revision number |
content_hash | VARCHAR(64) | SHA-256 hash of the serialized tool set |
snapshot | JSONB | Full tool definitions at this revision |
created_at | TIMESTAMP | When the revision was created |
Lifecycle¶
Source States¶
active ──[sync success]──→ active (last_synced_at updated)
active ──[sync error]────→ error (error_message set)
error ──[sync success]──→ active (error_message cleared)
any ──[admin action]──→ inactive
Refresh Flow¶
- Admin triggers
POST /admin/tools/refresh ToolRegistryService.refresh_all()iterates activeToolSourceentries- For each source: fetch manifest from
base_url(pending: HTTP fetch viahttpx) - Upsert
Toolrecords from the manifest - After all sources are processed, compute SHA-256 hash of all enabled tools (sorted by tool_id)
- Compare hash with the latest
ToolCatalogRevision.content_hash - If different: create a new
ToolCatalogRevisionwith incremented revision number and full snapshot - Return the current catalog revision
Content Hashing¶
The content hash is computed over a deterministic serialization of all enabled tools:
- Tools sorted by
tool_id - Each tool serialized as
{tool_id, name, description, parameters_schema} - SHA-256 of the JSON-serialized list
This ensures that only meaningful changes (tool additions, removals, or schema updates) trigger new revisions.
Run Pinning¶
When a run is created, it records the current ToolCatalogRevision.revision in ai_run.pinned_catalog_revision. This ensures:
- Tool definitions are frozen for the duration of the run
- The orchestrator uses exactly the tools that were available at run creation
- Concurrent tool refreshes do not affect in-flight runs
- Run history accurately reflects which tool versions were used
Tool Schema Structure¶
Tool parameters follow JSON Schema (draft 2020-12):
{
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The search query"
},
"limit": {
"type": "integer",
"default": 10
}
},
"required": ["query"]
}
The parameters_schema is passed directly to the model provider as part of the tool definition, enabling the model to generate valid tool call arguments.