Skip to main content
Glama
DynamicEndpoints

Document Extractor MCP Server

connection_status

Check PocketBase connection status and configuration to verify the Document Extractor MCP Server's database connectivity for content storage and retrieval.

Instructions

Check the current PocketBase connection status and configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The connection_status tool handler in src/index.js, which checks the current PocketBase connection status and configuration.
    const connectionStatusTool = server.tool(
      'connection_status',
      'Check the current PocketBase connection status and configuration',
      {},
      async () => {
        try {
          // LAZY LOADING: Only initialize config when tool is actually invoked
          initializeConfig();
          
          // Get current environment settings (without revealing password)
          const pocketbaseUrl = process.env.POCKETBASE_URL || 'Not configured';
          const pocketbaseEmail = process.env.POCKETBASE_EMAIL || 'Not configured';
          const collection = DOCUMENTS_COLLECTION || 'documents';
          
          let connectionStatus = 'Not tested';
          let serverInfo = {};
          let authInfo = {};
          let errorDetails = '';
          
          // Test connection if credentials are available
          if (pocketbaseUrl !== 'Not configured' && pocketbaseEmail !== 'Not configured') {
            try {
              await authenticateWhenNeeded();
              connectionStatus = '✅ Connected';
              
              // Get server info
              if (pb && pb.authStore.isValid) {
                authInfo = {
                  email: pb.authStore.record?.email || 'Unknown',
                  id: pb.authStore.record?.id || 'Unknown',
                  avatar: pb.authStore.record?.avatar || 'None',
                  created: pb.authStore.record?.created ? new Date(pb.authStore.record.created).toLocaleString() : 'Unknown',
                  tokenValid: pb.authStore.isValid,
                  recordType: 'superuser'
                };
                
                // Try to get some basic server stats
                try {
                  const collections = await pb.collections.getList(1, 5);
                  const healthCheck = await pb.health.check();
                  
                  serverInfo.totalCollections = collections.totalItems;
                  serverInfo.sampleCollections = collections.items.map(c => c.name).slice(0, 3);
                  serverInfo.health = healthCheck?.message || 'Healthy';
                  serverInfo.version = healthCheck?.version || 'Unknown';
                } catch (e) {
                  serverInfo.error = 'Could not fetch server statistics: ' + e.message;
                }
                
                // Check if documents collection exists
                try {
                  const docsCollection = await pb.collections.getOne(collection);
                  serverInfo.documentsCollection = {
                    exists: true,
                    id: docsCollection.id,
                    created: new Date(docsCollection.created).toLocaleString(),
                    fieldsCount: docsCollection.schema?.length || 0
                  };
                } catch (e) {
                  serverInfo.documentsCollection = {
                    exists: false,
                    error: 'Collection not found - use "ensure_collection" tool to create it'
                  };
                }
              }
            } catch (error) {
              connectionStatus = `❌ Connection failed: ${error.message}`;
              errorDetails = `\n**Error Details:** ${error.message}`;
              
              if (error.message.includes('credentials not configured')) {
                errorDetails += '\n**Solution:** Use the "authenticate" tool to set up your credentials.';
              } else if (error.message.includes('Invalid credentials')) {
                errorDetails += '\n**Solution:** Check your email and password, then use the "authenticate" tool.';
              } else if (error.message.includes('Cannot connect')) {
                errorDetails += '\n**Solution:** Verify PocketBase server URL and ensure it\'s running.';
              }
            }
          }
          
          // Build status report
          let statusReport = `🔌 **PocketBase Connection Status**\n\n` +
                            `**Configuration:**\n` +
                            `- Server URL: ${pocketbaseUrl}\n` +
                            `- Admin Email: ${pocketbaseEmail}\n` +
                            `- Password: ${process.env.POCKETBASE_PASSWORD ? '✅ Configured' : '❌ Not configured'}\n` +
                            `- Default Collection: ${collection}\n\n` +
                            `**Connection Status:** ${connectionStatus}`;
          
          if (errorDetails) {
            statusReport += errorDetails;
          }
          
          if (authInfo.email) {
            statusReport += `\n\n**Authentication Details:**\n` +
                           `- Email: ${authInfo.email}\n` +
                           `- Admin ID: ${authInfo.id}\n` +
                           `- Account Created: ${authInfo.created}\n` +
                           `- Avatar: ${authInfo.avatar}\n` +
                           `- Token Valid: ${authInfo.tokenValid}\n` +
                           `- Account Type: ${authInfo.recordType}`;
          }
          
          if (serverInfo.totalCollections) {
            statusReport += `\n\n**Server Statistics:**\n` +
                           `- Server Health: ${serverInfo.health}\n` +
                           `- Total Collections: ${serverInfo.totalCollections}\n` +
                           `- Sample Collections: ${serverInfo.sampleCollections?.join(', ') || 'None'}`;
            
            if (serverInfo.documentsCollection) {
              const docCol = serverInfo.documentsCollection;
              statusReport += `\n\n**Documents Collection:**\n` +
                             `- Exists: ${docCol.exists ? 'Yes' : 'No'}`;
              if (docCol.exists) {
                statusReport += `\n- Collection ID: ${docCol.id}\n` +
                               `- Created: ${docCol.created}\n` +
                               `- Schema Fields: ${docCol.fieldsCount}`;
              } else {
                statusReport += `\n- Status: ${docCol.error}`;
              }
            }
          }
          
          if (serverInfo.error) {
            statusReport += `\n\n**Server Info:** ${serverInfo.error}`;
          }
          
          statusReport += `\n\n**Available Tools:**\n` +
                         `- \`authenticate\`: Test/update PocketBase credentials\n` +
                         `- \`ensure_collection\`: Create documents collection if needed\n` +
                         `- \`collection_info\`: Get detailed collection statistics\n` +
                         `- \`extract_document\`: Extract and store documents from URLs\n` +
                         `- \`list_documents\`: List stored documents with pagination\n` +
                         `- \`search_documents\`: Search document content\n` +
                         `- \`get_document\`: Retrieve specific document by ID\n` +
                         `- \`delete_document\`: Remove a document from storage`;
          
          return {
            content: [
              {
                type: 'text',
                text: statusReport
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `❌ Error checking connection status: ${error.message}\n\n` +
                      `**Troubleshooting:**\n` +
                      `- Use the 'authenticate' tool to set up your PocketBase credentials\n` +
                      `- Verify your PocketBase server is running and accessible\n` +
                      `- Check the server URL format (include http:// or https://)`
              }
            ],
            isError: true
          };
        }
      }
    );
Behavior3/5

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

No annotations provided, so description carries full burden. 'Check' implies read-only/idempotent behavior, but description lacks disclosure of return format, error states when disconnected, or whether this operation itself can fail/timeout.

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?

Single sentence of appropriate length. Front-loaded with verb 'Check'. No redundancy or filler. Efficiently communicates scope without verbosity.

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?

No output schema exists, yet description only hints at return content ('status and configuration') without elaborating structure or key fields. For a diagnostic tool, adequate but gap remains regarding what specific status values/config keys are returned.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Zero parameters present, meeting baseline expectation. Schema is empty object with 100% coverage (trivially). Description correctly implies no filtering or input is needed.

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?

Uses specific verb 'Check' with clear resource 'PocketBase connection status and configuration'. Mentions 'PocketBase' which distinguishes from generic connection tools, though could explicitly contrast with sibling 'authenticate' (which establishes sessions vs. this which queries state).

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?

Provides no guidance on when to invoke (e.g., before other operations vs. troubleshooting) or prerequisites. No mention of when to prefer over 'authenticate' or how it relates to the connection lifecycle.

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