Entropic 2.11.1
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::ReadFileTool Class Reference

Tool for reading file contents with line numbering. More...

Inheritance diagram for entropic::ReadFileTool:
Collaboration diagram for entropic::ReadFileTool:

Public Member Functions

 ReadFileTool (FilesystemServer &server, const std::string &data_dir)
 Construct from server reference and data directory.
 
MCPAccessLevel required_access_level () const override
 Read-only tool — requires READ access.
 
ServerResponse execute (const std::string &args_json) override
 Read a file and return numbered lines as JSON.
 
std::string anchor_key (const std::string &args_json) const override
 Anchor key for context deduplication.
 
- Public Member Functions inherited from entropic::ToolBase
 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.
 

Additional Inherited Members

- Protected Attributes inherited from entropic::ToolBase
ToolDefinition definition_
 Tool definition.
 

Detailed Description

Tool for reading file contents with line numbering.

@dg_internal

Version
1.8.5

Definition at line 803 of file filesystem.cpp.

Constructor & Destructor Documentation

◆ ReadFileTool()

entropic::ReadFileTool::ReadFileTool ( FilesystemServer server,
const std::string &  data_dir 
)
inline

Construct from server reference and data directory.

Parameters
serverOwning filesystem server.
data_dirPath to bundled data directory. @dg_internal
Version
1.8.5

Definition at line 812 of file filesystem.cpp.

Member Function Documentation

◆ anchor_key()

std::string entropic::ReadFileTool::anchor_key ( const std::string &  args_json) const
inlineoverridevirtual

Anchor key for context deduplication.

A non-empty key is what makes MCPServerBase auto-inject the context_anchor directive for this tool.

Parameters
args_jsonJSON with "path" key.
Returns
"file:{path}" anchor key. @req REQ-MCP-001 @req REQ-MCP-021
Version
1.8.5

Reimplemented from entropic::ToolBase.

Definition at line 851 of file filesystem.cpp.

◆ execute()

ServerResponse entropic::ReadFileTool::execute ( const std::string &  args_json)
overridevirtual

Read a file and return numbered lines as JSON.

Execute read_file: resolve, gate, read, hash, track.

Parameters
args_jsonJSON with "path" key.
Returns
ServerResponse with file content or error. @dg_internal
Version
1.8.5

Issue #15 (v2.1.4): pre-read gating moved into check_read_gates so the ignore-matcher refusal lives next to existence + size checks.

A successful read records the content hash in the FileAccessTracker — which is why read_file must always execute and opts out of duplicate detection.

Parameters
args_jsonJSON with a "path" key.
Returns
A ServerResponse with no directives whose result is either the numbered-lines JSON or the first failing gate's structured error. @req REQ-MCP-021
Version
2.1.4

Implements entropic::ToolBase.

Definition at line 939 of file filesystem.cpp.

◆ required_access_level()

MCPAccessLevel entropic::ReadFileTool::required_access_level ( ) const
inlineoverridevirtual

Read-only tool — requires READ access.

Returns
MCPAccessLevel::READ, relaxing ToolBase's WRITE default because this tool only inspects the workspace. @req REQ-MCP-011
Version
1.9.4

Reimplemented from entropic::ToolBase.

Definition at line 826 of file filesystem.cpp.


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