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; }

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