Skip to main content
Glama

IT Tools MCP Server

index.ts•1.91 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; export function registerPrettifyHtml(server: McpServer) { server.registerTool("format_html", { description: "Format and beautify HTML code", inputSchema: { html: z.string().describe("HTML code to prettify"), indentSize: z.number().optional().default(2).describe("Number of spaces for indentation") }, // VS Code compliance annotations annotations: { title: "Format Html", description: "Format and beautify HTML code", readOnlyHint: false } }, async ({ html, indentSize }) => { try { // Simple HTML prettifier let formatted = html; let indentLevel = 0; const indent = ' '.repeat(indentSize); // Remove extra whitespace formatted = formatted.replace(/>\s*</g, '><'); // Add line breaks and indentation formatted = formatted.replace(/(<\/?[^>]+>)/g, (match) => { if (match.startsWith('</') && !match.includes('/>')) { indentLevel--; } const result = '\n' + indent.repeat(indentLevel) + match; if (!match.startsWith('</') && !match.includes('/>') && !match.includes('<input') && !match.includes('<img') && !match.includes('<br') && !match.includes('<hr')) { indentLevel++; } return result; }); // Clean up formatted = formatted.trim(); return { content: [{ type: "text", text: `Prettified HTML: \`\`\`html ${formatted} \`\`\`` }] }; } catch (error) { return { content: [{ type: "text", text: `Error formatting HTML: ${error instanceof Error ? error.message : 'Unknown error'}` }] }; } } ); }

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