Expand description
Turning skills into rmcp tool routes.
route_skill adapts one Skill into an rmcp ToolRoute you can
add to a ToolRouter<S>. The adapter applies the framework’s intrinsic
pre-call behavior — the declarative validation gate — and then invokes
the skill body:
- Build the MCP
Toolmetadata (name,description,inputSchema) from the skill. - On each call, run
Skill::validate. On failure, return the structured{"validation_failed": [...]}payload as the result so the calling model can correct itself without parsing English error strings — the body never runs. - On success, build a
SkillCtxand await the skill body.
Application-specific concerns (capability gating, backgrounding, recall,
per-tool metrics) are intentionally NOT baked in here — wrap or replace
this adapter when you need them. with_extra_property helps with one
common extension: injecting a global argument into every tool’s schema.
Functions§
- route_
skill - Adapt one boxed
Skillinto a ready-to-registerToolRoute. Applies the declarative validation gate before invoking the skill body. See the module docs for the exact behavior. - route_
skill_ gated - Like
route_skill, but also enforces a system-requirements gate. - routes_
gated - Resolve capabilities for a whole tool set and build a capability-gated
ToolRoutefor every skill in one step. Returns the routes alongside the resolvedCapabilitiesmap — keep the map for a startup log line or a status snapshot. Equivalent tocrate::capability::resolvefollowed byroute_skill_gatedper skill. - with_
extra_ property - Inject a property into a tool’s argument schema, returning a new schema.