dhis2_generate_app_runtime_config
Generate integration configuration for DHIS2 App Runtime. Specify app name, API version, and features like data query, offline capabilities, and PWA to streamline app development.
Instructions
Generate configuration for DHIS2 App Runtime integration
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiVersion | No | DHIS2 API version to target (e.g., 40 for 2.40) | |
| appName | Yes | Name of the application | |
| errorBoundary | No | Include error boundary component | |
| features | No | ||
| loadingMask | No | Include loading mask component |
Implementation Reference
- src/webapp-generators.ts:350-397 (handler)The main handler function that generates DHIS2 App Runtime configuration code snippets, including DataProvider setup, query/mutation examples, alerts, offline config, etc. This is the core logic executed when the tool is called.export function generateAppRuntimeConfig(args: any): string { const { apiVersion = 40, appName, features = {}, errorBoundary = true, loadingMask = true } = args; return `# DHIS2 App Runtime Configuration ## Provider Setup \`\`\`jsx import { DataProvider } from '@dhis2/app-runtime'; import { CssReset } from '@dhis2/ui'; const config = { baseUrl: process.env.REACT_APP_DHIS2_BASE_URL, apiVersion: ${apiVersion} }; function App() { return ( <DataProvider config={config}> <CssReset /> ${errorBoundary ? '<ErrorBoundary>' : ''} ${loadingMask ? '<LoadingMask>' : ''} <${appName}App /> ${loadingMask ? '</LoadingMask>' : ''} ${errorBoundary ? '</ErrorBoundary>' : ''} </DataProvider> ); } \`\`\` ${features.dataQuery ? generateDataQueryExamples() : ''} ${features.dataMutation ? generateDataMutationExamples() : ''} ${features.alerts ? generateAlertsExample() : ''} ${features.offline ? generateOfflineExample() : ''} ${features.pwa ? generatePWAExample() : ''} ## Configuration Options \`\`\`javascript const config = { baseUrl: 'https://your-dhis2-instance.com', apiVersion: ${apiVersion}, timeout: 30000, retries: 3, headers: { 'X-Requested-With': 'XMLHttpRequest' } }; \`\`\` `;
- src/index.ts:1009-1019 (registration)The tool dispatch/registration in the main server request handler. Maps the tool name to the generateAppRuntimeConfig function call and formats the response.case 'dhis2_generate_app_runtime_config': const runtimeConfigArgs = args as any; const runtimeConfig = generateAppRuntimeConfig(runtimeConfigArgs); return { content: [ { type: 'text', text: runtimeConfig, }, ], };
- src/permission-system.ts:137-137 (registration)Permission mapping for the tool in TOOL_PERMISSIONS Map. Requires 'canConfigureApps' permission to execute.['dhis2_generate_app_runtime_config', 'canConfigureApps'],