Skip to main content
Glama

json-minify

Remove unnecessary whitespace from JSON strings to optimize data size and improve efficiency, ideal for developers and system administrators using IT Tools MCP Server.

Instructions

Minify JSON by removing whitespace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jsonYesJSON string to minify

Implementation Reference

  • Executes the minify_json tool: parses input JSON string, stringifies it without whitespace to minify, returns formatted text response or parses error.
    }, async ({ json }) => { try { const parsed = JSON.parse(json); const minified = JSON.stringify(parsed); return { content: [ { type: "text", text: `Minified JSON: ${minified}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error parsing JSON: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; }
  • Tool schema definition including input (json: string) and annotations for 'minify_json' tool.
    server.registerTool("minify_json", { description: "Minify JSON by removing whitespace and unnecessary characters. Example: formatted JSON → compact single-line JSON", inputSchema: { json: z.string().describe("JSON string to minify"), }, // VS Code compliance annotations annotations: { title: "Minify JSON", description: "Remove whitespace and minify JSON to compact format", readOnlyHint: false }
  • Registers the 'minify_json' tool (JSON minifier) with the MCP server using the defined schema and handler.
    export function registerMinifyJson(server: McpServer) { server.registerTool("minify_json", { description: "Minify JSON by removing whitespace and unnecessary characters. Example: formatted JSON → compact single-line JSON", inputSchema: { json: z.string().describe("JSON string to minify"), }, // VS Code compliance annotations annotations: { title: "Minify JSON", description: "Remove whitespace and minify JSON to compact format", readOnlyHint: false } }, async ({ json }) => { try { const parsed = JSON.parse(json); const minified = JSON.stringify(parsed); return { content: [ { type: "text", text: `Minified JSON: ${minified}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error parsing JSON: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } } ); }

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/wrenchpilot/it-tools-mcp'

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