# File Utilities and Editing

## Links

- Product page URL: https://www.agentpmt.com/marketplace/file-utilities-and-editing
- Product markdown URL: https://www.agentpmt.com/marketplace/file-utilities-and-editing?format=agent-md
- Product JSON URL: https://www.agentpmt.com/marketplace/file-utilities-and-editing?format=agent-json

## Overview

- Product ID: 694ed536cca5b5123ad00c33
- Vendor: Apoth3osis
- Type: core utility
- Unit type: request
- Price: 500 credits
- Categories: Security & Cryptography, Developer Tools, System Administration, Data Processing, Encoding & Decoding, Data Formatting & Conversion, File & Binary Operations
- Generated at: 2026-05-30T20:29:05.576Z

### Page Description

A utility for file metadata operations, path manipulation, and content formatting commonly needed when working with files in automation workflows and application development. MIME type detection identifies the content type of files based on filename extensions, covering documents, images, audio, video, archives, and programming languages, while reverse lookup finds appropriate file extensions for a given MIME type. File size formatting converts byte counts into human-readable strings with automatic unit scaling from bytes through petabytes. Path manipulation functions parse file paths into components including directory, filename, name, and extension, join multiple path segments with proper separators, and normalize paths by resolving relative references and redundant separators. CSV to table conversion parses comma-separated data and formats it as an ASCII table with aligned columns for display purposes, also returning structured header and row data. JSON formatting includes pretty printing with configurable indentation for readability and minification that removes all unnecessary whitespace with size reduction statistics. Base64 encoding and decoding handles text-to-base64 conversion for data embedding and transmission. Cryptographic hash generation supports MD5, SHA-1, SHA-256, and SHA-512 algorithms for content integrity verification and fingerprinting.

### Agent Description

File utilities: MIME type detection, path parsing/joining, CSV to ASCII table, JSON formatting, Base64 encoding, hash generation (MD5, SHA).

## Details

### Details

A utility for file metadata operations, path manipulation, and content formatting commonly needed when working with files in automation workflows and application development. MIME type detection identifies the content type of files based on filename extensions, covering documents, images, audio, video, archives, and programming languages, while reverse lookup finds appropriate file extensions for a given MIME type. File size formatting converts byte counts into human-readable strings with automatic unit scaling from bytes through petabytes. Path manipulation functions parse file paths into components including directory, filename, name, and extension, join multiple path segments with proper separators, and normalize paths by resolving relative references and redundant separators. CSV to table conversion parses comma-separated data and formats it as an ASCII table with aligned columns for display purposes, also returning structured header and row data. JSON formatting includes pretty printing with configurable indentation for readability and minification that removes all unnecessary whitespace with size reduction statistics. Base64 encoding and decoding handles text-to-base64 conversion for data embedding and transmission. Cryptographic hash generation supports MD5, SHA-1, SHA-256, and SHA-512 algorithms for content integrity verification and fingerprinting.

### Actions

- `file-mime-type-detect` (5 credits): Detect the MIME type of a file based on its filename/extension. Supports documents, images, audio, video, archives, and programming languages.
- `file-extension-from-mime` (5 credits): Look up the standard file extension for a given MIME type.
- `file-size-format` (5 credits): Convert a raw byte count into a human-readable size string (KB, MB, GB, etc.).
- `file-path-parse` (5 credits): Break a file path into its component parts: directory, filename, name, and extension.
- `file-path-join` (5 credits): Join multiple path components into a single path. Provide components as a comma-separated string in input, or use input, input2, and input3 fields for up to three components. At least 2 components required.
- `file-path-normalize` (5 credits): Clean up a file path by resolving '..', '.', and redundant separators.
- `file-csv-to-table` (5 credits): Parse CSV content and render it as a formatted ASCII table. The first row is treated as headers.
- `file-json-pretty-print` (5 credits): Format a compact JSON string with indentation for readability.
- `file-json-minify` (5 credits): Remove all unnecessary whitespace from a JSON string to produce the most compact representation.
- `file-base64-encode` (5 credits): Encode a text string to base64 using UTF-8 encoding.
- `file-base64-decode` (5 credits): Decode a base64 string back to UTF-8 text.
- `file-hash-generate` (5 credits): Generate a cryptographic hash of the provided text content.

### Use Cases

