base64_decode_text
Decode Base64 encoded strings into readable text instantly. Use this tool to convert encoded data back to its original text format on the Base64 MCP Server.
Instructions
将Base64编码解码为文本
Args:
encoded: Base64编码的字符串
Returns:
解码后的文本
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| encoded | Yes |
Implementation Reference
- base64_server.py:39-67 (handler)The handler function for the 'base64_decode_text' tool. It is decorated with @mcp.tool() for registration and implements Base64 text decoding with input validation and error handling.@mcp.tool() def base64_decode_text(encoded: str) -> str: """将Base64编码解码为文本 Args: encoded: Base64编码的字符串 Returns: 解码后的文本 """ try: # 清理输入,移除可能的前缀和空白 encoded = encoded.strip() if "Base64编码结果:" in encoded: encoded = encoded.split("Base64编码结果:")[1].strip() # 验证是否为有效的Base64字符串 if not all( c in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" for c in encoded ): return "错误: 输入包含非Base64字符" # 尝试解码 decoded = base64.b64decode(encoded).decode("utf-8") return f"Base64解码结果: {decoded}" except Exception as e: return f"解码失败: {str(e)}"