base64_encode_text
Converts any text input into Base64 encoding. Ideal for encoding text for secure transmission or data storage. Simple and efficient tool for developers and users.
Instructions
将文本转换为Base64编码
Args:
text: 要编码的文本
Returns:
Base64编码结果
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes |
Implementation Reference
- base64_server.py:22-37 (handler)The handler function for the 'base64_encode_text' tool, decorated with @mcp.tool() for registration in FastMCP. It takes a text string, encodes it to base64 using utf-8, and returns the result prefixed with 'Base64编码结果: '. Includes error handling.@mcp.tool() def base64_encode_text(text: str) -> str: """将文本转换为Base64编码 Args: text: 要编码的文本 Returns: Base64编码结果 """ try: encoded = base64.b64encode(text.encode("utf-8")).decode("utf-8") return f"Base64编码结果: {encoded}" except Exception as e: return f"编码失败: {str(e)}"