MIME type detection, file type identification, content type lookup, extension to MIME, MIME to extension, file extension lookup, file size formatting, byte size conversion, human readable file size, KB MB GB formatting, storage size display, file path parsing, path component extraction, directory extraction, filename extraction, extension extraction, path joining, path concatenation, cross-platform path, path normalization, relative path resolution, absolute path conversion, path cleanup, CSV formatting, CSV to table, tabular data display, ASCII table generation, CSV visualization, JSON pretty print, JSON formatting, JSON indentation, readable JSON, JSON beautify, JSON minify, JSON compression, JSON whitespace removal, minified JSON, JSON size reduction, base64 encode, text to base64, base64 encoding, base64 decode, base64 to text, base64 decoding, MD5 hash, SHA1 hash, SHA256 hash, SHA512 hash, content hash, file fingerprint, integrity check, checksum generation, hash generation, file metadata, file utilities, automation file operations, AI agent file handling, LLM file processing, workflow file tools

### Workflows Using This Tool

No public workflows currently reference this product.

### Related Content

No related content is currently linked to this product.

## Integration Details

### DynamicMCP

- Setup page URL: https://www.agentpmt.com/dynamic-mcp
- Claude setup guide: https://www.agentpmt.com/dynamic-mcp?platform=claude#videos
- ChatGPT setup guide: https://www.agentpmt.com/dynamic-mcp?platform=chatgpt#videos
- Cursor setup guide: https://www.agentpmt.com/dynamic-mcp?platform=cursor#videos
- Windsurf setup guide: https://www.agentpmt.com/dynamic-mcp?platform=windsurf#videos

Use the local router for command-based MCP clients. It forwards requests to `https://api.agentpmt.com/mcp` and does not execute tools locally.

```bash
npm install -g @agentpmt/mcp-router
agentpmt-setup
```

### REST API

The live page renders cURL, Python, JavaScript, and Node.js examples. Logged-in users see those examples prefilled with their own API and budget credentials.

- Purchase endpoint: https://api.agentpmt.com/products/purchase
- Authorization format: `Bearer <base64(apiKey:budgetKey)>`

```bash
curl -X POST "https://api.agentpmt.com/products/purchase" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eW91ci1hcGkta2V5LWhlcmU6eW91ci1idWRnZXQta2V5LWhlcmU=" \
  -d '{
    "product_id": "694ed536cca5b5123ad00c33",
    "parameters": {
      "action": "file-mime-type-detect",
      "input": "example_input"
    }
  }'
```

### Autonomous Agents

Autonomous agents can access this tool through AgentAddress credit balances or direct x402 payments. Use the Autonomous Agent API reference for endpoint shapes after choosing the access pattern below.

- Autonomous Agent API reference URL: https://www.agentpmt.com/docs/api-reference/autonomous-agents
- Autonomous Agent API reference markdown URL: https://www.agentpmt.com/docs/api-reference/autonomous-agents?format=agent-md
- Credit-Based Access Using AgentAddress: https://www.agentpmt.com/docs/autonomous-agents/credit-based-tool-usage-with-agentaddress
- AgentAddress is preferred for persistent file access, stored platform state, and maximum tool use ability across repeated calls.
- Direct x402 is for independent one-off tool calls that do not require shared files or stored platform state.
- Direct x402 public payments: USDC on Base, Arbitrum, Optimism, Polygon, and Avalanche.

### Schema

#### Parameters

- Schema type: actions

