UNPKG

it-tools-mcp

Version:

MCP-compliant server access to over 100 IT tools and utilities commonly used by developers, system administrators, and IT professionals.

28 lines (27 loc) 798 B
import { z } from "zod"; export function registerTextSnakecase(server) { server.registerTool("text_snakecase", { inputSchema: { text: z.string().describe("Text to convert to snake_case"), }, // VS Code compliance annotations annotations: { title: "Convert Text To Snake Case", readOnlyHint: false } }, async ({ text }) => { const snakeCase = text .replace(/([a-z])([A-Z])/g, '$1_$2') .replace(/[^a-zA-Z0-9]+/g, '_') .toLowerCase() .replace(/^_+|_+$/g, ''); return { content: [ { type: "text", text: `snake_case: ${snakeCase}`, }, ], }; }); }