search_docs
Search Astro documentation to find relevant information for Astro-related tasks. This tool enables AI assistants to retrieve specific content from the Astro docs for accurate user support.
Instructions
Search Astro documentation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search term to find in Astro documentation |
Implementation Reference
- src/index.ts:667-696 (handler)Handler for the 'search_docs' tool within the CallToolRequestSchema request handler. It extracts the query, calls searchDocs helper, and returns formatted search results or no results message.case "search_docs": { const args = request.params.arguments || {}; const query = args.query ? String(args.query) : ""; if (!query) { throw new Error("Search query is required"); } const results = searchDocs(query); if (results.length === 0) { return { content: [{ type: "text", text: `No documentation found for query: "${query}"` }] }; } return { content: [ { type: "text", text: `Found ${results.length} documentation sections for "${query}":\n\n` + results.map(section => `- ${section.title}: ${section.content.substring(0, 100)}... (URI: astro-docs:///${section.id})` ).join('\n\n') } ] }; }
- src/index.ts:646-655 (schema)Input schema definition for the 'search_docs' tool, specifying a required 'query' string parameter.inputSchema: { type: "object", properties: { query: { type: "string", description: "Search term to find in Astro documentation" } }, required: ["query"] }
- src/index.ts:640-659 (registration)Registration of the 'search_docs' tool via the ListToolsRequestSchema handler, which lists available tools including name, description, and schema.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "search_docs", description: "Search Astro documentation", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search term to find in Astro documentation" } }, required: ["query"] } } ] }; });
- src/index.ts:570-576 (helper)Helper function that performs the actual search over astroDocsSections by filtering sections matching the query in title, content, or category.query = query.toLowerCase(); return Object.values(astroDocsSections).filter(section => { return section.title.toLowerCase().includes(query) || section.content.toLowerCase().includes(query) || section.category.toLowerCase().includes(query); }); }