Skip to main content
Glama

search_docs

Search documentation using Elasticsearch queries to find specific information in codebases or repositories. Use keywords with ES syntax like "install AND guide" for precise results.

Instructions

Search documentation using the probe search engine.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesElasticsearch query string. Focus on keywords and use ES syntax (e.g., "install AND guide", "configure OR setup", "api NOT internal").
pageNoOptional page number for pagination of results (e.g., 1, 2, 3...). Default is 1.

Implementation Reference

  • The primary handler function that performs the actual documentation search by calling the 'search' function from '@probelabs/probe' with the query and data directory.
    async executeDocsSearch(args) {
    	try {
    		// Always use the configured data directory
    		const searchPath = config.dataDir;
    
    		// Create a clean options object
    		const options = {
    			path: searchPath,
    			query: args.query,
    			maxTokens: 10000 // Set default maxTokens
    			// Removed filesOnly, maxResults, session
    		};
    
    		console.error("Executing search with options:", JSON.stringify(options, null, 2));
    
    		// Call search with the options object
    		const result = await search(options);
    		return result;
    	} catch (error) {
    		console.error('Error executing docs search:', error);
    		throw new McpError(
    			ErrorCode.MethodNotFound,
    			`Error executing docs search: ${error.message || String(error)}`
    		);
    	}
    }
  • Defines the JSON schema for the tool's input parameters: required 'query' string and optional 'page' number.
    inputSchema: {
    	type: 'object',
    	properties: {
    		query: {
    			type: 'string',
    			description: 'Elasticsearch query string. Focus on keywords and use ES syntax (e.g., "install AND guide", "configure OR setup", "api NOT internal").',
    		},
    		page: {
    			type: 'number',
    			description: 'Optional page number for pagination of results (e.g., 1, 2, 3...). Default is 1.',
    			default: 1, // Set a default value
    		}
    	},
    	required: ['query'] // 'page' is optional
    },
  • src/index.js:97-119 (registration)
    Registers the 'search_docs' tool (using config.toolName) with its description and schema in the MCP ListToolsRequestSchema handler.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
    	tools: [
    		{
    			name: config.toolName, // Use configured tool name
    			description: config.toolDescription, // Use configured description
    			inputSchema: {
    				type: 'object',
    				properties: {
    					query: {
    						type: 'string',
    						description: 'Elasticsearch query string. Focus on keywords and use ES syntax (e.g., "install AND guide", "configure OR setup", "api NOT internal").',
    					},
    					page: {
    						type: 'number',
    						description: 'Optional page number for pagination of results (e.g., 1, 2, 3...). Default is 1.',
    						default: 1, // Set a default value
    					}
    				},
    				required: ['query'] // 'page' is optional
    			},
    		},
    	],
    }));
  • src/index.js:121-170 (registration)
    Handles MCP CallToolRequestSchema, validates tool name matches 'search_docs', and invokes the executeDocsSearch handler.
    	this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
    		// Check against the configured tool name
    		if (request.params.name !== config.toolName) {
    			throw new McpError(
    				ErrorCode.MethodNotFound,
    				`Unknown tool: ${request.params.name}. Expected: ${config.toolName}`
    			);
    		}
    
    		try {
    			// Log the incoming request for debugging
    			console.error(`Received request for tool: ${request.params.name}`);
    			console.error(`Request arguments: ${JSON.stringify(request.params.arguments)}`);
    
    			// Ensure arguments is an object
    			if (!request.params.arguments || typeof request.params.arguments !== 'object') {
    				throw new Error("Arguments must be an object");
    			}
    
    			const args = request.params.arguments;
    
    			// Validate required fields
    			if (!args.query) {
    				throw new Error("Query is required in arguments");
    			}
    
    			const result = await this.executeDocsSearch(args);
    
    			return {
    				content: [
    					{
    						type: 'text',
    						text: result,
    					},
    				],
    			};
    		} catch (error) {
    			console.error(`Error executing ${request.params.name}:`, error);
    			return {
    				content: [
    					{
    						type: 'text',
    						text: `Error executing ${request.params.name}: ${error instanceof Error ? error.message : String(error)}`,
    					},
    				],
    				isError: true,
    			};
    		}
    	});
    }
  • Default configuration for the tool name and description, loaded and used throughout the server.
    // MCP Tool configuration
    toolName: 'search_docs',
    toolDescription: 'Search documentation using the probe search engine.',
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 the search engine type ('probe search engine'), which adds some context, but fails to describe critical behaviors like authentication requirements, rate limits, pagination details beyond the schema, or what the search results look like. This leaves significant gaps for a search tool.

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 a single, efficient sentence that directly states the tool's purpose without any fluff or redundancy. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what the search returns, how results are structured, or any behavioral nuances like error handling. For a search tool with two parameters, this minimal description leaves too much unspecified for 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 does not add any parameter-specific information beyond what's already in the input schema, which has 100% coverage. The schema fully documents the 'query' and 'page' parameters, including syntax examples and defaults. Thus, the description provides no extra semantic value, meeting the baseline score of 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 as 'Search documentation using the probe search engine,' which specifies the verb (search), resource (documentation), and technology (probe search engine). It's not a tautology and provides a clear function, though without sibling tools to differentiate from, it can't achieve the highest score of 5.

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 no guidance on when to use this tool versus alternatives, prerequisites, or contextual usage. It's a basic statement of function without any usage instructions, which is insufficient for effective tool selection by an AI agent.

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/probelabs/docs-mcp'

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