Skip to main content
Glama
halans

Knowledge Base MCP Server

by halans

get_chunk

Retrieve full content from a knowledge base by specifying a chunk ID. Use this tool to access detailed information after identifying relevant content through search.

Instructions

Retrieve a specific chunk from the knowledge base by its ID. Use this when you need the full content of a previously found chunk.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chunk_idYesThe ID of the chunk to retrieve (e.g., 'chunk-42')

Implementation Reference

  • The MCP tool registration and handler implementation for "get_chunk".
    server.tool(
      "get_chunk",
      "Retrieve a specific chunk from the knowledge base by its ID. Use this when you need the full content of a previously found chunk.",
      {
        chunk_id: z.string().describe("The ID of the chunk to retrieve (e.g., 'chunk-42')"),
      },
      async ({ chunk_id }) => {
        try {
          const chunk = getChunkById(chunk_id);
    
          if (!chunk) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Chunk not found with ID: "${chunk_id}"`,
                },
              ],
            };
          }
    
          return {
            content: [
              {
                type: "text" as const,
                text: `# ${chunk.title}
    **Category:** ${chunk.category}
    **Chunk ID:** ${chunk.id}
    
    ${chunk.content}`,
              },
            ],
          };
        } catch (error) {
          const errorMessage =
            error instanceof Error ? error.message : "Unknown error";
          return {
            content: [
              {
                type: "text" as const,
                text: `Error retrieving chunk: ${errorMessage}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • The helper function that performs the actual logic of retrieving the chunk by ID.
    export function getChunkById(chunkId: string): Chunk | null {
      // Validate chunk ID format to prevent potential issues
      if (!CHUNK_ID_PATTERN.test(chunkId)) {
        return null;
      }
      
      const knowledge = getKnowledge();
      return knowledge.chunks.find((chunk) => chunk.id === chunkId) || null;
    }
Behavior3/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 this is a read operation ('Retrieve'), but doesn't address potential error conditions, authentication requirements, rate limits, or what happens if the chunk ID doesn't exist. The description adds basic context but lacks comprehensive behavioral details.

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 perfectly concise with two sentences that each serve distinct purposes: the first states the core functionality, the second provides usage guidance. There's zero wasted language or redundancy.

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

Completeness3/5

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

For a simple retrieval tool with one parameter and no output schema, the description is adequate but minimal. It covers the basic purpose and usage context but lacks details about return format, error handling, or behavioral characteristics that would be helpful given the absence of annotations.

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?

Schema description coverage is 100%, so the schema already fully documents the single parameter (chunk_id). The description adds minimal value beyond what the schema provides, only reinforcing that it retrieves by ID without adding format examples or constraints beyond the schema's description.

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?

The description clearly states the specific action ('Retrieve a specific chunk') and resource ('from the knowledge base'), with explicit differentiation from sibling tools (list_categories, search_knowledge) by focusing on retrieval by ID rather than listing or searching.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('when you need the full content of a previously found chunk'), but doesn't explicitly state when NOT to use it or name specific alternatives among the sibling tools (list_categories, search_knowledge).

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/halans/local-mcp-simple'

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