|
Entropic 2.3.8
Local-first agentic inference engine
|
Abstract base class for individual MCP tools. More...
#include <entropic/mcp/tool_base.h>


Public Member Functions | |
| ToolBase (ToolDefinition def) | |
| Construct with a pre-built definition. | |
| const std::string & | name () const |
| Get the tool name. | |
| const ToolDefinition & | definition () const |
| Get the full tool definition. | |
| virtual ServerResponse | execute (const std::string &args_json)=0 |
| Execute this tool with the given arguments. | |
| virtual std::string | anchor_key (const std::string &args_json) const |
| Generate anchor key for this tool result. | |
| virtual MCPAccessLevel | required_access_level () const |
| Minimum access level required to execute this tool. | |
Protected Attributes | |
| ToolDefinition | definition_ |
| Tool definition. | |
Abstract base class for individual MCP tools.
Subclass to create tools. Implement execute() with the tool's behavior. Provide the definition via constructor (from JSON file or inline).
Dependencies (file tracker, config, etc.) are injected via the subclass constructor.
Definition at line 45 of file tool_base.h.
|
explicit |
Construct with a pre-built definition.
| def | Tool definition. |
| def | Tool definition. |
Definition at line 27 of file tool_base.cpp.
|
virtual |
Generate anchor key for this tool result.
Default anchor_key — no anchoring.
| args_json | Tool call arguments as JSON string. |
Override in tools whose results should REPLACE previous results with the same key rather than accumulating in context. Default returns "" (no anchoring — results append normally).
| args_json | Tool call arguments (unused). |
Reimplemented in entropic::TodoTool, and entropic::ReadFileTool.
Definition at line 57 of file tool_base.cpp.
| const ToolDefinition & entropic::ToolBase::definition | ( | ) | const |
Get the full tool definition.
Definition at line 46 of file tool_base.cpp.
|
pure virtual |
Execute this tool with the given arguments.
| args_json | JSON string of arguments. |
Implemented in entropic::ExecuteTool, entropic::DiagnosticsTool, entropic::CheckErrorsTool, entropic::TodoTool, entropic::DelegateTool, entropic::PipelineTool, entropic::CompleteTool, entropic::PhaseChangeTool, entropic::PruneContextTool, entropic::DiagnoseTool, entropic::InspectTool, entropic::ContextInspectTool, entropic::FollowupTool, entropic::ResumeDelegationTool, entropic::ReadFileTool, entropic::WriteFileTool, entropic::EditFileTool, entropic::GlobTool, entropic::GrepTool, entropic::ListDirectoryTool, entropic::GitStatusTool, entropic::GitDiffTool, entropic::GitLogTool, entropic::GitCommitTool, entropic::GitBranchTool, entropic::GitCheckoutTool, entropic::GitAddTool, entropic::GitResetTool, entropic::WebFetchTool, and entropic::WebSearchTool.
| const std::string & entropic::ToolBase::name | ( | ) | const |
Get the tool name.
Definition at line 36 of file tool_base.cpp.
|
virtual |
Minimum access level required to execute this tool.
Default required access level — WRITE (safe default).
Override in read-only tools (e.g., read_file, list_directory). The ToolExecutor checks this against the caller's MCPKeySet before executing.
Reimplemented in entropic::DiagnosticsTool, entropic::CheckErrorsTool, entropic::DiagnoseTool, entropic::InspectTool, entropic::ContextInspectTool, entropic::FollowupTool, entropic::ReadFileTool, entropic::GlobTool, entropic::GrepTool, entropic::ListDirectoryTool, entropic::GitStatusTool, entropic::GitDiffTool, entropic::GitLogTool, entropic::WebFetchTool, and entropic::WebSearchTool.
Definition at line 68 of file tool_base.cpp.
|
protected |
Tool definition.
Definition at line 102 of file tool_base.h.