dhis2_export_for_composition
Export DHIS2 operation results in a format compatible with other MCP servers for data sharing and integration.
Instructions
Export the result of a DHIS2 operation in a format suitable for other MCP servers
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| toolName | Yes | Name of the tool whose result should be exported | |
| data | Yes | Data to export (usually the result of a previous tool call) | |
| targetServer | No | Target MCP server name (optional) | |
| metadata | No | Additional metadata to include (optional) |
Implementation Reference
- src/index.ts:1686-1739 (handler)Handler for the 'dhis2_export_for_composition' tool. Processes input arguments, calls multiServerComposition.exportDataForComposition to generate standardized export context, logs the operation, and returns formatted response with JSON export data.case 'dhis2_export_for_composition': const exportArgs = args as { toolName: string; data: any; targetServer?: string; metadata?: Record<string, any>; }; const exportContext = multiServerComposition.exportDataForComposition( exportArgs.toolName, exportArgs.data, { targetServer: exportArgs.targetServer, ...exportArgs.metadata } ); auditLogger.log({ toolName: name, parameters: exportArgs, outcome: 'success', dhis2Instance: dhis2Client?.baseURL, userId: currentUser?.username, executionTime: Date.now() - startTime, resourcesAffected: [exportArgs.toolName] }); return { content: [{ type: 'text', text: `š¤ Data Exported for Multi-Server Composition **Export Details:** ⢠Source Tool: ${exportArgs.toolName} ⢠Timestamp: ${exportContext.timestamp} ⢠Target Server: ${exportArgs.targetServer || 'Any compatible server'} ⢠Operation Type: ${exportContext.operationType} **Standardized Export Format:** \`\`\`json ${JSON.stringify(exportContext, null, 2)} \`\`\` **Compatible Servers:** ${multiServerComposition.getCompatibleServers().map(s => s.name).join(', ') || 'None registered'} **Next Steps:** ⢠Share this exported data with other MCP servers ⢠Use the standardized format for workflow automation ⢠Check server documentation for import procedures š” **Integration Tip:** This format is designed to work seamlessly with GitHub, Slack, Database, and other MCP servers.` }] };
- Core helper function that creates a standardized CrossServerContext object for exporting DHIS2 tool results to other MCP servers in composition mode.exportDataForComposition(toolName: string, result: any, metadata: Record<string, any> = {}): CrossServerContext { return this.createCrossServerContext( this.serverInfo.name, result, 'export', { toolName, ...metadata } ); }