Skip to main content
Glama
DynamicEndpoints

Document Extractor MCP Server

collection_info

Retrieve statistics and details about extracted document collections to monitor content volume, track metadata, and manage organized documentation storage.

Instructions

Get detailed information about the documents collection including statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration and handler logic for the 'collection_info' tool in server.js.
    server.tool(
      'collection_info',
      'Get detailed information about the documents collection including statistics',
      {},
      async () => {
        try {
          await authenticateWhenNeeded();
          
          const info = await getCollectionInfo();
          
          const schemaInfo = info.collection.schema?.map(field => 
            `- **${field.name}** (${field.type})${field.required ? ' *required*' : ''}`
          ).join('\n') || 'No schema information available';
          
          return {
            content: [{
              type: 'text',
              text: `📊 **Collection Information: ${info.collection.name}**\n\n` +
                    `**Basic Details:**\n` +
                    `- ID: ${info.collection.id}\n` +
                    `- Name: ${info.collection.name}\n` +
                    `- Type: ${info.collection.type}\n` +
                    `- Created: ${new Date(info.collection.created).toLocaleString()}\n` +
                    `- Updated: ${new Date(info.collection.updated).toLocaleString()}\n\n` +
                    `**Statistics:**\n` +
                    `- Total Records: ${info.totalRecords}\n` +
                    `- Total Pages: ${info.totalPages}\n` +
                    `- Records Per Page: ${info.recordsPerPage}\n\n` +
                    `**Schema Fields:**\n${schemaInfo}\n\n` +
                    `**Indexes:**\n${info.collection.indexes?.length ? 
                      info.collection.indexes.map(idx => `- ${idx}`).join('\n') : 
                      'No custom indexes defined'}`
            }]
          };
        } catch (error) {
          return toolErrorHandler(error);
        }
      }
    );
  • Helper function to fetch collection metadata and statistics from PocketBase.
    async function getCollectionInfo() {
      await authenticateWhenNeeded();
      try {
        const collection = await pb.collections.getOne(DOCUMENTS_COLLECTION);
        const stats = await pb.collection(DOCUMENTS_COLLECTION).getList(1, 1);
        return {
          collection,
          totalRecords: stats.totalItems,
          recordsPerPage: stats.perPage,
          totalPages: stats.totalPages
        };
      } catch (error) {
        debugLog('❌ Error getting collection info', { error: error.message });
        throw new Error(`Failed to get collection info: ${error.message}`);
      }
    }

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