Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::ToolBase Class Referenceabstract

Abstract base class for individual MCP tools. More...

#include <entropic/mcp/tool_base.h>

Inheritance diagram for entropic::ToolBase:
Collaboration diagram for entropic::ToolBase:

Public Member Functions

 ToolBase (ToolDefinition def)
 Construct with a pre-built definition.
 
const std::string & name () const
 Get the tool name.
 
const ToolDefinitiondefinition () 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.
 

Detailed Description

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.

Version
1.8.5

Definition at line 45 of file tool_base.h.

Constructor & Destructor Documentation

◆ ToolBase()

entropic::ToolBase::ToolBase ( ToolDefinition  def)
explicit

Construct with a pre-built definition.

Parameters
defTool definition.
Version
1.8.5
Parameters
defTool definition.

Definition at line 27 of file tool_base.cpp.

Member Function Documentation

◆ anchor_key()

std::string entropic::ToolBase::anchor_key ( const std::string &  args_json) const
virtual

Generate anchor key for this tool result.

Default anchor_key — no anchoring.

Parameters
args_jsonTool call arguments as JSON string.
Returns
Anchor key string, or empty string for no anchor.
Version
1.8.5

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).

Parameters
args_jsonTool call arguments (unused).
Returns
Empty string.

Reimplemented in entropic::TodoTool, and entropic::ReadFileTool.

Definition at line 57 of file tool_base.cpp.

◆ definition()

const ToolDefinition & entropic::ToolBase::definition ( ) const

Get the full tool definition.

Returns
Tool definition reference.
Version
1.8.5
Returns
Tool definition reference.

Definition at line 46 of file tool_base.cpp.

◆ execute()

◆ name()

const std::string & entropic::ToolBase::name ( ) const

Get the tool name.

Returns
Tool name from definition.
Version
1.8.5
Returns
Tool name from definition.

Definition at line 36 of file tool_base.cpp.

◆ required_access_level()

MCPAccessLevel entropic::ToolBase::required_access_level ( ) const
virtual

Minimum access level required to execute this tool.

Default required access level — WRITE (safe default).

Returns
MCPAccessLevel::WRITE by default (safe default).
Version
1.9.4

Override in read-only tools (e.g., read_file, list_directory). The ToolExecutor checks this against the caller's MCPKeySet before executing.

Returns
MCPAccessLevel::WRITE.

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.

Member Data Documentation

◆ definition_

ToolDefinition entropic::ToolBase::definition_
protected

Tool definition.

Definition at line 102 of file tool_base.h.


The documentation for this class was generated from the following files: