Back to .md Directory

MCP Filesystem Ultra — System Prompt for Claude Desktop

Documents 16 filesystem tools for Claude Desktop with usage tables, critical rules, and JSON examples.

May 2, 2026
0 downloads
1 views
ai prompt mcp claude
View source

What this file does

Documents 16 filesystem tools for Claude Desktop with usage tables, critical rules, and JSON examples.

When to use it

  • You run the mcp-filesystem-go-ultra MCP server and want Claude to use its tools correctly
  • You need a reference for file read, write, edit, search, and batch operations
  • You want to enforce safe editing workflows (read-before-edit, dry runs, error recovery)
  • You are writing a CLAUDE.md or system prompt for a project using this MCP server

Assumes this stack

MCPClaude Desktopfilesystem-ultraGo

MCP Filesystem Ultra — System Prompt for Claude Desktop

Copy this section into your project's CLAUDE.md or system prompt to help Claude Desktop use the filesystem-ultra tools correctly.


filesystem-ultra Tool Reference (v4.1.3 — 16 tools)

Reading Files

NeedToolParameters
Read full fileread_filepath
Read specific linesread_filepath, start_line, end_line
Read first/last N linesread_filepath, max_lines, mode ("head" or "tail")
Read binary as base64read_filepath, encoding: "base64"

Writing Files

NeedToolParameters
Write/create filewrite_filepath, content
Write binary from base64write_filepath, content_base64 or content + encoding: "base64"

Editing Files

NeedToolParameters
Replace exact textedit_filepath, old_text, new_text
Multiple edits same filemulti_editpath, edits_json (array of {old_text, new_text})
Regex find-replace alledit_filepath, mode: "search_replace", pattern, replacement
Replace Nth matchedit_filepath, old_text, new_text, occurrence: N (1=first, -1=last)
Regex with capturesedit_filepath, mode: "regex", patterns_json

Search

NeedToolParameters
Search filessearch_filespath, pattern, file_types (optional)
Content searchsearch_filespath, pattern, include_content: true
Advanced searchsearch_filespath, pattern, case_sensitive: true, include_context: true
Count patternsearch_filespath, pattern, count_only: true

File Operations

NeedToolParameters
List directorylist_directorypath
File infoget_file_infopath
Copycopy_filesource_path, dest_path
Move/renamemove_filesource_path, dest_path
Delete (soft)delete_filepath
Delete (permanent)delete_filepath, permanent: true
Create directorycreate_directorypath

Batch & Pipeline

NeedToolParameters
Multi-file atomic opsbatch_operationsrequest_json — see below
Multi-step pipelinebatch_operationspipeline_json — see below
Batch renamebatch_operationsrename_json

Other

NeedToolParameters
Backup managementbackupaction (list/info/compare/cleanup/restore), backup_id
Restore backupbackupaction: "restore", backup_id, file_path (optional)
Analyze before doinganalyze_operationpath, operation (file/edit/delete/write/optimize)
Performance statsserver_infoaction: "stats"
Helpserver_infoaction: "help", topic (optional)
Artifact captureserver_infoaction: "artifact", sub_action (capture/write/info)
WSL syncwslwsl_path or windows_path, direction
WSL statuswslaction: "status"

Critical Rules

1. ALWAYS verify paths before using them

  • Copy-paste paths exactly from list_directory or search_files results
  • Never retype paths from memory — typos cause silent failures
  • If a tool returns "file not found", double-check the path character by character

2. Read before editing

  • ALWAYS read the file (or relevant range) before calling edit_file or multi_edit
  • Use the exact text from the read result as old_text
  • old_text must match the file content exactly — it's a literal match, not a regex

3. batch_operations format

Supported operation types: write, edit, search_and_replace, copy, move, delete, create_dir

{
  "operations": [
    {"type": "edit", "path": "file1.cs", "old_text": "old", "new_text": "new"},
    {"type": "edit", "path": "file2.cs", "old_text": "old", "new_text": "new"},
    {"type": "search_and_replace", "path": "file3.cs", "old_text": "pattern", "new_text": "replacement"},
    {"type": "copy", "source": "a.txt", "destination": "b.txt"}
  ],
  "atomic": true,
  "create_backup": true
}

Do NOT use types that don't exist (e.g. search_replace, find_replace). Only the 7 types listed above.

4. Pipeline JSON — double-escape regex

Inside pipeline_json, regex backslashes need double-escaping because it's JSON-in-JSON:

  • \. → \\\\.
  • \b → \\\\b
  • \d+ → \\\\d+

For complex regex patterns, prefer using edit_file with mode:"regex" directly instead of inside a pipeline.

5. Large edits — use anchors

For replacing large code blocks (>10 lines):

  1. Use a short, unique anchor line as old_text in edit_file to insert the new block
  2. Then use a second edit_file to remove the remaining old block
  3. Do NOT try to put 50+ lines of code as new_text inside batch_operations — the JSON escaping will break

6. One edit at a time on the same file

  • After each edit_file on a file, re-read before the next edit
  • The file content changes after each edit — stale old_text from a previous read will fail
  • Exception: multi_edit handles multiple edits in one call (preferred for same-file changes)

7. edit_file modes

  • Default mode: replaces ONE exact text match — use for targeted, precise edits
  • mode:"search_replace": replaces ALL occurrences of a pattern (regex or literal) — use for global refactors
  • mode:"regex": advanced regex with capture groups — use for complex transformations
  • Always run search_files with count_only:true before global replace to verify impact

8. Dry Run Before Destructive Operations

  • Use analyze_operation to preview the impact of write, edit, or delete operations
  • Use edit_file with dry_run: true for regex mode to validate patterns
  • Use batch_operations pipeline with dry_run: true to preview pipeline execution

9. Error recovery

  • If edit_file says "old_text not found": re-read the file and try again with exact text
  • If batch_operations fails: check the error for which operation failed and why
  • If a tool returns no response (timeout): retry once, the file system may have been briefly locked

What's inside

One tool reference table (16 tools), 9 critical rules, 3 JSON examples, and parameter details for each tool.

Change this for your project

  • Replace mcp-filesystem-go-ultra with your actual MCP server name if different
  • Replace CLAUDE.md with your project's system prompt filename if different
  • Replace any hardcoded paths in examples (like file1.cs) with your project's file paths

Where it goes

Use as the system prompt for your model call, or as the base instructions in your agent framework.

Worth borrowing

  • Grouping tools by user need (Read, Write, Edit, Search) rather than by tool name
  • Including a dry-run and error recovery section to prevent destructive mistakes
  • Using a table format for quick lookup of tool names and parameters

Related Documents