Skip to main content
Glama
vuluu2k
by vuluu2k

searchKnowledge

Find information across knowledge topics by searching with keywords. Returns matching entries with topic, title, and content details.

Instructions

Search across all knowledge topics by keyword. Returns matching entries with their topic, title, and content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch keyword or phrase

Implementation Reference

  • The actual implementation of the searchKnowledge logic that parses and searches through topic files in the knowledge base.
    async searchKnowledge(query: string): Promise<SearchHit[]> {
      const log = getLogger();
      const topics = await this.listTopics();
      if (topics.length === 0) return [];
    
      const lower = query.toLowerCase();
      const hits: SearchHit[] = [];
    
      // Read all topic files in parallel (cached after first read)
      const files = await Promise.all(
        topics.map(async (topic) => {
          try {
            const file = await this.client.getFile(this.topicPath(topic));
            return { topic, content: file.content };
          } catch {
            return null;
          }
        })
      );
    
      for (const f of files) {
        if (!f) continue;
        const entries = parseEntries(f.content);
        for (const entry of entries) {
          if (
            entry.title.toLowerCase().includes(lower) ||
            entry.content.toLowerCase().includes(lower)
          ) {
            hits.push({ topic: f.topic, title: entry.title, content: entry.content });
          }
        }
      }
    
      log.info("searchKnowledge", { query, hits: hits.length, topicsScanned: topics.length });
      return hits;
    }

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/vuluu2k/knowledge_mcp'

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