Skip to main content
Glama

get_more_search_results

Read-only

Retrieve additional search results using offset-based pagination to access specific ranges or tail results from ongoing searches.

Instructions

                    Get more results from an active search with offset-based pagination.
                    
                    Supports partial result reading with:
                    - 'offset' (start result index, default: 0)
                      * Positive: Start from result N (0-based indexing)
                      * Negative: Read last N results from end (tail behavior)
                    - 'length' (max results to read, default: 100)
                      * Used with positive offsets for range reading
                      * Ignored when offset is negative (reads all requested tail results)
                    
                    Examples:
                    - offset: 0, length: 100     β†’ First 100 results
                    - offset: 200, length: 50    β†’ Results 200-249
                    - offset: -20                β†’ Last 20 results
                    - offset: -5, length: 10     β†’ Last 5 results (length ignored)
                    
                    Returns only results in the specified range, along with search status.
                    Works like read_process_output - call this repeatedly to get progressive
                    results from a search started with start_search.
                    
                    This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYes
offsetNo
lengthNo

Implementation Reference

  • Main handler function executing the tool logic: validates input with schema, reads search results from searchManager, formats paginated output with status and hints.
    export async function handleGetMoreSearchResults(args: unknown): Promise<ServerResult> {
      const parsed = GetMoreSearchResultsArgsSchema.safeParse(args);
      if (!parsed.success) {
        return {
          content: [{ type: "text", text: `Invalid arguments for get_more_search_results: ${parsed.error}` }],
          isError: true,
        };
      }
    
      try {
        const results = searchManager.readSearchResults(
          parsed.data.sessionId,
          parsed.data.offset,
          parsed.data.length
        );
        
        // Only return error if we have no results AND there's an actual error
        // Permission errors should not block returning found results
        if (results.isError && results.totalResults === 0 && results.error?.trim()) {
          return {
            content: [{
              type: "text",
              text: `Search session ${parsed.data.sessionId} encountered an error: ${results.error}`
            }],
            isError: true,
          };
        }
    
        // Format results for display
        let output = `Search session: ${parsed.data.sessionId}\n`;
        output += `Status: ${results.isComplete ? 'COMPLETED' : 'IN PROGRESS'}\n`;
        output += `Runtime: ${Math.round(results.runtime / 1000)}s\n`;
        output += `Total results found: ${results.totalResults} (${results.totalMatches} matches)\n`;
        
        const offset = parsed.data.offset;
        
        if (offset < 0) {
          // Negative offset - tail behavior
          output += `Showing last ${results.returnedCount} results\n\n`;
        } else {
          // Positive offset - range behavior
          const startPos = offset;
          const endPos = startPos + results.returnedCount - 1;
          output += `Showing results ${startPos}-${endPos}\n\n`;
        }
    
        if (results.results.length === 0) {
          if (results.isComplete) {
            output += results.totalResults === 0 ? "No matches found." : "No results in this range.";
          } else {
            output += "No results yet, search is still running...";
          }
        } else {
          output += "Results:\n";
          
          for (const result of results.results) {
            if (result.type === 'content') {
              output += `πŸ“„ ${result.file}:${result.line} - ${result.match?.substring(0, 100)}${result.match && result.match.length > 100 ? '...' : ''}\n`;
            } else {
              output += `πŸ“ ${result.file}\n`;
            }
          }
        }
    
        // Add pagination hints
        if (offset >= 0 && results.hasMoreResults) {
          const nextOffset = offset + results.returnedCount;
          output += `\nπŸ“– More results available. Use get_more_search_results with offset: ${nextOffset}`;
        }
    
        if (results.isComplete) {
          output += `\nβœ… Search completed.`;
          
          // Warn users if search was incomplete due to permission issues
          if (results.wasIncomplete) {
            output += `\n⚠️  Warning: Some files were inaccessible due to permissions. Results may be incomplete.`;
          }
        }
    
        return {
          content: [{ type: "text", text: output }],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        
        return {
          content: [{ type: "text", text: `Error reading search results: ${errorMessage}` }],
          isError: true,
        };
      }
    }
  • src/server.ts:581-609 (registration)
    Tool specification registration in the allTools array: defines name, description, input schema from GetMoreSearchResultsArgsSchema, and annotations for the MCP tools/list response.
        name: "get_more_search_results",
        description: `
                Get more results from an active search with offset-based pagination.
                
                Supports partial result reading with:
                - 'offset' (start result index, default: 0)
                  * Positive: Start from result N (0-based indexing)
                  * Negative: Read last N results from end (tail behavior)
                - 'length' (max results to read, default: 100)
                  * Used with positive offsets for range reading
                  * Ignored when offset is negative (reads all requested tail results)
                
                Examples:
                - offset: 0, length: 100     β†’ First 100 results
                - offset: 200, length: 50    β†’ Results 200-249
                - offset: -20                β†’ Last 20 results
                - offset: -5, length: 10     β†’ Last 5 results (length ignored)
                
                Returns only results in the specified range, along with search status.
                Works like read_process_output - call this repeatedly to get progressive
                results from a search started with start_search.
                
                ${CMD_PREFIX_DESCRIPTION}`,
        inputSchema: zodToJsonSchema(GetMoreSearchResultsArgsSchema),
        annotations: {
            title: "Get Search Results",
            readOnlyHint: true,
        },
    },
  • Dispatch registration in CallToolRequest handler switch: routes calls to 'get_more_search_results' to the handleGetMoreSearchResults function imported via handlers/index.js
    case "get_more_search_results":
        result = await handlers.handleGetMoreSearchResults(args);
        break;
  • Zod schema defining input parameters: sessionId (required), offset and length (optional with defaults). Used for validation in handler and JSON schema in tool registration.
    export const GetMoreSearchResultsArgsSchema = z.object({
      sessionId: z.string(),
      offset: z.number().optional().default(0),    // Same as file reading
      length: z.number().optional().default(100),  // Same as file reading (but smaller default)
    });
Behavior4/5

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

Annotations provide readOnlyHint=true, but the description adds valuable behavioral context beyond this. It explains how pagination works with offset and length parameters, describes default values, tail behavior for negative offsets, and clarifies that length is ignored in tail mode. However, it doesn't mention rate limits, error conditions, or search status details.

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 well-structured with clear sections: purpose statement, parameter explanations with bullet points, examples, and usage context. While slightly verbose, every sentence adds value. The final sentence about 'DC: ...' references could be trimmed as it's more about implementation than usage guidance.

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?

For a pagination tool with no output schema, the description provides strong context about what it returns ('results in the specified range, along with search status') and how it integrates with other tools ('start_search'). It covers parameters thoroughly but could better explain error cases or result format details given the absence of output schema.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by providing detailed semantics for all parameters. It explains 'sessionId' context ('active search'), 'offset' behavior (positive/negative indexing, default 0), and 'length' usage (range reading, default 100, ignored with negative offsets), including practical examples that clarify usage beyond schema constraints.

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 tool's purpose: 'Get more results from an active search with offset-based pagination.' It specifies the verb ('get'), resource ('results'), and scope ('from an active search'), distinguishing it from sibling tools like 'start_search' or 'list_searches' which have different functions.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool: 'call this repeatedly to get progressive results from a search started with start_search.' It also provides context on alternatives by referencing 'read_process_output' for similar behavior, making it clear this is for pagination of search results.

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/wonderwhy-er/ClaudeComputerCommander'

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