Skip to main content
Glama
cskwork

Knowledge Retrieval Server

by cskwork

get-document-by-id

Retrieve complete documents by ID to access specific knowledge content from structured domains for reference in answering questions.

Instructions

Retrieve full document by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesDocument ID to retrieve

Implementation Reference

  • The main handler for the 'get-document-by-id' tool. Extracts the document ID from arguments, retrieves the document using DocumentRepository.getDocumentById, and returns formatted markdown content or a not-found message.
    case 'get-document-by-id': {
      const { id } = args as { id: number };
      const document = repository.getDocumentById(id);
    
      if (!document) {
        const content: TextContent[] = [{
          type: 'text',
          text: `Document with ID ${id} not found.`
        }];
        
        return { content };
      }
    
      const content: TextContent[] = [{
        type: 'text',
        text: `# ${document.title}\n\n${document.content}`
      }];
      
      return { content };
    }
  • src/index.ts:239-252 (registration)
    Tool registration in the ListTools handler, including name, description, and input schema definition.
    {
      name: 'get-document-by-id',
      description: 'Retrieve full document by ID.',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'number',
            description: 'Document ID to retrieve'
          }
        },
        required: ['id']
      }
    },
  • Input schema for the 'get-document-by-id' tool, defining the required 'id' parameter as a number.
    inputSchema: {
      type: 'object',
      properties: {
        id: {
          type: 'number',
          description: 'Document ID to retrieve'
        }
      },
      required: ['id']
    }
  • Helper method in DocumentRepository that retrieves and returns the KnowledgeDocument by ID from the internal documents Map, or null if not found.
    getDocumentById(id: number): KnowledgeDocument | null {
      this.ensureInitialized();
      return this.documents.get(id) || null;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is a retrieval operation but lacks details on permissions, rate limits, error handling, or response format. For a read tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

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, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy 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 lack of annotations and output schema, the description is incomplete. It doesn't explain what a 'full document' entails (e.g., content, metadata), potential errors, or usage context. For a retrieval tool with no structured behavioral data, more detail is needed to fully inform an agent.

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 input schema has 100% description coverage, with the 'id' parameter clearly documented as 'Document ID to retrieve'. The description adds no additional meaning beyond this, such as format constraints or examples. With high schema coverage, the baseline score of 3 is appropriate.

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 ('Retrieve') and resource ('full document by ID'), making the purpose immediately understandable. However, it doesn't differentiate this from sibling tools like 'get-chunk-with-context' or 'search-documents', which likely also retrieve documents but with different approaches or scopes.

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. It doesn't mention prerequisites (e.g., needing a specific document ID), exclusions (e.g., not for partial documents), or comparisons to siblings like 'search-documents' for broader queries or 'get-chunk-with-context' for contextual retrieval.

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/cskwork/keyword-rag-mcp'

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