Skip to main content

Crate ryu_tool_registry

Crate ryu_tool_registry 

Source
Expand description

Unified tool-catalog primitive (#474, P1) — extracted from apps/core.

One searchable catalog across MCP servers + built-ins + Composio + plugin tools + Agent Skills — no parallel registry. run_search ranks descriptors with a swappable ToolRanker (BM25 default, semantic rerank as a second impl seam, selectable via a pref key mirroring catalog.active_source.{kind}). describe_from_parts / describe_composio return a tool’s argument schema.

Contract 1 (spec Appendix A, verbatim): ToolKind / ToolDescriptor / DescribedTool / DescribedArg.

§The boundary type is ToolDescriptor, never Core’s RegistryTool

This crate owns the catalog contract + ranker + describe-shaping — the portable data layer. What stays Core-side (bound to the McpRegistry sidecar object + the built-in server inventory) is the ingest adapter: Core’s descriptor_from(&RegistryTool) maps its registry rows into ToolDescriptor, classify_kind resolves the ToolKind from the sidecar server inventory, and the Composio live fetch produces the composio descriptors. Core then hands those descriptors to run_search / describe_from_parts. So the crate never sees a Core type — zero dependency on apps/core.

§The embedder seam (ToolEmbedder)

ToolRanker::Semantic embeds the query + candidates and ranks by cosine similarity. The embedder is injected as a narrow ToolEmbedder trait object; Core wraps its registry-driven retrieval::Embedder behind this in apps/core/src/tool_registry_host.rs (the SearchEmbedder/search_host.rs precedent).

Placement (CLAUDE.md §1): discovering what tools exist and ranking them is orchestration → Core. The allowlist verdict / budget / audit is Gateway.

Structs§

DescribedArg
One argument of a DescribedTool (Contract 1).
DescribedTool
A fully-described tool with its argument schema (Contract 1).
ToolDescriptor
A ranked tool descriptor (Contract 1).

Enums§

ToolKind
Source plane of a catalog entry. Serializes lowercase: mcp|builtin|composio|app, plus core-api for Core’s own HTTP endpoints exposed as agent-drivable tools, command for a declarative app tool that execs an allowlisted local CLI, and skill for an Agent Skill.
ToolRanker
A swappable tool ranking strategy. BM25 is the default; Semantic is a real embedder-backed second strategy (enum-dispatch in ToolRanker::rank), not a placeholder — it embeds the query + candidates and ranks by cosine similarity.

Constants§

RANKER_PREF_KEY
Pref key selecting the active ranker, mirroring catalog.active_source.{kind}.

Traits§

ToolEmbedder
A minimal embedder seam for ToolRanker::Semantic. Core implements this in tool_registry_host.rs over its registry-configured retrieval::Embedder so this crate never depends on apps/core. embed returns None when the embedder is unreachable, which the ranker treats as a documented BM25 fallback (not an error).

Functions§

arg_summary
Extract (arg_names, arg_descriptions) from a JSON-schema input_schema. The RegistryToolToolDescriptor ingest adapter lives Core-side; this is exported so that adapter can reuse the same arg-name extraction.
describe_composio
Describe a composio__<slug> id shallowly: a single freeform arguments object row (the action’s full schema is not listed). The pure body of the Composio branch of Core’s McpRegistry::describe.
describe_from_parts
Build a fully-described tool from its parts — the pure body of the non-Composio branch of Core’s McpRegistry::describe. Core resolves kind via its inventory-bound classify_kind and passes the located tool’s fields; the crate owns the arg-schema parsing and the shallow/parameters shaping.
described_args
Extract the full DescribedArg list from an input_schema.
run_search
Run the unified tool-catalog search over already-gathered descriptors — the pure body of Core’s McpRegistry::search.