Skip to main content
Glama

search_pdf_next_page

Retrieve the next page of PDF search results using an existing search session ID to continue browsing through matched content.

Instructions

Get next page of search results.

Args:
    search_id: Search session ID from previous search

Returns:
    Next page of search results or error message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `search_pdf_next_page` function retrieves the next page of search results for a given search session ID. It validates the session, calculates the page offset, and formats the results for the user.
    async def search_pdf_next_page(search_id: str) -> str:
        """Get next page of search results.
        
        Args:
            search_id: Search session ID from previous search
        
        Returns:
            Next page of search results or error message
        """
        with cache_lock:
            session = search_sessions.get(search_id)
            if not session:
                return f"Error: Search session '{search_id}' not found or expired"
            
            session.last_accessed = datetime.now()
            
            total_pages = (len(session.results) + session.page_size - 1) // session.page_size
            if session.current_page >= total_pages:
                return f"Already on last page ({session.current_page}/{total_pages})"
            
            session.current_page += 1
            
            start_idx = (session.current_page - 1) * session.page_size
            end_idx = min(start_idx + session.page_size, len(session.results))
            current_results = session.results[start_idx:end_idx]
            
            result = f"Search ID: {search_id}\n"
            result += f"Pattern: {session.pattern}\n"
            result += f"Total matches: {session.total_results}\n"
            result += f"Page: {session.current_page}/{total_pages}\n\n"
            
            for i, match in enumerate(current_results, 1):
                result += f"Match {start_idx + i}:\n"
                result += f"  Page: {match.page_number}\n"
                result += f"  Text: \"{match.text}\"\n"
                result += f"  Context: ...{match.context_before}[{match.text}]{match.context_after}...\n\n"
            
            return result
  • The `search_pdf_next_page` tool is registered using the `@mcp.tool()` decorator in `pdf_tools_mcp/server.py`.
    @mcp.tool()
Behavior2/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 of behavioral disclosure. It mentions that the tool returns 'Next page of search results or error message,' which gives some insight into outcomes, but lacks details on error conditions, pagination behavior (e.g., what happens if no next page exists), rate limits, or authentication needs. This leaves gaps for an agent to understand operational nuances.

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: the first sentence states the core purpose, followed by brief sections for arguments and returns. Every sentence earns its place by providing essential information 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 moderate complexity (pagination operation), no annotations, and an output schema present (which handles return values), the description is reasonably complete. It covers the purpose, parameter semantics, and return outcomes, though it could benefit from more behavioral context like error handling or pagination limits to be fully comprehensive.

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 meaning beyond the input schema by explaining that 'search_id' is a 'Search session ID from previous search,' clarifying its purpose and origin. With 0% schema description coverage, this compensates somewhat, but it doesn't detail the format or constraints of the ID. Since there's only one parameter, the baseline is 4, but the limited semantic enhancement reduces the score to 3.

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: 'Get next page of search results.' It specifies the verb ('Get') and resource ('next page of search results'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from its sibling 'search_pdf_prev_page' beyond the directional implication in the name.

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 by mentioning 'Search session ID from previous search,' suggesting this tool should be used after an initial search. However, it doesn't provide explicit guidance on when to use this versus alternatives like 'search_pdf_prev_page' or 'search_pdf_go_page,' nor does it specify any prerequisites or exclusions beyond the implied sequence.

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/lockon-n/pdf-tools-mcp'

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