Tools and registry#
Three files define the tool story. Memorize the chain.
Chain#
tools/registry.py → tools/*.py register() → model_tools.py discovery
↓
toolsets.py names what the model sees
↓
handle_function_call() dispatches handlerstools/registry.py#
- Zero project deps — imported by every tool module
registry.register(name=..., toolset=..., schema=..., handler=..., check_fn=...)check_fnanswers reachability/opt-in for the profile it runs under; results are TTL-cached keyed by hermes home- Handlers return a JSON string
toolsets.py#
- Single
TOOLSETSdict and_HERMES_CORE_TOOLS - Platforms inherit/enable toolsets via config (
hermes tools) - Registered but unnamed in any selected toolset ⇒ invisible to the model
model_tools.py#
- Triggers
discover_builtin_tools() - Builds OpenAPI-ish tool schemas for the API call
handle_function_call()is the dispatch entry used by the turn loop- May post-process schema descriptions for cross-tool references when those tools are actually available
Adding capability (decision reminder)#
| Need | Prefer |
|---|---|
| Procedure the agent should follow | Skill (SKILL.md) |
| Niche / user-specific tool | Plugin ctx.register_tool |
| Optional when a service is configured | Service-gated tool with check_fn |
| Fundamental + nearly universal | Core tool (last resort) — see Footprint Ladder |
For these tutorials, practice skills and plugins in user space (Labs) before proposing core tools.
Schema hygiene#
- Do not hardcode cross-toolset tool names into schema descriptions (the other tool may be disabled)
- Paths shown to users should use
display_hermes_home(); state files resolve viaget_hermes_home()at call time - No
offset/limitpagination on instructional loaders (skills, prompts) — models skip past page 1
Exercise#
- Open any
tools/*_tool.pyand find theregistry.register(...)call - Grep that tool name in
toolsets.py - From
model_tools.py, findhandle_function_calland note how args reach the handler
Next#
Further reading#
website/docs/developer-guide/tools-runtime.mdwebsite/docs/developer-guide/adding-tools.mdtools/AGENTS.md