Skip to main content
Glama

search_pdf_prev_page

Navigate to the previous page of PDF search results using an existing search session ID to continue reviewing matches.

Instructions

Get previous page of search results.

Args:
    search_id: Search session ID from previous search

Returns:
    Previous page of search results or error message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'search_pdf_prev_page' tool, which navigates to the previous page of search results for a given session ID.
    @mcp.tool()
    async def search_pdf_prev_page(search_id: str) -> str:
        """Get previous page of search results.
        
        Args:
            search_id: Search session ID from previous search
        
        Returns:
            Previous 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()
            
            if session.current_page <= 1:
                return f"Already on first page (1)"
            
            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]
            
            total_pages = (len(session.results) + session.page_size - 1) // session.page_size
            
            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
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 it returns 'previous 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 previous page exists), rate limits, or authentication needs. This is inadequate for a tool with no annotation coverage.

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 well-structured, with a clear purpose statement followed by brief sections for arguments and returns. Every sentence adds value, and there's no unnecessary information. However, it could be slightly more front-loaded by integrating the return info into the main description for better flow.

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

Completeness3/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 in search results), no annotations, and an output schema exists (which handles return values), the description is minimally complete. It covers the basic purpose and parameter but lacks details on behavioral aspects like error handling or usage context, leaving gaps that could hinder an AI agent's effective use.

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 semantics beyond the input schema. It explains that 'search_id' is a 'Search session ID from previous search,' which clarifies its purpose, but the schema description coverage is 0%, and with only one parameter, the baseline is 4. However, it doesn't fully compensate by detailing format or constraints, so it scores slightly below baseline.

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 previous page of search results.' It specifies the verb ('Get') and resource ('previous page of search results'), making it easy to understand. However, it doesn't explicitly differentiate from sibling tools like 'search_pdf_next_page' or 'search_pdf_go_page', which handle similar pagination functions, so it misses full sibling distinction.

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

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