Skip to main content
Glama
pdfdotco

PDF.co MCP Server

Official
by pdfdotco

excel_to_txt

Convert Excel files (XLS, XLSX) to plain text format for data extraction and processing. Use this tool to transform spreadsheet data into readable text documents.

Instructions

Convert Excel(XLS, XLSX) to TXT.
Ref: https://developer.pdf.co/api-reference/convert-from-excel/text.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to the source file (XLS, XLSX). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files.
httpusernameNoHTTP auth user name if required to access source url. (Optional)
httppasswordNoHTTP auth password if required to access source url. (Optional)
nameNoFile name for the generated output. (Optional)
worksheetIndexNoIndex of the worksheet to convert. (Optional)
api_keyNoPDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)

Implementation Reference

  • The handler function for the excel_to_txt tool. Decorated with @mcp.tool() for registration and schema definition via Pydantic Fields. Implements the tool by calling the convert_to helper with 'xls' to 'txt' parameters.
    @mcp.tool()
    async def excel_to_txt(
        url: str = Field(
            description="URL to the source file (XLS, XLSX). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
        ),
        httpusername: str = Field(
            description="HTTP auth user name if required to access source url. (Optional)",
            default="",
        ),
        httppassword: str = Field(
            description="HTTP auth password if required to access source url. (Optional)",
            default="",
        ),
        name: str = Field(
            description="File name for the generated output. (Optional)", default=""
        ),
        worksheetIndex: str = Field(
            description="Index of the worksheet to convert. (Optional)", default=""
        ),
        api_key: str = Field(
            description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
            default="",
        ),
    ) -> BaseResponse:
        """
        Convert Excel(XLS, XLSX) to TXT.
        Ref: https://developer.pdf.co/api-reference/convert-from-excel/text.md
        """
        return await convert_to(
            "xls",
            "txt",
            ConversionParams(
                url=url,
                httpusername=httpusername,
                httppassword=httppassword,
                name=name,
                worksheetIndex=worksheetIndex,
                api_key=api_key,
            ),
        )
  • Supporting helper function that constructs the PDF.co API endpoint for generic format conversion and calls the request function to execute the HTTP POST request.
    async def convert_to(
        _from: str, _to: str, params: ConversionParams, api_key: str | None = None
    ) -> BaseResponse:
        return await request(f"{_from}/convert/to/{_to}", params, api_key=api_key)
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions conversion but doesn't disclose behavioral traits like whether this is a read-only operation, if it modifies source files, authentication needs beyond the optional HTTP auth parameters, rate limits, or output specifics. The reference link might contain details, but the description itself lacks this critical information for a tool with potential file manipulation.

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

Conciseness4/5

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

The description is very concise with two sentences: one stating the purpose and one providing a reference link. It's front-loaded with the core function. However, the reference link might be considered extraneous if the tool should be self-contained, slightly reducing efficiency.

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

Completeness2/5

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

Given the complexity (file conversion with 6 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the TXT output looks like (e.g., formatting, structure), error conditions, or behavioral constraints. The reference link partially compensates but isn't integrated into the description itself, leaving gaps for agent understanding.

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 description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description adds no parameter-specific information beyond the general conversion purpose. This meets the baseline of 3, as the schema does the heavy lifting, but the description doesn't enhance understanding of parameter interactions or usage.

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

Purpose4/5

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

The description clearly states the tool's function: 'Convert Excel(XLS, XLSX) to TXT.' This specifies both the verb (convert) and resources (Excel files to TXT). However, it doesn't distinguish this tool from its many sibling conversion tools (like excel_to_csv, excel_to_pdf, etc.) beyond the output format, which is a minor gap.

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 usage context through the reference link, but doesn't explicitly state when to use this tool versus alternatives. Given the many sibling tools (e.g., excel_to_csv, excel_to_json), there's no guidance on choosing TXT output over other formats. The input schema hints at usage via the 'url' parameter description mentioning the 'upload_file' tool, but this isn't in the main description.

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/pdfdotco/pdfco-mcp'

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