base64_encode
Encode text into base64 format securely and efficiently using Crypto_MCP. Ideal for data handling and secure transmission in encryption workflows.
Instructions
encode text to base64
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | text to encode |
Implementation Reference
- src/service/base64.ts:36-46 (handler)Handler function for the base64_encode tool. It takes the 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, }, ], }; }
- src/service/base64.ts:33-35 (schema)Input schema for the base64_encode tool, specifying 'content' as a string to encode.{ content: z.string().describe("text to encode"), },
- src/service/base64.ts:30-47 (registration)Registration of the base64_encode tool on the MCP server, including name, description, input schema, and handler function.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, }, ], }; } );
- src/service/base64.ts:10-12 (helper)Helper method Base64Util.encode that implements the core base64 encoding logic using Node.js Buffer.static encode(input: string): string { return Buffer.from(input).toString('base64'); }
- src/index.ts:18-18 (registration)Call to registerBase64Tool in the main server initialization, which registers the base64_encode tool among others.registerBase64Tool(server);