Skip to main content
Glama
index.ts1.08 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; export function registerEncodeBase64(server: McpServer) { 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'}`, }, ], }; } }); }

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