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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:672-710 (handler)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); } } ); - server.js:147-162 (helper)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}`); } }