[Sprint 1] feat: Implement chart tools (2 tools) #173

Closed
opened 2026-01-26 16:20:43 +00:00 by lmiranda · 1 comment
Owner

Description

Implement Plotly-based chart creation tools for data visualization.

Acceptance Criteria

  • Create mcp_server/chart_tools.py
  • Implement chart_create tool:
    • Input: chart_type: string, data: object, options?: object
    • Supported types: line, bar, scatter, pie, heatmap, histogram
    • Data can be inline JSON or reference from data-platform
    • Output: Plotly figure JSON
  • Implement chart_configure_interaction tool:
    • Input: figure_ref: string, interactions: object
    • Add hover templates, click callbacks config, selection behavior
    • Output: Updated figure JSON
  • Both tools registered in server.py
  • Theme tokens automatically applied to charts (if theme loaded)

Technical Notes

# Example chart_create input
{
  "chart_type": "bar",
  "data": {
    "x": ["A", "B", "C"],
    "y": [10, 20, 15]
  },
  "options": {
    "title": "Sales by Region",
    "color": "primary"  # Uses theme token
  }
}

Dependencies

  • Depends on #170 (MCP server foundation)
## Description Implement Plotly-based chart creation tools for data visualization. ## Acceptance Criteria - [ ] Create `mcp_server/chart_tools.py` - [ ] Implement `chart_create` tool: - Input: `chart_type: string, data: object, options?: object` - Supported types: line, bar, scatter, pie, heatmap, histogram - Data can be inline JSON or reference from data-platform - Output: Plotly figure JSON - [ ] Implement `chart_configure_interaction` tool: - Input: `figure_ref: string, interactions: object` - Add hover templates, click callbacks config, selection behavior - Output: Updated figure JSON - [ ] Both tools registered in server.py - [ ] Theme tokens automatically applied to charts (if theme loaded) ## Technical Notes ```python # Example chart_create input { "chart_type": "bar", "data": { "x": ["A", "B", "C"], "y": [10, 20, 15] }, "options": { "title": "Sales by Region", "color": "primary" # Uses theme token } } ``` ## Dependencies - Depends on #170 (MCP server foundation)
Author
Owner

Completed: Chart tools implemented.

Tools Added:

  1. chart_create - Create Plotly charts (line, bar, scatter, pie, heatmap, histogram, area)
  2. chart_configure_interaction - Configure hover, click data, selection, zoom

Features:

  • Theme color integration when theme is active
  • Default Mantine-based color palette
  • Donut chart support via donut: true option
  • Horizontal bar charts via horizontal: true
  • Axis labels and titles

Test Results:

  • Bar, line, pie charts created correctly
  • Invalid chart type returns helpful error
  • Interactions: click_data, selection:box, zoom:disabled configured

Commit: c91f21f

Completed: Chart tools implemented. **Tools Added:** 1. `chart_create` - Create Plotly charts (line, bar, scatter, pie, heatmap, histogram, area) 2. `chart_configure_interaction` - Configure hover, click data, selection, zoom **Features:** - Theme color integration when theme is active - Default Mantine-based color palette - Donut chart support via `donut: true` option - Horizontal bar charts via `horizontal: true` - Axis labels and titles **Test Results:** - Bar, line, pie charts created correctly - Invalid chart type returns helpful error - Interactions: click_data, selection:box, zoom:disabled configured **Commit:** c91f21f
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: personal-projects/leo-claude-mktplace#173