Skip to main content
Glama

help

Access detailed help and examples for file editing tools that make targeted modifications using stream editors like sed and awk.

Instructions

Get detailed help and examples for smalledit tools

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toolNoTool name for help (e.g., "sed_edit", "perl_edit") or "all" for overview

Implementation Reference

  • The execution handler for the 'help' tool. It extracts the optional 'tool' parameter, looks up the corresponding help content from the helpContent object, and returns it as text content.
    case 'help': {
      const { tool = 'all' } = args;
      
      const helpKey = tool === 'all' ? 'overview' : tool;
      const content = helpContent[helpKey] || `No help available for tool: ${tool}\n\nAvailable tools: ${Object.keys(helpContent).join(', ')}`;
      
      return {
        content: [{
          type: 'text',
          text: content
        }]
      };
    }
  • The input schema definition for the 'help' tool, specifying an optional 'tool' string parameter.
    inputSchema: {
      type: 'object',
      properties: {
        tool: {
          type: 'string',
          description: 'Tool name for help (e.g., "sed_edit", "perl_edit") or "all" for overview'
        }
      }
    }
  • src/index.ts:265-277 (registration)
    Registration of the 'help' tool in the listTools response, including name, description, and input schema.
    {
      name: 'help',
      description: 'Get detailed help and examples for smalledit tools',
      inputSchema: {
        type: 'object',
        properties: {
          tool: {
            type: 'string',
            description: 'Tool name for help (e.g., "sed_edit", "perl_edit") or "all" for overview'
          }
        }
      }
    }
  • The helpContent object containing detailed documentation and examples for all tools, including 'overview' and per-tool help texts used by the 'help' handler.
    const helpContent = {
      overview: `SmallEdit MCP Tool - Help
    ========================
    Provides efficient tools for small, targeted file edits.
    
    Available tools:
    - sed_edit: Pattern-based file editing (uses perl backend)
    - perl_edit: Direct perl one-liner execution
    - quick_replace: Simple find/replace without regex
    - line_edit: Edit specific lines by number
    - awk_process: AWK script processing
    - sed_multifile: Apply patterns to multiple files
    - diff_preview: Preview changes before applying
    - restore_backup: Restore files from .bak backups
    - list_backups: Find all backup files
    - help: This help system
    
    šŸŽÆ WHEN TO USE SMALLEDIT vs FILESYSTEM TOOLS:
    ==========================================
    USE SMALLEDIT FOR:
    - Single line changes
    - Simple pattern replacements  
    - Version number updates
    - Removing debug statements
    - Quick find/replace operations
    - Bulk simple edits across files
    
    USE FILESYSTEM TOOLS INSTEAD FOR:
    - Multi-line code blocks
    - Complex JSON/YAML structures
    - Adding new functions or classes
    - Large refactoring operations
    - Any edit that's hard to express as a pattern
    - When you need precise control over formatting
    
    āš ļø COMMON ISSUES TO AVOID:
    - Don't use smalledit for complex multi-line edits
    - Be careful with quotes in shell commands
    - Always preview changes first with diff_preview
    - Clean up .bak files periodically
    - Remember perl syntax differs from sed
    
    šŸ’” BETTER ALTERNATIVES:
    - Instead of sed → Use perl (more portable)
    - For JSON files → Consider jq instead
    - For YAML files → Consider yq instead  
    - For modern sed → Install 'sd' (brew install sd)
    - For better grep → Use ripgrep (rg)
    
    šŸ’” RECOMMENDED WORKFLOW:
    1. Use diff_preview first to check changes
    2. If it looks good, apply the edit
    3. If something goes wrong, use restore_backup
    4. Use list_backups to find and clean old backups
    
    General tips:
    - Always use preview/diff_preview to test first
    - Backups are created by default (.bak files)
    - Perl patterns are more portable than sed
    - Use quotes carefully in patterns
    
    šŸ›‘ TROUBLESHOOTING:
    ================
    If you see errors like:
    - "undefined label 'ard/Code'" → macOS sed issue, use perl instead
    - "unterminated substitute" → Quote escaping problem
    - "extra characters at end" → Multi-line content issue, use filesystem tools
    - "division by zero" (awk) → Check field separators and data format
    
    šŸ“¦ SMALLEDIT PHILOSOPHY:
    =====================
    SmallEdit is designed for SMALL edits. If you're trying to do something
    complex and getting errors, you're probably using the wrong tool.
    That's not a bug - it's a feature! Use filesystem:edit_file instead.
    `,
      sed_edit: `sed_edit - Pattern-based file editing
    ===================================
    Uses perl backend for cross-platform compatibility.
    
    Examples:
      // Simple replacement
      sed_edit({ file: "config.json", pattern: "s/localhost/production/g" })
      
      // Delete lines containing pattern
      sed_edit({ file: "app.js", pattern: "$_ = '' if /console\\.log/" })
      
      // Preview changes first
      sed_edit({ file: "test.txt", pattern: "s/old/new/g", preview: true })
      
      // Edit without backup
      sed_edit({ file: "temp.txt", pattern: "s/a/b/g", backup: false })
    
    Note: Actually uses perl internally for better compatibility.
    
    WHEN NOT TO USE:
    - Multi-line replacements
    - Complex code modifications  
    - JSON/YAML structure changes
    → Use filesystem:edit_file instead!
    `,
      perl_edit: `perl_edit - Perl one-liner execution
    ===================================
    Direct access to perl's text processing power.
    
    Examples:
      // Simple substitution
      perl_edit({ file: "data.txt", script: "s/foo/bar/g" })
      
      // Delete lines
      perl_edit({ file: "log.txt", script: "$_ = '' if /DEBUG/" })
      
      // Transform to uppercase
      perl_edit({ file: "names.txt", script: "$_ = uc" })
      
      // Complex multiline operations
      perl_edit({ 
        file: "code.js", 
        script: "s/function\\s+(\\w+)\\s*\\(/const $1 = (/g",
        multiline: true 
      })
    
    Tips:
    - Use $_ for the current line
    - Escape backslashes in regex
    - multiline mode slurps entire file
    `,
      quick_replace: `quick_replace - Simple find and replace
    =====================================
    Literal text replacement without regex.
    
    Examples:
      // Replace all occurrences
      quick_replace({ file: "doc.txt", find: "Version 1.0", replace: "Version 2.0" })
      
      // Replace only first occurrence  
      quick_replace({ file: "config.ini", find: "debug=true", replace: "debug=false", all: false })
      
      // Replace with special characters
      quick_replace({ file: "data.csv", find: "$price", replace: "\\$19.99" })
    
    Note: Special regex characters are automatically escaped.
    `,
      line_edit: `line_edit - Line-specific operations
    ==================================
    Edit, delete, or insert at specific line numbers.
    
    Examples:
      // Replace line 10
      line_edit({ file: "list.txt", lineNumber: 10, action: "replace", content: "New line 10" })
      
      // Delete lines 5-15
      line_edit({ file: "data.txt", lineRange: "5,15", action: "delete" })
      
      // Insert after line 1
      line_edit({ file: "imports.js", lineNumber: 1, action: "insert_after", content: "import React from 'react';" })
      
      // Insert before last line
      line_edit({ file: "footer.html", lineRange: "$", action: "insert_before", content: "<!-- Updated -->" })
    
    Ranges:
    - Single line: lineNumber: 42
    - Range: lineRange: "10,20" 
    - To end: lineRange: "5,$"
    `,
      awk_process: `awk_process - AWK script processing
    =================================
    Powerful text processing with AWK.
    
    Examples:
      // Sum second column
      awk_process({ file: "numbers.txt", script: "{sum += $2} END {print sum}" })
      
      // Process CSV (comma-separated)
      awk_process({ file: "data.csv", script: "BEGIN{FS=\",\"} {print $1, $3}" })
      
      // Filter and calculate
      awk_process({ 
        file: "sales.txt", 
        script: "$3 > 100 {count++; total += $3} END {print \"Count:\", count, \"Avg:\", total/count}"
      })
      
      // Output to file
      awk_process({ file: "input.txt", script: "{print $2, $1}", outputFile: "reversed.txt" })
    
    Tips:
    - Use FS for field separator
    - $1, $2 etc are fields
    - NR is line number
    - END block runs after processing
    `,
      sed_multifile: `sed_multifile - Multi-file operations  
    ===================================
    Apply patterns to multiple files at once.
    
    Examples:
      // Update all JS files
      sed_multifile({ filePattern: "*.js", pattern: "s/var /let /g" })
      
      // Process files in subdirectories
      sed_multifile({ 
        directory: "./src", 
        filePattern: "*.ts", 
        pattern: "s/console\\.log.*//g" 
      })
      
      // Without backups (careful!)
      sed_multifile({ filePattern: "*.tmp", pattern: "s/old/new/g", backup: false })
    
    Note: Uses perl internally. Be careful with patterns affecting many files!
    `,
      diff_preview: `diff_preview - Preview changes
    ============================
    See what changes would be made before applying.
    
    Examples:
      // Preview perl substitution
      diff_preview({ file: "config.json", command: "s/8080/3000/g" })
      
      // Preview with sed syntax
      diff_preview({ file: "data.txt", command: "10,20d", tool: "sed" })
      
      // Preview AWK processing  
      diff_preview({ file: "log.csv", command: "BEGIN{FS=\",\"} {print $2}", tool: "awk" })
    
    Output:
    - Shows unified diff format
    - No changes made to original file
    - Temp files are cleaned up
    `,
      restore_backup: `restore_backup - Restore from backup
    =================================
    Restore a file from its .bak backup file.
    
    Examples:
      // Basic restore
      restore_backup({ file: "config.json" })
      // Looks for config.json.bak and restores it
      
      // Restore and remove backup
      restore_backup({ file: "data.txt", keepBackup: false })
      
      // After a bad edit
      sed_edit({ file: "app.js", pattern: "s/function/fungtion/g" }) // Oops!
      restore_backup({ file: "app.js" }) // Fixed!
    
    Safety features:
    - Creates .before-restore backup of current file
    - Checks for alternative backup formats (.backup, .orig, ~)
    - Clear error if no backup found
    `,
      list_backups: `list_backups - Find backup files
    ==============================
    List all backup files in a directory.
    
    Examples:
      // List all .bak files in current directory
      list_backups({})
      
      // Search specific directory
      list_backups({ directory: "./src" })
      
      // Find different backup patterns
      list_backups({ pattern: "*.backup" })
      list_backups({ pattern: "*~" })  // Emacs-style
      
      // Check entire project
      list_backups({ directory: ".", pattern: "*.bak" })
    
    Output shows:
    - Backup file path
    - File size
    - Modification date
    - Original file name (inferred)
    
    Useful for cleanup or finding old versions.
    `
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool provides 'detailed help and examples,' which gives some behavioral insight (it's informational/read-only). However, it lacks details on what the help includes (e.g., syntax, parameters, examples), whether it's interactive, if there are rate limits, or how results are formatted. For a help tool with no annotation coverage, this is a moderate gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence: 'Get detailed help and examples for smalledit tools.' It is front-loaded with the core purpose, has no redundant information, and efficiently communicates the tool's function without unnecessary words. Every part of the sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is somewhat complete but could be enhanced. It covers the basic purpose but lacks details on what 'detailed help and examples' entails, such as the structure of the output or specific use cases. Without annotations or an output schema, the description should ideally provide more context about the behavioral aspects, but it's minimally adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'tool' documented as 'Tool name for help (e.g., "sed_edit", "perl_edit") or "all" for overview.' The description doesn't add any additional semantic meaning beyond this, such as explaining the format of help output or usage examples. Given the high schema coverage, a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get detailed help and examples for smalledit tools.' It specifies the verb ('Get') and resource ('detailed help and examples'), and identifies the domain ('smalledit tools'). However, it doesn't explicitly differentiate this from potential sibling tools that might also provide help or documentation, though in this context it's likely the primary help tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning 'smalledit tools,' suggesting it's for tools in that suite. However, it doesn't provide explicit guidance on when to use this tool versus alternatives (e.g., if other tools offer help or documentation), nor does it specify prerequisites or exclusions. The usage context is somewhat inferred but not clearly articulated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MikeyBeez/mcp-smalledit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server