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

Tool for writing file contents with read-before-write. More...

Inheritance diagram for entropic::WriteFileTool:
Collaboration diagram for entropic::WriteFileTool:

Public Member Functions

 WriteFileTool (FilesystemServer &server, const std::string &data_dir)
 Construct from server reference and data directory.
 
ServerResponse execute (const std::string &args_json) override
 Write content to a file after read-before-write check.
 
- 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.
 
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.
 

Additional Inherited Members

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

Detailed Description

Tool for writing file contents with read-before-write.

@dg_internal

Version
1.8.5

Definition at line 963 of file filesystem.cpp.

Constructor & Destructor Documentation

◆ WriteFileTool()

entropic::WriteFileTool::WriteFileTool ( 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 972 of file filesystem.cpp.

Member Function Documentation

◆ execute()

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

Write content to a file after read-before-write check.

Execute write_file: resolve, enforce policy, write.

Parameters
args_jsonJSON with "path" and "content" keys.
Returns
ServerResponse with result or error. @dg_internal
Version
1.8.5

The path is resolved against the root first (so a traversal attempt never reaches the write), then the read-before-write gate runs.

Parameters
args_jsonJSON with "path" and "content" keys.
Returns
A ServerResponse with no directives whose result is either a success JSON naming the path and bytes written, or the structured read_before_write error — in which case nothing is written. @req REQ-MCP-021
Version
1.8.5

Implements entropic::ToolBase.

Definition at line 1006 of file filesystem.cpp.


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