>cogtrix v0.3.0

Tools API

Interfaces for registering, configuring, and resolving tools — the surface you use when authoring a custom tool.

See also: Custom tools for the practical guide.

src.tools.configure

Tool configuration model — what each tool declaration looks like in code.

Key types:

  • ToolConfig — declarative config: name, description, safety_category, requires_confirmation, enabled_by_default.
  • @register_tool — decorator that pairs a function with its ToolConfig.

Source ↗

src.tools.resolver

Resolves tool names to callable instances. Handles aliases, MCP-server prefixes, and disabled-tool filtering.

Key callables:

  • resolve_tool(name) — returns the registered StructuredTool or raises.
  • resolve_tools(names) — batch version.

Source ↗

src.registry

The lower-level dynamic loader. Walks src/tools/ at startup and imports each module that opts in via a top-level TOOL_CONFIGS list.

Key callable:

  • load_tools_from_directory(path) — scans for tool modules and registers each declared tool.

Source ↗