Skip to main content
Glama
pdfdotco

PDF.co MCP Server

Official
by pdfdotco

find_text

Locate specific text within PDF documents and retrieve its coordinates, supporting regular expressions for advanced searches.

Instructions

Find text in PDF and get coordinates. Supports regular expressions.
Ref: https://developer.pdf.co/api-reference/pdf-find/basic.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to the source PDF file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files.
searchStringYesText to search. Can support regular expressions if regexSearch is set to True.
httpusernameNoHTTP auth user name if required to access source url. (Optional)
httppasswordNoHTTP auth password if required to access source url. (Optional)
pagesNoComma-separated list of page indices (or ranges) to process. Leave empty for all pages. Example: '0,2-5,7-'. The first-page index is 0. (Optional)
wordMatchingModeNoValues can be either SmartMatch, ExactMatch, or None. (Optional)
passwordNoPassword of the PDF file. (Optional)
regexSearchNoSet to True to enable regular expressions in the search string. (Optional)
api_keyNoPDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)

Implementation Reference

  • The main MCP tool handler for 'find_text', registered with @mcp.tool(). Defines input schema using Pydantic Field descriptions. Prepares params and delegates to the find_text_in_pdf helper function.
    @mcp.tool(name="find_text")
    async def find_text(
        url: str = Field(
            description="URL to the source PDF file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
        ),
        searchString: str = Field(
            description="Text to search. Can support regular expressions if regexSearch is set to True."
        ),
        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="",
        ),
        pages: str = Field(
            description="Comma-separated list of page indices (or ranges) to process. Leave empty for all pages. Example: '0,2-5,7-'. The first-page index is 0. (Optional)",
            default="",
        ),
        wordMatchingMode: str = Field(
            description="Values can be either SmartMatch, ExactMatch, or None. (Optional)",
            default=None,
        ),
        password: str = Field(
            description="Password of the PDF file. (Optional)", default=""
        ),
        regexSearch: bool = Field(
            description="Set to True to enable regular expressions in the search string. (Optional)",
            default=False,
        ),
        api_key: str = Field(
            description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
            default="",
        ),
    ) -> BaseResponse:
        """
        Find text in PDF and get coordinates. Supports regular expressions.
        Ref: https://developer.pdf.co/api-reference/pdf-find/basic.md
        """
        params = ConversionParams(
            url=url,
            httpusername=httpusername,
            httppassword=httppassword,
            pages=pages,
            password=password,
        )
    
        return await find_text_in_pdf(
            params, searchString, regexSearch, wordMatchingMode, api_key=api_key
        )
  • Supporting helper function that builds the custom payload for text search parameters and invokes the generic request function to call PDF.co's 'pdf/find' API endpoint.
    async def find_text_in_pdf(
        params: ConversionParams,
        search_string: str,
        regex_search: bool = False,
        word_matching_mode: str | None = None,
        api_key: str | None = None,
    ) -> BaseResponse:
        custom_payload = {"searchString": search_string, "regexSearch": regex_search}
        if word_matching_mode:
            custom_payload["wordMatchingMode"] = word_matching_mode
        return await request(
            "pdf/find", params, custom_payload=custom_payload, api_key=api_key
        )
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the tool 'Supports regular expressions' and references external documentation, but fails to cover critical aspects like whether it's read-only or destructive, authentication needs (beyond optional parameters), rate limits, error handling, or output format details. For a tool with 9 parameters and no output schema, this is a significant gap in transparency.

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 concise and front-loaded, with the core purpose stated in the first sentence. The second sentence adds useful context about regular expressions, and the reference link is non-intrusive. There's no wasted verbiage, making it efficient, though it could be slightly more structured (e.g., bullet points for key features) to enhance readability.

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 (9 parameters, no annotations, no output schema), the description is incomplete. It lacks details on behavioral traits, output format, error cases, and integration with sibling tools like 'upload_file'. While the schema covers parameters well, the description doesn't compensate for missing annotations or output schema, leaving gaps in understanding how to effectively use the tool in practice.

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?

The description adds minimal value beyond the input schema, which has 100% coverage. It implies that 'searchString' can use regular expressions, but the schema already documents this in the 'regexSearch' parameter. No additional syntax, format hints, or usage examples are provided. Given the high schema coverage, the baseline score of 3 is appropriate, as the schema does the heavy lifting without extra semantic insight from the description.

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 purpose: 'Find text in PDF and get coordinates.' It specifies the verb ('find'), resource ('text in PDF'), and output ('coordinates'), which is specific and actionable. However, it doesn't explicitly differentiate from sibling tools like 'pdf_to_text' or 'find_table', which might offer overlapping or related functionality, preventing a perfect score.

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

Usage Guidelines2/5

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

The description provides minimal guidance on when to use this tool. It mentions support for regular expressions and includes a reference link, but offers no explicit advice on scenarios, alternatives, or prerequisites. For example, it doesn't clarify when to choose this over 'pdf_to_text' for text extraction or 'find_table' for structured data. This lack of context leaves the agent with little direction.

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