FILE MCP Tools
Total Tools: 7
Quick Reference
# List all file tools
dmtools list | jq '.tools[] | select(.name | startswith("file_"))'
# Example usage
dmtools file_read [arguments]
Usage in JavaScript Agents
// Direct function calls for file tools
const result = file_read(...);
const result = file_write(...);
const result = file_delete(...);
Available Tools
| Tool Name | Description | Parameters |
|---|---|---|
file_delete | Delete file or directory from working directory. Returns success message or null on failure. | path (string, required) |
file_exists | Check whether a file or directory exists in the working directory. Returns true or false (false for paths outside the sandbox). | path (string, required) |
file_list | List the entries of a directory in the working directory. Returns JSON {“entries”: [absolute paths, sorted]} or null if the path is not a readable directory inside the sandbox. | path (string, required) |
file_read | Read file content from working directory (supports input/ and outputs/ folders). Returns file content as string or null if file doesn’t exist or is inaccessible. All file formats supported as UTF-8 text. | path (string, required) |
file_validate_json | Validate JSON string and return detailed error information if invalid. Returns JSON string with validation result: {“valid”: true} for valid JSON, or {“valid”: false, “error”: “error message”, “line”: line_number, “column”: column_number, “position”: character_position, “context”: “context around error”} for invalid JSON. | json (string, required) |
file_validate_json_file | Validate JSON file and return detailed error information if invalid. Reads file from working directory and validates its JSON content. Returns JSON string with validation result including file path. | path (string, required) |
file_write | Write content to file in working directory. Creates parent directories automatically. Returns success message or null on failure. | path (string, required)content (string, required) |
Detailed Parameter Information
file_delete
Delete file or directory from working directory. Returns success message or null on failure.
Parameters:
path(string) Required- File path relative to working directory or absolute path within working directory
- Example:
temp/unused_file.txt
Example:
dmtools file_delete "value"
// In JavaScript agent
const result = file_delete("path");
file_exists
Check whether a file or directory exists in the working directory. Returns true or false (false for paths outside the sandbox).
Parameters:
path(string) Required- File or directory path relative to working directory or absolute path within working directory
- Example:
outputs/response.md
Example:
dmtools file_exists "value"
// In JavaScript agent
const result = file_exists("path");
file_list
List the entries of a directory in the working directory. Returns JSON {“entries”: [absolute paths, sorted]} or null if the path is not a readable directory inside the sandbox.
Parameters:
path(string) Required- Directory path relative to working directory or absolute path within working directory
- Example:
outputs
Example:
dmtools file_list "value"
// In JavaScript agent
const result = file_list("path");
file_read
Read file content from working directory (supports input/ and outputs/ folders). Returns file content as string or null if file doesn’t exist or is inaccessible. All file formats supported as UTF-8 text.
Parameters:
path(string) Required- File path relative to working directory or absolute path within working directory
- Example:
outputs/response.md
Example:
dmtools file_read "value"
// In JavaScript agent
const result = file_read("path");
file_validate_json
Validate JSON string and return detailed error information if invalid. Returns JSON string with validation result: {“valid”: true} for valid JSON, or {“valid”: false, “error”: “error message”, “line”: line_number, “column”: column_number, “position”: character_position, “context”: “context around error”} for invalid JSON.
Parameters:
json(string) Required- JSON string to validate
- Example:
{"key": "value"}
Example:
dmtools file_validate_json "value"
// In JavaScript agent
const result = file_validate_json("json");
file_validate_json_file
Validate JSON file and return detailed error information if invalid. Reads file from working directory and validates its JSON content. Returns JSON string with validation result including file path.
Parameters:
path(string) Required- File path relative to working directory or absolute path within working directory
- Example:
outputs/response.json
Example:
dmtools file_validate_json_file "value"
// In JavaScript agent
const result = file_validate_json_file("path");
file_write
Write content to file in working directory. Creates parent directories automatically. Returns success message or null on failure.
Parameters:
-
path(string) Required- File path relative to working directory or absolute path within working directory
- Example:
inbox/raw/teams_messages/1729766400000-messages.json
-
content(string) Required- Content to write to the file as UTF-8 string
- Example:
{"messages": []}
Example:
dmtools file_write "value" "value"
// In JavaScript agent
const result = file_write("path", "content");