Skip to main content
Glama
DynamicEndpoints

Document Extractor MCP Server

get_document

Retrieve full document content by ID from the Document Extractor MCP Server for accessing stored documentation with metadata preservation.

Instructions

Get a specific document by ID with full content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesDocument ID to retrieve

Implementation Reference

  • Registration and handler logic for the 'get_document' tool.
    const getDocumentTool = server.tool(
      'get_document',
      'Get a specific document by ID with full content',
      {
        id: z.string().min(1, 'Document ID is required').describe('Document ID to retrieve')
      },    async ({ id }) => {
        try {
          // Only authenticate when tool is actually invoked
          await authenticateWhenNeeded();
          
          const doc = await getDocument(id);
          
          return {
            content: [
              {
                type: 'text',
                text: `đź“„ **${doc.title}**\n\n` +
                      `**ID:** ${doc.id}\n` +
                      `**Source:** ${doc.metadata?.source || 'Unknown'}\n` +
                      `**Domain:** ${doc.metadata?.domain || 'Unknown'}\n` +
                      `**Word Count:** ${doc.metadata?.wordCount || 'Unknown'}\n` +
                      `**Created:** ${new Date(doc.created).toLocaleString()}\n` +
                      `${doc.updated ? `**Updated:** ${new Date(doc.updated).toLocaleString()}\n` : ''}` +
                      `**URL:** ${doc.metadata?.url || 'N/A'}\n` +
                      `${doc.metadata?.description ? `**Description:** ${doc.metadata.description}\n` : ''}` +
                      `\n**Content:**\n${doc.content}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `❌ Error: ${error.message}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • The helper function `getDocument` that executes the core logic of retrieving a single document from PocketBase.
    async function getDocument(id) {
      try {
        await authenticateWhenNeeded();
        
        if (!DOCUMENTS_COLLECTION) {
          initializeConfig();
        }
        
        const doc = await pb.collection(DOCUMENTS_COLLECTION).getOne(id);
        
        debugLog('Document retrieved from PocketBase', { id });
        return doc;
      } catch (error) {
        debugLog('Error getting document', { error: error.message, id });
        throw new Error(`Failed to retrieve document: ${error.message}`);
      }
    }
Behavior3/5

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

With no annotations provided, the description carries full disclosure burden. It adds valuable context that this retrieves 'full content' (implying complete payload vs. summaries), but omits error behavior (e.g., 404 handling), authentication requirements, and return format details expected for a read operation.

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

Conciseness4/5

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

Nine words with minimal waste. 'Specific' is slightly redundant with 'by ID' but helps emphasize single-item retrieval versus bulk operations. The structure front-loads the action and maintains readability.

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 low-complexity single-parameter retrieval tool, the description adequately covers the core operation. However, given the absence of output schema and annotations, it should disclose error conditions (e.g., 'returns error if document not found') to be complete.

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 coverage is 100% (the 'id' parameter is fully documented as 'Document ID to retrieve'). The description references 'by ID' but adds no additional semantic detail—such as ID format, where to obtain valid IDs, or validation rules—beyond what the schema explicitly states. Baseline 3 applies.

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 provides a clear verb ('Get'), resource ('document'), and scope ('by ID with full content'). The phrase 'by ID' effectively distinguishes this from siblings like search_documents (query-based) and list_documents (plural/enumeration), though it could explicitly contrast with extract_document.

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?

No explicit guidance on when to use this tool versus alternatives. While 'by ID' implies direct lookup when the identifier is known, the description fails to state when to prefer this over search_documents or handle cases where the ID is unknown.

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/DynamicEndpoints/documentation-mcp-using-pocketbase'

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