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.24 kB
import { z } from "zod"; export function registerEncodeBase64(server) { server.registerTool("encode_base64", { description: 'Encode text to Base64 format. Example: "Hello World" → "SGVsbG8gV29ybGQ="', inputSchema: { text: z.string().min(1).describe("Text to encode to Base64"), }, // VS Code compliance annotations annotations: { title: "Encode Base64", description: "Encode text to Base64 format", readOnlyHint: false } }, async ({ text }) => { try { const encoded = Buffer.from(text, 'utf-8').toString('base64'); return { content: [ { type: "text", text: `Base64 encoded: ${encoded}`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text", text: `Error encoding to Base64: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } }); }