Skip to main content
Glama

knowledge_search

Search accumulated knowledge across all sessions by keywords, category, or free text to find related past work, decisions, and context from previous sessions.

Instructions

Search accumulated knowledge across all sessions by keywords, category, or free text. The knowledge base grows automatically as sessions are saved โ€” keywords are extracted from every ledger and handoff entry. Use this to find related past work, decisions, and context from previous sessions.

Categories available: debugging, architecture, deployment, testing, configuration, api-integration, data-migration, security, performance, documentation, ai-ml, ui-frontend, resume

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNoOptional project filter. If omitted, searches across all projects.
queryNoFree-text search query. Searched against session summaries using full-text search.
categoryNoOptional category filter (e.g. 'debugging', 'architecture', 'ai-ml'). Filters results to sessions in this category.
limitNoMaximum results to return (default: 10, max: 50).

Implementation Reference

  • The `knowledgeSearchHandler` function executes keyword-based knowledge search by leveraging the `storage` abstraction. It extracts keywords from the query and performs a search across knowledge entries.
    export async function knowledgeSearchHandler(args: unknown) {
      if (!isKnowledgeSearchArgs(args)) {
        throw new Error("Invalid arguments for knowledge_search");
      }
    
      const { project, query, category, limit = 10 } = args;
    
      console.error(`[knowledge_search] Searching: project=${project || "all"}, query="${query || ""}", category=${category || "any"}, limit=${limit}`);
    
      const searchKeywords = query ? toKeywordArray(query) : [];
      const storage = await getStorage();
    
      const data = await storage.searchKnowledge({
        project: project || null,
        keywords: searchKeywords,
        category: category || null,
        queryText: query || null,
        limit: Math.min(limit, 50),
        userId: PRISM_USER_ID,
      });
    
      if (!data) {
        return {
          content: [{
            type: "text",
            text: `๐Ÿ” No knowledge found matching your search.\n` +
              (query ? `Query: "${query}"\n` : "") +
              (category ? `Category: ${category}\n` : "") +
              (project ? `Project: ${project}\n` : "") +
              `\nTip: Try session_search_memory for semantic (meaning-based) search ` +
              `if keyword search doesn't find what you need.`,
          }],
          isError: false,
        };
      }
    
      return {
        content: [{
          type: "text",
          text: `๐Ÿง  Found ${data.count} knowledge entries:\n\n${JSON.stringify(data, null, 2)}`,
        }],
        isError: false,
      };
    }
  • The definition of the `knowledge_search` tool, including its input schema and description for the MCP registry.
    export const KNOWLEDGE_SEARCH_TOOL: Tool = {
      name: "knowledge_search",
      description:
        "Search accumulated knowledge across all sessions by keywords, category, or free text. " +
        "The knowledge base grows automatically as sessions are saved โ€” keywords are extracted " +
  • src/server.ts:569-571 (registration)
    Registration of the `knowledge_search` tool handler within the MCP server's request handler switch statement.
    case "knowledge_search":
      if (!SESSION_MEMORY_ENABLED) throw new Error("Session memory not configured. Set SUPABASE_URL and SUPABASE_KEY.");
      return await knowledgeSearchHandler(args);

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/dcostenco/BCBA'

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