```json
{
  "actions": {
    "file-mime-type-detect": {
      "description": "Detect the MIME type of a file based on its filename/extension. Supports documents, images, audio, video, archives, and programming languages.",
      "properties": {
        "input": {
          "type": "string",
          "description": "The filename to analyze (e.g., 'report.pdf', 'photo.jpg')",
          "required": true
        }
      }
    },
    "file-extension-from-mime": {
      "description": "Look up the standard file extension for a given MIME type.",
      "properties": {
        "input": {
          "type": "string",
          "description": "A MIME type string (e.g., 'image/png', 'application/pdf')",
          "required": true
        }
      }
    },
    "file-size-format": {
      "description": "Convert a raw byte count into a human-readable size string (KB, MB, GB, etc.).",
      "properties": {
        "input": {
          "type": "string",
          "description": "File size in bytes as a string (e.g., '5242880')",
          "required": true
        }
      }
    },
    "file-path-parse": {
      "description": "Break a file path into its component parts: directory, filename, name, and extension.",
      "properties": {
        "input": {
          "type": "string",
          "description": "A file path to parse (e.g., '/home/user/documents/report.pdf')",
          "required": true
        }
      }
    },
    "file-path-join": {
      "description": "Join multiple path components into a single path. Provide components as a comma-separated string in input, or use input, input2, and input3 fields for up to three components. At least 2 components required.",
      "properties": {
        "input": {
          "type": "string",
          "description": "First path component, or a comma-separated list of all components",
          "required": true
        },
        "input2": {
          "type": "string",
          "description": "Second path component (when not using comma separation)",
          "required": false
        },
        "input3": {
          "type": "string",
          "description": "Third path component (when not using comma separation)",
          "required": false
        }
      }
    },
    "file-path-normalize": {
      "description": "Clean up a file path by resolving '..', '.', and redundant separators.",
      "properties": {
        "input": {
          "type": "string",
          "description": "A file path to normalize (e.g., '/home/user/../user/./documents//file.txt')",
          "required": true
        }
      }
    },
    "file-csv-to-table": {
      "description": "Parse CSV content and render it as a formatted ASCII table. The first row is treated as headers.",
      "properties": {
        "input": {
          "type": "string",
          "description": "CSV content as a string (e.g., 'Name,Age,City\\nAlice,30,New York')",
          "required": true
        }
      }
    },
    "file-json-pretty-print": {
      "description": "Format a compact JSON string with indentation for readability.",
      "properties": {
        "input": {
          "type": "string",
          "description": "A valid JSON string to format",
          "required": true
        },
        "indent": {
          "type": "integer",
          "description": "Number of spaces per indentation level (0-8)",
          "required": false,
          "default": 2,
          "minimum": 0,
          "maximum": 8
        }
      }
    },
    "file-json-minify": {
      "description": "Remove all unnecessary whitespace from a JSON string to produce the most compact representation.",
      "properties": {
        "input": {
          "type": "string",
          "description": "A valid JSON string to minify",
          "required": true
        }
      }
    },
    "file-base64-encode": {
      "description": "Encode a text string to base64 using UTF-8 encoding.",
      "properties": {
        "input": {
          "type": "string",
          "description": "The text to encode to base64",
          "required": true
        }
      }
    },
    "file-base64-decode": {
      "description": "Decode a base64 string back to UTF-8 text.",
      "properties": {
        "input": {
          "type": "string",
          "description": "A valid base64-encoded string to decode",
          "required": true
        }
      }
    },
    "file-hash-generate": {
      "description": "Generate a cryptographic hash of the provided text content.",
      "properties": {
        "input": {
          "type": "string",
          "description": "The content to hash",
          "required": true
        },
        "hash_algorithm": {
          "type": "string",
          "description": "Hash algorithm to use: md5, sha1, sha256, or sha512",
          "required": false,
          "default": "sha256",
          "enum": [
            "md5",
            "sha1",
            "sha256",
            "sha512"
          ]
        }
      }
    }
  },
  "properties": {
    "action": {
      "type": "string",
      "description": "The file operation to perform. Available actions: get_instructions (returns tool documentation), File info (file-mime-type-detect, file-extension-from-mime, file-size-format), Path operations (file-path-parse, file-path-join, file-path-normalize), Content formatting (file-csv-to-table, file-json-pretty-print, file-json-minify), Encoding (file-base64-encode, file-base64-decode), Hashing (file-hash-generate)",
      "required": true,
      "enum": [
        "get_instructions",
        "file-mime-type-detect",
        "file-extension-from-mime",
        "file-size-format",
        "file-path-parse",
        "file-path-join",
        "file-path-normalize",
        "file-csv-to-table",
        "file-json-pretty-print",
        "file-json-minify",
        "file-base64-encode",
        "file-base64-decode",
        "file-hash-generate"
      ]
    },
    "input": {
      "type": "string",
      "description": "Universal input parameter that accepts multiple formats depending on action: filename (e.g., 'photo.jpg'), MIME type (e.g., 'image/jpeg'), file size in bytes (e.g., '5242880'), file path (e.g., '/home/user/file.txt'), content/text (e.g., CSV, JSON, or text to encode), or comma-separated path components (e.g., 'home,user,documents'). The action determines how the input is interpreted.",
      "required": false
    },
    "input2": {
      "type": "string",
      "description": "Secondary input parameter for actions requiring multiple path components. Used by: file-path-join (second path component)",
      "required": false
    },
    "input3": {
      "type": "string",
      "description": "Tertiary input parameter for actions requiring three or more path components. Used by: file-path-join (third path component)",
      "required": false
    },
    "hash_algorithm": {
      "type": "string",
      "description": "Hash algorithm to use. Used for: file-hash-generate. Options: md5, sha1, sha256 (default), sha512",
      "required": false,
      "default": "sha256",
      "enum": [
        "md5",
        "sha1",
        "sha256",
        "sha512"
      ]
    },
    "indent": {
      "type": "integer",
      "description": "Number of spaces for JSON indentation (0-8). Used for: file-json-pretty-print. Default: 2",
      "required": false,
      "default": 2,
      "minimum": 0,
      "maximum": 8
    }
  }
}
```

