Skip to main content
Glama
Raistlin82

SAP OData to MCP Server

by Raistlin82

UI Dashboard Composer

ui-dashboard-composer

Create comprehensive KPI dashboards with charts and real-time data from SAP systems to visualize business metrics and monitor performance.

Instructions

Creates comprehensive KPI dashboards with charts and real-time data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dashboardTitleYesTitle for the dashboard
widgetsYesDashboard widget configurations
layoutNoDashboard layout style

Implementation Reference

  • Registers the 'ui-dashboard-composer' tool with the MCP server, specifying title, detailed description, input schema, and the handler function that delegates to handleDashboardComposition.
        public async register(): Promise<void> {
            this.mcpServer.registerTool(
                "ui-dashboard-composer",
                {
                    title: "UI Dashboard Composer",
                    description: `Create interactive KPI dashboards with widgets, charts, and real-time updates.
    
    Features:
    - Multiple widget types (KPI cards, charts, tables, gauges, timelines)
    - Flexible grid-based layout system
    - Real-time data refresh and updates
    - Interactive filters and drill-down capabilities
    - Chart.js integration for advanced visualizations
    - Export to PDF, Excel, PowerPoint, and images
    - Responsive design for mobile and desktop
    - SAP Fiori design language compliance
    - Custom aggregations and calculations
    - WebSocket support for live data
    
    Required scope: ui.dashboards
    
    Widget Types:
    - kpi-card: Key performance indicator cards
    - chart: Bar, line, pie, doughnut, and radar charts
    - table: Data tables with sorting and filtering
    - list: Simple list displays
    - gauge: Circular and linear progress gauges
    - timeline: Event timelines and process flows
    - map: Geographic data visualization
    - custom: Custom HTML/JavaScript widgets
    
    Examples:
    - Sales dashboard: {"title": "Sales Overview", "widgets": [...]}
    - Executive summary: {"title": "Executive KPIs", "layout": {"type": "grid", "columns": 3}}
    - Real-time monitoring: {"refreshInterval": 30, "widgets": [...]}`,
                    inputSchema: UIDashboardComposerSchema
                },
                async (args: Record<string, unknown>) => {
                    return await this.handleDashboardComposition(args);
                }
            );
    
            this.logger.info("✅ UI Dashboard Composer tool registered successfully");
        }
  • Comprehensive Zod input schema defining all parameters for dashboard configuration including layout, widgets, data sources, filters, theme, and export options.
    const UIDashboardComposerSchema = {
        title: z.string().describe("Dashboard title"),
        description: z.string().optional().describe("Dashboard description"),
        layout: z.object({
            type: z.enum(['grid', 'flexbox', 'absolute']).describe("Layout type"),
            columns: z.number().min(1).max(12).optional().describe("Number of columns for grid layout"),
            gap: z.string().optional().describe("Gap between widgets (e.g., '1rem')"),
            responsive: z.boolean().optional().describe("Enable responsive design")
        }).describe("Dashboard layout configuration"),
        widgets: z.array(z.object({
            id: z.string().describe("Unique widget identifier"),
            type: z.enum(['kpi-card', 'chart', 'table', 'list', 'gauge', 'timeline', 'map', 'custom']).describe("Widget type"),
            title: z.string().describe("Widget title"),
            position: z.object({
                row: z.number().min(0).describe("Grid row position"),
                col: z.number().min(0).describe("Grid column position"),
                width: z.number().min(1).max(12).describe("Widget width (grid columns)"),
                height: z.number().min(1).describe("Widget height (grid rows)")
            }).describe("Widget position and size"),
            config: z.record(z.any()).optional().describe("Widget-specific configuration"),
            dataSource: z.object({
                entitySet: z.string().describe("SAP entity set for data"),
                query: z.object({
                    filter: z.string().optional(),
                    select: z.string().optional(),
                    orderby: z.string().optional(),
                    top: z.number().optional()
                }).optional().describe("OData query parameters"),
                aggregation: z.object({
                    groupBy: z.array(z.string()).optional().describe("Fields to group by"),
                    measures: z.array(z.object({
                        field: z.string(),
                        operation: z.enum(['sum', 'avg', 'count', 'min', 'max'])
                    })).optional().describe("Aggregation measures")
                }).optional().describe("Data aggregation configuration"),
                refresh: z.number().optional().describe("Refresh interval in seconds")
            }).describe("Data source configuration")
        })).describe("Dashboard widgets"),
        datasources: z.array(z.object({
            id: z.string().describe("Data source identifier"),
            entitySet: z.string().describe("SAP entity set"),
            query: z.string().optional().describe("Custom OData query"),
            cacheTtl: z.number().optional().describe("Cache TTL in seconds"),
            transform: z.string().optional().describe("Data transformation function name")
        })).optional().describe("Shared data sources"),
        refreshInterval: z.number().min(5).max(3600).optional().describe("Global refresh interval in seconds"),
        theme: z.enum(['sap_horizon', 'sap_fiori_3', 'dark', 'light']).optional().describe("Dashboard theme"),
        filters: z.array(z.object({
            field: z.string().describe("Filter field name"),
            label: z.string().describe("Filter display label"),
            type: z.enum(['select', 'daterange', 'text', 'number']).describe("Filter type"),
            options: z.array(z.object({
                value: z.string(),
                label: z.string()
            })).optional().describe("Options for select filters"),
            defaultValue: z.any().optional().describe("Default filter value")
        })).optional().describe("Global dashboard filters"),
        exportOptions: z.object({
            pdf: z.boolean().optional(),
            excel: z.boolean().optional(),
            powerpoint: z.boolean().optional(),
            image: z.boolean().optional()
        }).optional().describe("Export format options")
    };
  • Core handler function that parses input, checks authorization, validates and prepares widgets/data, generates dashboard layout and UI using component library, enhances with SAP styles/scripts, and returns markdown summary with JSON resource containing full dashboard config.
    private async handleDashboardComposition(args: unknown): Promise<any> {
        try {
            // Validate input parameters
            const params = z.object(UIDashboardComposerSchema).parse(args);
    
            this.logger.info(`📊 Generating dashboard: ${params.title} with ${params.widgets.length} widgets`);
    
            // Check authentication and authorization
            const authCheck = await this.checkUIAccess('ui.dashboards');
            if (!authCheck.hasAccess) {
                return {
                    content: [{
                        type: "text",
                        text: `❌ Authorization denied: ${authCheck.reason || 'Access denied for UI dashboard generation'}\n\nRequired scope: ui.dashboards`
                    }]
                };
            }
    
            // Step 1: Validate and prepare widget configurations
            const validatedWidgets = await this.validateAndPrepareWidgets(params.widgets);
    
            // Step 2: Prepare data sources
            const dataSources = await this.prepareDashboardDataSources(validatedWidgets, params.datasources);
    
            // Step 3: Create dashboard layout
            const layoutDefinition: LayoutDefinition = {
                type: params.layout.type,
                config: {
                    columns: params.layout.columns || 4,
                    gap: params.layout.gap || '1rem',
                    responsive: params.layout.responsive !== false ? {
                        breakpoints: {
                            mobile: { columns: 1, gap: '0.5rem' },
                            tablet: { columns: 2, gap: '1rem' },
                            desktop: { columns: 4, gap: '1rem' }
                        }
                    } : undefined
                },
                components: this.createWidgetComponents(validatedWidgets)
            };
    
            // Step 4: Create dashboard configuration
            const dashboardConfig: DashboardConfig = {
                layout: layoutDefinition,
                widgets: validatedWidgets,
                datasources: dataSources,
                refreshInterval: params.refreshInterval || 60,
                theme: params.theme || 'sap_horizon'
            };
    
            // Step 5: Generate dashboard UI
            const dashboardResult = await this.componentLibrary.generateDashboard(dashboardConfig);
    
            // Step 6: Add SAP-specific enhancements
            const enhancedResult = await this.enhanceDashboardResult(dashboardResult, params);
    
            // Step 7: Prepare response
            const response = this.createDashboardResponse(enhancedResult, params, dataSources);
    
            this.logger.info(`✅ Dashboard '${params.title}' generated successfully`);
    
            return {
                content: [
                    {
                        type: "text",
                        text: `# ${params.title}\n\n` +
                              `${params.description || 'Interactive SAP dashboard with real-time KPIs'}\n\n` +
                              `## Dashboard Overview:\n` +
                              `- Widgets: ${params.widgets.length}\n` +
                              `- Layout: ${params.layout.type} (${params.layout.columns || 4} columns)\n` +
                              `- Theme: ${params.theme || 'sap_horizon'}\n` +
                              `- Refresh: Every ${params.refreshInterval || 60} seconds\n` +
                              `- Filters: ${params.filters?.length || 0}\n\n` +
                              `## Widget Types:\n` +
                              params.widgets.map(w => `- ${w.type}: ${w.title}`).join('\n') + '\n\n' +
                              `## Data Sources:\n` +
                              `- Entity Sets: ${Array.from(new Set(params.widgets.map(w => w.dataSource.entitySet))).join(', ')}\n` +
                              `- Real-time Updates: ${params.refreshInterval ? '✅' : '❌'}\n\n` +
                              `## Features:\n` +
                              `- Export Options: ${Object.entries(params.exportOptions || {}).filter(([k, v]) => v).map(([k]) => k.toUpperCase()).join(', ') || 'Basic'}\n` +
                              `- Responsive Design: ✅\n` +
                              `- Interactive Filters: ${params.filters?.length ? '✅' : '❌'}\n\n` +
                              `Embed this dashboard in your SAP application or use via MCP client.`
                    },
                    {
                        type: "resource",
                        data: response,
                        mimeType: "application/json"
                    }
                ]
            };
    
        } catch (error) {
            this.logger.error(`❌ Failed to generate dashboard`, error as Error);
            return {
                content: [{
                    type: "text",
                    text: `❌ Failed to generate dashboard: ${(error as Error).message}`
                }]
            };
        }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'creates' (implying a write operation) and 'real-time data,' but lacks details on permissions, side effects, error handling, or response format. For a creation tool with zero annotation coverage, this is insufficient to ensure safe and effective use by an agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core functionality. It avoids redundancy and wastes no words, making it easy to parse quickly. Every part of the sentence contributes to understanding the tool's purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of creating dashboards with multiple parameters and no output schema, the description is incomplete. It lacks behavioral details (e.g., permissions, side effects), usage context, and output information. With no annotations and rich sibling tools, this leaves significant gaps for an agent to operate effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter-specific information beyond what's in the schema. However, schema description coverage is 100%, with clear descriptions for 'dashboardTitle,' 'widgets,' and 'layout,' including enums for 'layout' and widget 'type.' The baseline score of 3 is appropriate since the schema adequately documents parameters, though the description doesn't enhance understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Creates comprehensive KPI dashboards with charts and real-time data.' It specifies the verb ('creates') and resource ('KPI dashboards'), and mentions key features ('charts and real-time data'). However, it doesn't explicitly differentiate from sibling tools like 'kpi-dashboard-builder' or 'ui-report-builder,' which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools like 'kpi-dashboard-builder,' 'ui-report-builder,' and 'business-intelligence-insights,' there's no indication of context, prerequisites, or exclusions. The description only states what it does, not when it's appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Raistlin82/btp-sap-odata-to-mcp-server-optimized'

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