Skip to main content
Glama
dannwaneri

MCP Knowledge Base Server

by dannwaneri

get_by_id

Retrieve a specific knowledge base entry using its unique ID to access precise information quickly.

Instructions

Get a specific knowledge base entry by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the entry to retrieve

Implementation Reference

  • src/index.ts:182-195 (registration)
    Registers the 'get_by_id' tool in the ListTools response, defining its name, description, and input schema (object with required 'id' string).
    {
      name: "get_by_id",
      description: "Get a specific knowledge base entry by its ID",
      inputSchema: {
        type: "object",
        properties: {
          id: {
            type: "string",
            description: "The ID of the entry to retrieve",
          },
        },
        required: ["id"],
      },
    },
  • Executes the 'get_by_id' tool: retrieves entry by ID from knowledgeBase, returns formatted JSON with content/category/metadata or error if not found, includes caching.
    if (name === "get_by_id") {
      const id = args?.id as string;
    
      if (!id) {
        throw new Error("ID parameter is required");
      }
    
      const entry = knowledgeBase.find((item) => item.id === id);
    
      if (!entry) {
        const responseText = JSON.stringify({
          id,
          error: "Entry not found",
          availableIds: knowledgeBase.map((item) => item.id),
        });
    
        // Don't cache errors
        return {
          content: [
            {
              type: "text",
              text: responseText,
            },
          ],
          isError: true,
        };
      }
    
      const responseText = JSON.stringify(
        {
          id: entry.id,
          content: entry.content,
          category: entry.category,
          metadata: entry.metadata,
        },
        null,
        2
      );
    
      // Cache the response
      setCache(cacheKey, responseText);
    
      return {
        content: [
          {
            type: "text",
            text: responseText,
          },
        ],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a read-only operation ('Get') but doesn't specify if it's safe, requires authentication, has rate limits, or what happens on errors (e.g., invalid ID). This leaves significant gaps for a tool that retrieves data by ID.

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

Conciseness5/5

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

The description is a single, clear sentence with zero waste—it directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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?

Given the complexity of retrieving an entry by ID, no annotations, and no output schema, the description is incomplete. It doesn't explain return values, error handling, or behavioral traits, which are crucial for an agent to use this tool correctly in context with its siblings.

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

Parameters3/5

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

The schema description coverage is 100%, with the parameter 'id' fully documented in the schema. The description adds no additional meaning beyond what the schema provides, such as ID format or examples, so it meets the baseline score when the schema handles parameter documentation effectively.

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

Purpose4/5

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

The description clearly states the action ('Get') and resource ('knowledge base entry') with specificity ('by its ID'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_by_category' or 'search_knowledge', which would require explicit comparison to achieve a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives like 'advanced_search' or 'get_by_category'. It lacks any mention of prerequisites, such as needing the entry ID, or contextual cues for selection among siblings, leaving the agent without usage direction.

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/dannwaneri/mcp-knowledge-base-server'

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