Skip to main content
Glama

base64_encode

Convert text to Base64 encoding for secure data transmission and storage. This tool transforms plain text into encoded format compatible with various systems.

Instructions

encode text to base64

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYestext to encode

Implementation Reference

  • The handler function that executes the base64_encode tool: takes input content, encodes it using Base64Util.encode, and returns the result as text content.
    async ({ content }) => { const result = Base64Util.encode(content); return { content: [ { type: "text", text: result, }, ], }; }
  • Input schema for the base64_encode tool: defines 'content' as a required string parameter.
    { content: z.string().describe("text to encode"), },
  • Registration of the base64_encode tool using server.tool, including name, description, schema, and handler.
    server.tool( "base64_encode", "encode text to base64", { content: z.string().describe("text to encode"), }, async ({ content }) => { const result = Base64Util.encode(content); return { content: [ { type: "text", text: result, }, ], }; } );
  • Helper utility function Base64Util.encode that performs the actual base64 encoding using Node.js Buffer.
    static encode(input: string): string { return Buffer.from(input).toString('base64'); }
  • src/index.ts:18-18 (registration)
    Invocation of registerBase64Tool in the main server setup, which registers the base64_encode tool.
    registerBase64Tool(server);

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/1595901624/crypto-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server