Skip to main content
Glama

agentbay_knowledge_query

Search project knowledge to uncover patterns, pitfalls, and learnings. Use semantic queries to retrieve insights across projects, teams, or all scopes, filtered by type and tags.

Instructions

Search project knowledge for patterns, pitfalls, and learnings. Supports semantic search.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID
queryNoSearch query
typeNo
tagsNo
scopeNo
limitNo

Implementation Reference

  • The handler function for the 'agentbay_knowledge_query' tool. Builds query parameters from optional inputs (query, type, tags, scope, limit), sends a GET request to the knowledge API endpoint, and formats the response showing knowledge entries with similarity scores, confidence, and tags.
      async ({ projectId, query, type, tags, scope, limit }) => {
        const params = new URLSearchParams();
        if (query) params.set('q', query);
        if (type) params.set('type', type);
        if (tags?.length) params.set('tags', tags.join(','));
        if (scope) params.set('scope', scope);
        if (limit) params.set('limit', String(limit));
        const data = await apiGet(`/api/v1/projects/${projectId}/knowledge?${params.toString()}`);
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
        const entries = data.knowledge || [];
        if (!entries.length) return { content: [{ type: 'text' as const, text: 'No knowledge entries found.' }] };
        const searchMode = data.searchMode ? ` | Search: ${data.searchMode}` : '';
        const text = entries.map((k: any) => {
          const sim = k.similarityScore ? ` | Similarity: ${(k.similarityScore * 100).toFixed(0)}%` : '';
          return `### ${k.title} (${k.type})\nID: ${k.id}\n${k.content}\n_Confidence: ${k.confidence} | Tags: ${k.tags?.join(', ') || 'none'}${sim}_`;
        }).join('\n\n');
        return { content: [{ type: 'text' as const, text: `Knowledge (${entries.length}${searchMode}):\n\n${text}` }] };
      }
    );
  • Zod schema defining input parameters: projectId (required string), query (optional string), type (optional enum of knowledge types), tags (optional string array), scope (optional 'project'|'team'|'all'), and limit (optional number).
    {
      projectId: z.string().describe('Project ID'),
      query: z.string().optional().describe('Search query'),
      type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']).optional(),
      tags: z.array(z.string()).optional(),
      scope: z.enum(['project', 'team', 'all']).optional(),
      limit: z.number().optional(),
    },
  • src/index.ts:299-328 (registration)
    Registration of the 'agentbay_knowledge_query' tool via server.tool() with description 'Search project knowledge for patterns, pitfalls, and learnings. Supports semantic search.'
    server.tool(
      'agentbay_knowledge_query',
      'Search project knowledge for patterns, pitfalls, and learnings. Supports semantic search.',
      {
        projectId: z.string().describe('Project ID'),
        query: z.string().optional().describe('Search query'),
        type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']).optional(),
        tags: z.array(z.string()).optional(),
        scope: z.enum(['project', 'team', 'all']).optional(),
        limit: z.number().optional(),
      },
      async ({ projectId, query, type, tags, scope, limit }) => {
        const params = new URLSearchParams();
        if (query) params.set('q', query);
        if (type) params.set('type', type);
        if (tags?.length) params.set('tags', tags.join(','));
        if (scope) params.set('scope', scope);
        if (limit) params.set('limit', String(limit));
        const data = await apiGet(`/api/v1/projects/${projectId}/knowledge?${params.toString()}`);
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
        const entries = data.knowledge || [];
        if (!entries.length) return { content: [{ type: 'text' as const, text: 'No knowledge entries found.' }] };
        const searchMode = data.searchMode ? ` | Search: ${data.searchMode}` : '';
        const text = entries.map((k: any) => {
          const sim = k.similarityScore ? ` | Similarity: ${(k.similarityScore * 100).toFixed(0)}%` : '';
          return `### ${k.title} (${k.type})\nID: ${k.id}\n${k.content}\n_Confidence: ${k.confidence} | Tags: ${k.tags?.join(', ') || 'none'}${sim}_`;
        }).join('\n\n');
        return { content: [{ type: 'text' as const, text: `Knowledge (${entries.length}${searchMode}):\n\n${text}` }] };
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; description only mentions semantic search but lacks behavioral details such as read-only nature, rate limits, or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence is efficient and front-loaded, but could benefit from additional concise sentences without losing brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 6 parameters, no output schema, and no annotations, the description is incomplete. Lacks explanation of search results format, filtering options, and differences from sibling query tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is low (33%); description adds no explanation for parameters like type, tags, scope, limit beyond what schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states verb 'search' and resource 'project knowledge', specifying subjects 'patterns, pitfalls, and learnings'. Distinguishes from sibling knowledge tools like manage, record, sync, export which are not for searching.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives (e.g., agentbay_knowledge_manage). Does not specify prerequisites or context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/thomasjumper/agentbay-mcp'

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