search_docs
Find relevant documentation pages by searching for specific terms in Tambo documentation. Use this tool to locate technical information quickly when working with Tambo systems.
Instructions
Search for documentation pages containing specific terms
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query to find relevant documentation |
Implementation Reference
- src/doc-handler.ts:135-181 (handler)Core handler function for the 'search_docs' tool. Ensures documentation sections are discovered, iterates through sections, fetches content, searches for query matches, extracts snippets, and formats results as text response.async searchDocs(query: string): Promise<CallToolResult> { if (!query) { throw new Error('Search query is required'); } await this.ensureSectionsLoaded(); const results: SearchResult[] = []; const sectionsToSearch = this.sections.length > 0 ? this.sections : [ { path: '/getting-started/quickstart', title: 'Quickstart' }, { path: '/concepts/components', title: 'Components' }, { path: '/api-reference/react-hooks', title: 'React Hooks' }, ]; for (const section of sectionsToSearch) { try { const response = await this.fetchDocs(section.path); const textContent = response.content[0] && 'text' in response.content[0] ? response.content[0].text : ''; const content = String(textContent || '').toLowerCase(); if (content.includes(query.toLowerCase())) { results.push({ path: section.path, title: section.title, category: section.category, snippet: this.extractSnippet(content, query) }); } } catch (error) { console.error(`Error searching ${section.path}:`, error instanceof Error ? error.message : String(error)); } } return { content: [ { type: 'text', text: results.length > 0 ? `Found ${results.length} results for "${query}":\n\n${results.map(r => `**${r.title}** (${r.path})${r.category ? ` [${r.category}]` : ''}\n${r.snippet}\n` ).join('\n')}` : `No results found for "${query}"`, }, ], }; }
- src/server.ts:50-62 (registration)Tool registration in the listTools response, including name, description, and input schema for 'search_docs'.name: 'search_docs', description: 'Search for documentation pages containing specific terms', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query to find relevant documentation', }, }, required: ['query'], }, },
- src/server.ts:90-91 (registration)Dispatch logic in the callTool handler that routes 'search_docs' calls to the DocHandler's searchDocs method.case 'search_docs': return await this.docHandler.searchDocs(args?.query as string);
- src/server.ts:52-61 (schema)Input schema definition for the 'search_docs' tool, specifying a required 'query' string parameter.inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query to find relevant documentation', }, }, required: ['query'], },