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
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | text to encode |
Implementation Reference
- src/service/base64.ts:36-46 (handler)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, }, ], }; }
- src/service/base64.ts:33-35 (schema)Input schema for the base64_encode tool: defines 'content' as a required string parameter.{ content: z.string().describe("text to encode"), },
- src/service/base64.ts:30-47 (registration)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, }, ], }; } );
- src/service/base64.ts:10-12 (helper)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);