Skip to main content
Glama
paulieb89

PyP6Xer MCP Server

pyp6xer_export_xer

Read-onlyIdempotent

Export the current schedule as base64-encoded XER bytes for file download without requiring a writable server path.

Instructions

Export the current (possibly modified) schedule as base64-encoded XER bytes.

Returns serialised XER content encoded as base64 so callers can offer a file download without requiring a writable local path on the server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cache_keyNoCache key identifying the loaded XER file (set when calling pyp6xer_load_file)default

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual handler function for the pyp6xer_export_xer tool. It serialises the current (possibly modified) schedule from the cache into XER format, encodes it as base64, and returns it for client download.
    @mcp.tool(annotations=ToolAnnotations(readOnlyHint=True, destructiveHint=False, idempotentHint=True, openWorldHint=False))
    def pyp6xer_export_xer(
        cache_key: Annotated[str, Field(description="Cache key identifying the loaded XER file (set when calling pyp6xer_load_file)")] = "default",
        ctx: Context = None,
    ) -> str:
        """Export the current (possibly modified) schedule as base64-encoded XER bytes.
    
        Returns serialised XER content encoded as base64 so callers can offer a file
        download without requiring a writable local path on the server.
    
        Args:
            cache_key: Cache key of the loaded file.
        """
        import base64
        entry = _get_cache(ctx, cache_key)
        content = _serialize_xer(entry["header"], entry["table_order"], entry["raw_tables"])
        xer_bytes = content.encode(Xer.CODEC)
        b64 = base64.b64encode(xer_bytes).decode("ascii")
    
        source = entry.get("source", "")
        filename = source.split("/")[-1].split("?")[0] if source else f"{cache_key}.xer"
        if not filename.endswith(".xer"):
            filename = f"{cache_key}.xer"
    
        return json.dumps({
            "status": "exported",
            "cache_key": cache_key,
            "filename": filename,
            "base64_content": b64,
            "size_bytes": len(xer_bytes),
        }, indent=2)
  • server.py:1868-1898 (registration)
    The @mcp.tool decorator on pyp6xer_export_xer registers it as an MCP tool in the FastMCP server.
    @mcp.tool(annotations=ToolAnnotations(readOnlyHint=True, destructiveHint=False, idempotentHint=True, openWorldHint=False))
    def pyp6xer_export_xer(
        cache_key: Annotated[str, Field(description="Cache key identifying the loaded XER file (set when calling pyp6xer_load_file)")] = "default",
        ctx: Context = None,
    ) -> str:
        """Export the current (possibly modified) schedule as base64-encoded XER bytes.
    
        Returns serialised XER content encoded as base64 so callers can offer a file
        download without requiring a writable local path on the server.
    
        Args:
            cache_key: Cache key of the loaded file.
        """
        import base64
        entry = _get_cache(ctx, cache_key)
        content = _serialize_xer(entry["header"], entry["table_order"], entry["raw_tables"])
        xer_bytes = content.encode(Xer.CODEC)
        b64 = base64.b64encode(xer_bytes).decode("ascii")
    
        source = entry.get("source", "")
        filename = source.split("/")[-1].split("?")[0] if source else f"{cache_key}.xer"
        if not filename.endswith(".xer"):
            filename = f"{cache_key}.xer"
    
        return json.dumps({
            "status": "exported",
            "cache_key": cache_key,
            "filename": filename,
            "base64_content": b64,
            "size_bytes": len(xer_bytes),
        }, indent=2)
Behavior4/5

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

Annotations already indicate read-only and idempotent behavior. The description adds value by explaining the output format (base64-encoded XER bytes) and the reason for this encoding (no writable path needed). This goes beyond the annotations and clarifies the tool's non-standard output.

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 consists of two concise sentences. The first sentence immediately conveys the primary function, and the second provides additional context. No redundant or extraneous information.

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?

The tool is simple with one optional parameter and an output schema. The description adequately explains the return value and its purpose. However, it could briefly mention that loading a file via pyp6xer_load_file is a prerequisite, but the parameter description already covers that.

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

Parameters3/5

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

Schema coverage is 100%, and the parameter 'cache_key' is well-documented in the schema. The description does not add or clarify parameter semantics beyond what the schema provides. Baseline of 3 is appropriate.

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 action 'Export' and the resource 'the current schedule as base64-encoded XER bytes'. It distinguishes from sibling tools like pyp6xer_export_csv by specifying the format (XER) and encoding (base64), making the purpose unmistakable.

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

Usage Guidelines3/5

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

The description implies a use case (offering file downloads without a writable local path) but does not explicitly state when to use this tool over alternatives like pyp6xer_export_csv or pyp6xer_generate_report. No exclusions or when-not guidance is provided.

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/paulieb89/pyp6xer-mcp'

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