### Usage Instructions

# File Utilities and Editing

## Overview
A collection of file utility operations for working with MIME types, file paths, content formatting (CSV/JSON), base64 encoding/decoding, and cryptographic hashing. Use this tool when you need to manipulate file metadata, transform data formats, or generate hashes without touching the filesystem.

## Actions

### `file-mime-type-detect`
Detects the MIME type of a file based on its filename/extension. Supports documents, images, audio, video, archives, and programming languages.

**Required fields:**
- `input` (string) — The filename to analyze (e.g., `report.pdf`, `photo.jpg`)

**Example:**
```json
{
  "action": "file-mime-type-detect",
  "input": "quarterly-report.xlsx"
}
```
Returns the MIME type (`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`), file extension, and category (`application`).

---

### `file-extension-from-mime`
Looks up the standard file extension for a given MIME type.

**Required fields:**
- `input` (string) — A MIME type string (e.g., `image/png`, `application/pdf`)

**Example:**
```json
{
  "action": "file-extension-from-mime",
  "input": "audio/mpeg"
}
```
Returns the matching extension (`.mp3`) and whether a match was found.

---

### `file-size-format`
Converts a raw byte count into a human-readable size string (KB, MB, GB, etc.).

**Required fields:**
- `input` (string) — File size in bytes as a string (e.g., `"5242880"`)

**Example:**
```json
{
  "action": "file-size-format",
  "input": "5242880"
}
```
Returns `"5.00 MB"` along with the numeric value and unit.

---

### `file-path-parse`
Breaks a file path into its component parts: directory, filename, name, and extension.

**Required fields:**
- `input` (string) — A file path to parse (e.g., `/home/user/documents/report.pdf`)

**Example:**
```json
{
  "action": "file-path-parse",
  "input": "/home/user/documents/report.pdf"
}
```
Returns the directory (`/home/user/documents`), filename (`report.pdf`), name (`report`), extension (`.pdf`), and whether the path is absolute.

---

### `file-path-join`
Joins multiple path components into a single path. You can provide components as a comma-separated string in `input`, or use the `input`, `input2`, and `input3` fields for up to three components.

**Required fields:**
- `input` (string) — First path component, or a comma-separated list of all components

**Optional fields:**
- `input2` (string) — Second path component (when not using comma separation)
- `input3` (string) — Third path component (when not using comma separation)

At least 2 path components are required.

**Example (comma-separated):**
```json
{
  "action": "file-path-join",
  "input": "/home/user, documents, report.pdf"
}
```

**Example (separate fields):**
```json
{
  "action": "file-path-join",
  "input": "/home/user",
  "input2": "documents",
  "input3": "report.pdf"
}
```
Returns the joined and normalized path (`/home/user/documents/report.pdf`).

---

### `file-path-normalize`
Cleans up a messy file path by resolving `..`, `.`, and redundant separators.

**Required fields:**
- `input` (string) — A file path to normalize (e.g., `/home/user/../user/./documents//file.txt`)

**Example:**
```json
{
  "action": "file-path-normalize",
  "input": "/home/user/../user/./documents//file.txt"
}
```
Returns the cleaned path (`/home/user/documents/file.txt`).

---

### `file-csv-to-table`
Parses CSV content and renders it as a formatted ASCII table. The first row is treated as headers.

**Required fields:**
- `input` (string) — CSV content as a string

**Example:**
```json
{
  "action": "file-csv-to-table",
  "input": "Name,Age,City\nAlice,30,New York\nBob,25,London\nCarol,35,Tokyo"
}
```
Returns the row count, column count, headers list, a formatted ASCII table, and the parsed data as structured arrays.

---

### `file-json-pretty-print`
Formats a compact JSON string with indentation for readability.

**Required fields:**
- `input` (string) — A valid JSON string

**Optional fields:**
- `indent` (integer, default: 2) — Number of spaces per indentation level (0-8)

**Example:**
```json
{
  "action": "file-json-pretty-print",
  "input": "{\"name\":\"Alice\",\"age\":30,\"address\":{\"city\":\"New York\",\"zip\":\"10001\"}}",
  "indent": 4
}
```
Returns the formatted JSON string along with original and formatted lengths.

---

### `file-json-minify`
Removes all unnecessary whitespace from a JSON string to produce the most compact representation.

