Skip to main content
Glama
jakedx6
by jakedx6

bulk_document_operations

Perform bulk operations on multiple documents including updating metadata, adding tags, changing visibility, archiving, or analyzing content in Helios-9 project management.

Instructions

Perform bulk operations on multiple documents

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idsYesArray of document IDs
operationYesOperation to perform
operation_dataNoData for the operation

Implementation Reference

  • The main execution handler for the bulk_document_operations tool. Parses arguments, loops through document_ids, performs the specified operation (update_metadata, add_tags, change_visibility, archive, analyze), collects results with success/failure status.
    export const bulkDocumentOperations = requireAuth(async (args: any) => { const { document_ids, operation, operation_data } = BulkDocumentOperationsSchema.parse(args) logger.info('Performing bulk document operations', { document_count: document_ids.length, operation }) const results = [] const now = new Date().toISOString() for (const document_id of document_ids) { try { let result switch (operation) { case 'update_metadata': // metadata field doesn't exist in the database schema result = await supabaseService.updateDocument(document_id, { updated_at: now }) break case 'add_tags': const doc = await supabaseService.getDocument(document_id) const existingTags = [] // metadata doesn't exist in the database schema const newTags = operation_data?.tags || [] // metadata field doesn't exist in the database schema result = await supabaseService.updateDocument(document_id, { updated_at: now }) break case 'change_visibility': // visibility field doesn't exist in the database schema result = await supabaseService.updateDocument(document_id, { updated_at: now }) break case 'archive': // status and metadata fields don't exist in the database schema result = await supabaseService.updateDocument(document_id, { updated_at: now }) break case 'analyze': result = await analyzeDocumentContent({ document_id, analysis_types: operation_data?.analysis_types || ['readability', 'completeness'], include_suggestions: true }) break default: throw new Error(`Unknown operation: ${operation}`) } results.push({ document_id, success: true, result }) } catch (error) { logger.error(`Failed operation ${operation} on document ${document_id}:`, error) results.push({ document_id, success: false, error: error instanceof Error ? error.message : 'Unknown error' }) } } return { operation, summary: { total_documents: document_ids.length, successful_operations: results.filter(r => r.success).length, failed_operations: results.filter(r => !r.success).length }, results } })
  • Zod validation schema for the tool's input parameters: document_ids (array of strings), operation (enum), and optional operation_data (object).
    const BulkDocumentOperationsSchema = z.object({ document_ids: z.array(z.string().min(1)).min(1), operation: z.enum(['update_metadata', 'add_tags', 'change_visibility', 'archive', 'analyze']), operation_data: z.record(z.any()).optional() })
  • MCPTool registration object defining the tool's name, description, and input schema for the MCP protocol.
    export const bulkDocumentOperationsTool: MCPTool = { name: 'bulk_document_operations', description: 'Perform bulk operations on multiple documents', inputSchema: { type: 'object', properties: { document_ids: { type: 'array', items: { type: 'string' }, description: 'Array of document IDs' }, operation: { type: 'string', enum: ['update_metadata', 'add_tags', 'change_visibility', 'archive', 'analyze'], description: 'Operation to perform' }, operation_data: { type: 'object', description: 'Data for the operation' } }, required: ['document_ids', 'operation'] } }
  • Registration of the bulkDocumentOperations handler in the documentHandlers object, mapping tool name to handler function.
    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 }
  • Export of all document tools including bulkDocumentOperationsTool for global tool registry.
    export const documentTools = { listDocumentsTool, createDocumentTool, getDocumentTool, updateDocumentTool, searchDocumentsTool, getDocumentContextTool, addDocumentCollaboratorTool, analyzeDocumentContentTool, getDocumentCollaborationTool, generateDocumentTemplateTool, bulkDocumentOperationsTool }

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/jakedx6/helios9-MCP-Server'

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