Skip to main content
Glama

search_docs

Search documentation using Elasticsearch query syntax. Enter a query string with keywords and operators (e.g., 'install AND guide'). Optionally specify a page number to paginate 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 main handler function that executes the 'search_docs' tool logic. It calls the `search` function from `@probelabs/probe` with the query and data directory path, returning the results as a string.
    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)}`
    		);
    	}
    }
  • JSDoc typedef for SearchDocsArgs, defining the input schema: `query` (string or string array) using Elasticsearch syntax.
    /**
     * @typedef {Object} SearchDocsArgs
     * @property {string|string[]} query - The search query using Elasticsearch syntax. Focus on keywords.
     */
  • src/index.js:97-119 (registration)
    Tool registration in the ListToolsRequestSchema handler. The tool name is set to the configured value (defaults to 'search_docs'). Defines input schema with required 'query' (string) and optional 'page' (number).
    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-128 (registration)
    CallToolRequestSchema handler that dispatches to executeDocsSearch when the tool name matches the configured name (default 'search_docs'). Validates required 'query' argument.
    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}`
    		);
    	}
  • Configuration definition where the tool name 'search_docs' is set as the default value in the config, along with the tool description.
    // 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?

No annotations are provided, so the description carries the full burden. It only states 'Search documentation' which implies a read operation, but does not disclose any behavioral traits such as rate limits, authentication needs, or side effects. The description is minimal.

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 concise sentence that clearly conveys the tool's action. It is appropriately sized and front-loaded with the main purpose.

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 simplicity of the tool (2 parameters, no output schema, no siblings, no annotations), the description adequately covers the essential information. It explains the tool's function and the search engine used, which is sufficient for an agent to understand its purpose.

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?

Schema description coverage is 100%, with detailed descriptions for both parameters (query with ES syntax, page with pagination). The tool description adds no extra information beyond the schema, which is acceptable given high coverage.

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 verb 'Search' and the resource 'documentation', and specifies the search engine 'probe search engine'. It is specific and directly communicates the tool's purpose.

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 does not provide explicit guidance on when to use this tool versus alternatives. Since there are no sibling tools, it is less critical, but it could still mention scenarios or prerequisites. The mention of the search engine provides some context.

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