**Required fields:**
- `input` (string) — A valid JSON string (can include whitespace/indentation)

**Example:**
```json
{
  "action": "file-json-minify",
  "input": "{\n  \"name\": \"Alice\",\n  \"age\": 30\n}"
}
```
Returns the minified JSON, original and minified lengths, and the percentage reduction in size.

---

### `file-base64-encode`
Encodes a text string to base64 using UTF-8 encoding.

**Required fields:**
- `input` (string) — The text to encode

**Example:**
```json
{
  "action": "file-base64-encode",
  "input": "Hello, World! This is a secret message."
}
```
Returns the base64-encoded string along with original and encoded lengths.

---

### `file-base64-decode`
Decodes a base64 string back to UTF-8 text.

**Required fields:**
- `input` (string) — A valid base64-encoded string

**Example:**
```json
{
  "action": "file-base64-decode",
  "input": "SGVsbG8sIFdvcmxkISBUaGlzIGlzIGEgc2VjcmV0IG1lc3NhZ2Uu"
}
```
Returns the decoded text along with encoded and decoded lengths.

---

### `file-hash-generate`
Generates a cryptographic hash of the provided text content.

**Required fields:**
- `input` (string) — The content to hash

**Optional fields:**
- `hash_algorithm` (string, default: `"sha256"`) — Algorithm to use: `md5`, `sha1`, `sha256`, or `sha512`

**Example:**
```json
{
  "action": "file-hash-generate",
  "input": "This is the content of my document that I want to verify.",
  "hash_algorithm": "sha256"
}
```
Returns the hex-encoded hash digest, the algorithm used, content length, and hash length.

## Common Workflows

### Workflow 1: Validate and format incoming data
1. Use `file-mime-type-detect` with a received filename to confirm the file type
2. Use `file-size-format` to display the file size in a readable format
3. If the content is JSON, use `file-json-pretty-print` to format it for review

### Workflow 2: Content integrity verification
1. Use `file-base64-decode` to decode a received base64 payload
2. Use `file-hash-generate` to compute a SHA-256 hash of the decoded content
3. Compare the hash against an expected value to verify integrity

### Workflow 3: Build and normalize file paths
1. Use `file-path-join` to combine directory and filename components
2. Use `file-path-normalize` to clean up the resulting path
3. Use `file-path-parse` to extract individual components for further processing

## Important Notes
- All operations are stateless text transformations. This tool does not read from or write to the filesystem.
- The `input` field must always be provided as a string, even for numeric values like file sizes.
- CSV parsing treats the first row as column headers.
- JSON operations (`pretty-print` and `minify`) will return an error if the input is not valid JSON.
- Base64 encoding/decoding uses UTF-8. Binary data that is not valid UTF-8 cannot be decoded with `file-base64-decode`.
- Unknown file extensions default to the MIME type `application/octet-stream`.
- The `indent` parameter only applies to `file-json-pretty-print` and must be between 0 and 8.

### Frequently Asked Questions

#### How do I connect this tool to an external agent?

- Page URL: https://www.agentpmt.com/faq
- Markdown URL: https://www.agentpmt.com/faq?format=agent-md

You can install the local MCP server by opening a terminal and running:

```
npm install -g @agentpmt/mcp-router
agentpmt-setup
```

This will connect you to local agents like Claude Code, Windsurf, Grok Build, Cursor, etc.

Alternatively you can connect to the hosted version with this config block, no installation required:

```
{
  "mcpServers": {
    "agentpmt": {
      "type": "streamable-http",
      "url": "https://api.agentpmt.com/mcp",
      "headers": {
        "Authorization": "Bearer <AGENTPMT_BEARER_TOKEN>",
        "x-instance-metadata": "{\"client\":\"generic-mcp\",\"platform\":\"remote\"}"
      }
    }
  }
}
```

[View MCP Connection Instructions](/docs/mcp-reference/connection) for more details.

#### How does an external agent use this tool?

- Page URL: https://www.agentpmt.com/faq
- Markdown URL: https://www.agentpmt.com/faq?format=agent-md

After the external agent is connected to an Agent Group that can use this tool, paste this prompt into the agent:

> Call the AgentPMT-Tool-Search-and-Execution tool with action 'get\_schema' and tool\_id 694ed536cca5b5123ad00c33 ("File Utilities and Editing"). Then call the same tool with action 'call\_tool', tool\_id 694ed536cca5b5123ad00c33, and the parameters needed for my request.

The agent should fetch the tool schema first, collect the required parameters for your request, and then call the tool through AgentPMT.

### Dependencies

This product has no public dependency products.