search_backstage_knowledge
Search Backstage documentation and resources to find information on specific topics or keywords for development and customization.
Instructions
Search across all Backstage knowledge for specific topics or keywords
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for finding relevant information |
Implementation Reference
- src/index.ts:291-319 (handler)The main handler function for the 'search_backstage_knowledge' tool. It searches all loaded knowledge bases for matches to the query by stringifying and checking for substring inclusion, collects results with extracted relevant content, and returns a JSON-formatted response.private searchBackstageKnowledge(query: string) { const results: any[] = []; const searchTerm = query.toLowerCase(); // Search through all knowledge bases Object.entries(this.knowledgeBase).forEach(([key, knowledge]) => { const knowledgeStr = JSON.stringify(knowledge).toLowerCase(); if (knowledgeStr.includes(searchTerm)) { results.push({ source: key, title: (knowledge as any).title, relevantContent: this.extractRelevantContent(knowledge, searchTerm) }); } }); return { content: [ { type: 'text', text: JSON.stringify({ query, results, totalResults: results.length }, null, 2), }, ], }; }
- src/index.ts:124-137 (schema)Tool schema definition including name, description, and input schema requiring a 'query' string.{ name: 'search_backstage_knowledge', description: 'Search across all Backstage knowledge for specific topics or keywords', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for finding relevant information' } }, required: ['query'] } },
- src/index.ts:189-190 (registration)Registration of the tool handler in the switch statement that dispatches tool calls.case 'search_backstage_knowledge': return this.searchBackstageKnowledge(args?.query as string);
- src/index.ts:321-331 (helper)Helper function used by the search handler to extract a snippet of relevant content around the matched search term.private extractRelevantContent(knowledge: any, searchTerm: string): any { // Simple relevance extraction - in a real implementation, this could be more sophisticated const content = JSON.stringify(knowledge.content); const index = content.toLowerCase().indexOf(searchTerm); if (index !== -1) { const start = Math.max(0, index - 100); const end = Math.min(content.length, index + 100); return content.substring(start, end); } return (knowledge as any).description; }
- src/index.ts:35-41 (helper)Initialization of the knowledgeBase object, which is the data source searched by the tool. Data imported from ./knowledge/ modules.this.knowledgeBase = { overview: backstageOverview, pluginDev: pluginDevelopment, api: apiReference, community: communityResources, examples: examples, };