Skip to main content
Glama
liuyazui

Base64 MCP Server

base64_decode_text

Decode Base64-encoded strings into readable text. This tool converts encoded data back to its original text format for processing or analysis.

Instructions

将Base64编码解码为文本

Args:
    encoded: Base64编码的字符串

Returns:
    解码后的文本

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encodedYes

Implementation Reference

  • The main handler function for the 'base64_decode_text' tool, decorated with @mcp.tool() for registration in the FastMCP server. It performs input cleaning, Base64 validation, decoding using base64.b64decode, and returns the result with 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)}"
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses the basic behavior (decoding Base64 to text) and mentions the return value ('解码后的文本' meaning decoded text), but lacks details on error handling, character encoding assumptions, or performance traits. It adds some context but is not comprehensive for behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with a clear purpose statement followed by structured sections for Args and Returns. Every sentence earns its place without redundancy, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is mostly complete, covering purpose, input, and output. However, it lacks details on error cases or encoding specifics, which could be useful for full contextual understanding in a decoding operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 1 parameter, the description compensates by explaining the parameter 'encoded' as 'Base64编码的字符串' (Base64-encoded string), adding semantic meaning beyond the schema's basic type. It clarifies the expected input format, though it could provide more detail on constraints or examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('解码' meaning decode) and resource ('Base64编码' meaning Base64 encoding), distinguishing it from sibling tools like base64_encode_text and base64_decode_image. It explicitly indicates the transformation from Base64 to text, making the function unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying 'Base64编码的字符串' (Base64-encoded string) as input, which helps differentiate it from image-decoding siblings. However, it does not explicitly state when to use this tool versus alternatives like base64_decode_image or base64_encode_text, missing explicit exclusions or comparative guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/liuyazui/base64_server'

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