mechaharness.tools.base
Tool protocol and in-process tool registry.
- class mechaharness.tools.base.Tool(name: str, handler: Callable[[...], str | Awaitable[str]], *, description: str = '', parameters: dict[str, Any] | None = None, grants: Sequence[object] | None = None, ability: Ability = Ability.SIMPLE)[source]
Bases:
objectA named callable exposed to harnesses as a ToolDefinition.
- __init__(name: str, handler: Callable[[...], str | Awaitable[str]], *, description: str = '', parameters: dict[str, Any] | None = None, grants: Sequence[object] | None = None, ability: Ability = Ability.SIMPLE) None[source]
- definition() ToolDefinition[source]
- class mechaharness.tools.base.ToolRegistry[source]
Bases:
objectIn-process map of tool name →
Toolfor harness tool calling.- definitions() list[ToolDefinition][source]
Provider-agnostic schemas for the current tool set.
- tool(name: str | None = None, *, description: str = '', parameters: dict[str, Any] | None = None, grants: Sequence[object] | None = None, ability: Ability = Ability.SIMPLE) Callable[[Callable[[...], str | Awaitable[str]]], Callable[[...], str | Awaitable[str]]][source]
Decorator that registers the wrapped function as a tool.