UNPKG

it-tools-mcp

Version:

Full MCP 2025-06-18 compliant server with 121+ IT tools, logging, ping, progress tracking, cancellation, and sampling utilities

39 lines (38 loc) 1.31 kB
import { z } from "zod"; export function registerDecodeBase64(server) { server.registerTool("decode_base64", { description: 'Decode Base64 text back to original text. Example: "SGVsbG8gV29ybGQ=" → "Hello World"', inputSchema: { text: z.string().min(1).regex(/^[A-Za-z0-9+/]*={0,2}$/, "Invalid Base64 format").describe("Base64 text to decode"), }, // VS Code compliance annotations annotations: { title: "Decode Base64", description: "Decode Base64 text back to original text", readOnlyHint: false } }, async ({ text }) => { try { const decoded = Buffer.from(text, 'base64').toString('utf-8'); return { content: [ { type: "text", text: `Base64 decoded: ${decoded}`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text", text: `Error decoding Base64: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } }); }