Skip to main content
Glama
cskwork

Knowledge Retrieval Server

by cskwork

get-document-by-id

Fetch a complete document using its unique ID to access detailed information within the Knowledge Retrieval Server, ensuring accurate and relevant data retrieval for structured knowledge domains.

Instructions

Retrieve full document by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesDocument ID to retrieve

Implementation Reference

  • src/index.ts:239-252 (registration)
    Tool registration including name, description, and input schema for 'get-document-by-id' in the listTools handler.
    { 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'] } },
  • Main tool handler that extracts ID from arguments, calls repository.getDocumentById, and returns formatted document content or 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 }; }
  • Helper method in DocumentRepository that retrieves the document by ID from the internal documents Map.
    getDocumentById(id: number): KnowledgeDocument | null { this.ensureInitialized(); return this.documents.get(id) || null; }

Other Tools

Related 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