>cogtrix v0.5.2

Tools API

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

See also: Custom tools for the practical guide.

Declaring a tool. A tool module exports a TOOL_CONFIG dict (or a TOOL_CONFIGS list) with name, description, input_schema, and requires_confirmation. There is no ToolConfig class or @register_tool decorator — registration is driven by those module-level dicts.

cogtrix_core.tools.configure

Factory functions that build and wire the toolbox at startup and on provider/model switches.

Key callables:

  • load_tools(tool_filter=...) — load tool modules from cogtrix_core/tools/.
  • build_tool_catalog(tools) — build the {name: one-line-description} catalogue the agent sees.
  • configure_*(...) — per-module wiring functions (e.g. configure_brave_search) that inject API keys and runtime config.

cogtrix_core.tools.resolver

The canonical fuzzy tool-name resolver, used by both the process_tools node and the request_tools meta-tool.

Key callables:

  • resolve_tool_name(requested, available_tools, active_tool_names=None) — resolve an exact or fuzzy name to (name, source); returns (None, "none") on no match.
  • top_k_candidates(...) — the ranked candidate list behind the resolver.

cogtrix_core.tools.registry

The tool registry — dynamic discovery, tool wrapping, and metadata. cogtrix_core.registry re-exports ToolRegistry from here for backward compatibility.

Key symbols:

  • ToolRegistry — discovers modules under cogtrix_core/tools/, imports each that declares TOOL_CONFIG(S), and registers its tools.
  • ToolRegistry.register_tool(func, config) — register one tool from a function + config dict.
  • ToolRegistry.requires_confirmation(name) — whether a tool is sensitive; the safety layer keys off this.