list_documents
Retrieve documents from Helios-9 projects with filtering options for project ID, document type, and search terms to manage project documentation efficiently.
Instructions
List documents with optional filtering by project or document type
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Filter documents by project ID | |
| document_type | No | Filter documents by type | |
| search | No | Search documents by title or content | |
| limit | No | Maximum number of documents to return |
Implementation Reference
- src/tools/documents.ts:87-114 (handler)The handler function for list_documents tool. Parses input using Zod schema, fetches documents via supabaseService.getDocuments with filters, computes analytics, and returns documents list with analytics.export const listDocuments = requireAuth(async (args: any) => { const { project_id, document_type, search, limit } = ListDocumentsSchema.parse(args) logger.info('Listing documents', { project_id, document_type, search, limit }) const documents = await supabaseService.getDocuments( { project_id, type: document_type, search }, { limit }, { field: 'updated_at', order: 'desc' } ) // Add document analytics const documentAnalytics = { total_documents: documents.length, document_types: documents.reduce((acc, doc) => { acc[doc.document_type] = (acc[doc.document_type] || 0) + 1 return acc }, {} as Record<string, number>), ai_ready_count: 0, // Metadata not available in current schema average_content_length: documents.reduce((sum, doc) => sum + doc.content.length, 0) / (documents.length || 1) } return { documents, analytics: documentAnalytics, filters_applied: { project_id, document_type, search } } })
- src/tools/documents.ts:18-23 (schema)Zod schema for validating input parameters to the list_documents tool: project_id, document_type, search, limit.const ListDocumentsSchema = z.object({ project_id: z.string().uuid().optional(), document_type: z.enum(['requirement', 'design', 'technical', 'meeting_notes', 'other']).optional(), search: z.string().optional(), limit: z.number().int().positive().max(100).default(20) })
- src/tools/documents.ts:56-85 (registration)MCPTool registration definition for list_documents, including name, description, and JSON inputSchema mirroring the Zod schema.export const listDocumentsTool: MCPTool = { name: 'list_documents', description: 'List documents with optional filtering by project or document type', inputSchema: { type: 'object', properties: { project_id: { type: 'string', format: 'uuid', description: 'Filter documents by project ID' }, document_type: { type: 'string', enum: ['requirement', 'design', 'technical', 'meeting_notes', 'other'], description: 'Filter documents by type' }, search: { type: 'string', description: 'Search documents by title or content' }, limit: { type: 'number', minimum: 1, maximum: 100, default: 20, description: 'Maximum number of documents to return' } } } }
- src/tools/documents.ts:1346-1357 (registration)Maps the tool name 'list_documents' to its handler function listDocuments in the documentHandlers object, which is imported and spread into the main allHandlers in src/index.ts.export const documentHandlers = { list_documents: listDocuments, create_document: createDocument, get_document: getDocument, update_document: updateDocument, search_documents: searchDocuments, get_document_context: getDocumentContext, add_document_collaborator: addDocumentCollaborator, analyze_document_content: analyzeDocumentContent, get_document_collaboration: getDocumentCollaboration, generate_document_template: generateDocumentTemplate, bulk_document_operations: bulkDocumentOperations
- src/index.ts:143-155 (registration)Combines all module handlers including documentHandlers (containing list_documents) into the central allHandlers object used for tool execution in the MCP server.this.allHandlers = { ...projectHandlers, ...taskHandlers, ...documentHandlers, ...conversationHandlers, ...contextAggregationHandlers, ...workflowAutomationHandlers, ...intelligentSearchHandlers, ...analyticsInsightsHandlers, ...initiativeHandlers, ...promptToProjectTools.reduce((acc, tool) => ({ ...acc, [tool.name]: tool.handler }), {}), ...debugHandlers, }