Skip to main content
Glama
VisActor
by VisActor

generate_polar_chart

Create polar charts (rose, radar, pie) to visualize numerical differences across categories using polar coordinates, with customizable dimensions, themes, and axis settings.

Instructions

Generate a polar chart (rose, radar, pie) to display numerical differences among different categories using radius and angle in polar coordinates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
angleAxisHasGridNoShow grid lines for the angle axis.
angleAxisHasLabelNoShow angle axis labels.
angleAxisHasTickNoShow angle axis ticks.
angleAxisTitleNoAngle axis title.
angleAxisTypeNoAngle axis type: categorical ('band') or continuous ('linear').
backgroundNoChart background color (hex). Optional, defaults to white.
categoryFieldYesDimension field. Must exist in the data.
chartThemeNoChart theme. Optional, defaults to 'light'.
chartTypeYes
colorFieldNoColor grouping field. Should not duplicate the dimension field.
colorsNoColor palette for chart elements.
dataTableYesData for the chart, e.g., [{ category: 'Category 01', value: 10 }].
heightNoChart height. Optional, defaults to 500.
outputNoChart output type. Defaults to 'image'.image
radiusAxisHasGridNoShow grid lines for the radius axis.
radiusAxisHasLabelNoShow radius axis labels.
radiusAxisHasTickNoShow radius axis ticks.
radiusAxisTitleNoRadius axis title.
radiusAxisTypeNoRadius axis type: categorical ('band') or continuous ('linear').
stackOrPercentNoStacking mode: 'stack' for stacked data, 'percent' for percentage stacking. Requires 'color' field.
subTitleNoChart subtitle text.
titleNoChart title text.
titleOrientNoTitle position in the chart.
transposeNo
valueFieldYesMeasure field. Must be numeric and exist in the data.
widthNoChart width. Optional, defaults to 500.

Implementation Reference

  • Generic MCP tool call handler for all chart generation tools. For 'generate_polar_chart', it resolves chartType to 'polar', validates input using the polar schema, calls generateChartByType('polar', args), and returns the chart output (spec, image, or HTML).
    server.setRequestHandler(CallToolRequestSchema, async request => { const toolName = request.params.name; const chartType = Object.keys(Charts).find( key => (Charts as any)[key].tool.name === toolName ); if (!chartType) { throw new McpError( ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}.` ); } try { // Validate input using Zod before generating chart const args = request.params.arguments || {}; // Select the appropriate schema based on the chart type const schema = Charts[chartType as keyof typeof Charts].schema; if (schema) { const result = schema.safeParse(args); if (!result.success) { throw new McpError( ErrorCode.InvalidParams, `Invalid parameters: ${result.error.message}` ); } } const res = await generateChartByType(chartType, args); if (res && (res as any).spec) { return { content: [ { type: 'text', text: JSON.stringify((res as any).spec, null, 2), }, ], }; } if (res && (res as any).image) { return { content: [ { type: 'text', text: (res as any).image, }, ], }; } if (res && (res as any).html) { return { content: [ { type: 'text', text: (res as any).html, }, ], }; } return { content: [ { type: 'text', text: 'Failed to generate chart', }, ], }; } catch (error: any) { if (error instanceof McpError) { throw error; } throw new McpError( ErrorCode.InternalError, `Failed to generate chart: ${error?.message || 'Unknown error.'}` ); } });
  • Zod schema defining the input parameters and validation for the generate_polar_chart tool.
    const schema = z.object({ output: ChartOutputSchema, width: WidthSchema, height: HeightSchema, dataTable: z .array(z.any()) .describe( "Data for the chart, e.g., [{ category: 'Category 01', value: 10 }]." ) .nonempty({ message: "Data must not be empty." }), chartType: z.enum(["rose", "radar", "pie"]), transpose: z.boolean().optional(), categoryField: XFieldSchema, valueField: YFieldSchema, colorField: ColorFieldSchema, chartTheme: ThemeSchema, title: TitleTextSchema, subTitle: TitleSubTextSchema, titleOrient: TitleOrientSchema, angleAxisTitle: AngleAxisTitleSchema, angleAxisHasGrid: AngleAxisHasGridSchema, angleAxisHasLabel: AngleAxisHasLabelSchema, angleAxisHasTick: AngleAxisHasTickSchema, angleAxisType: AngleAxisTypeSchema, radiusAxisHasGrid: RadiusAxisHasGridSchema, radiusAxisHasLabel: RadiusAxisHasLabelSchema, radiusAxisHasTick: RadiusAxisHasTickSchema, radiusAxisType: RadiusAxisTypeSchema, radiusAxisTitle: RadiusAxisTitleSchema, background: BackgroundSchema, colors: ColorsSchema, stackOrPercent: StackSchema, });
  • src/server.ts:34-38 (registration)
    Registration of all chart tools, including generate_polar_chart from Charts.polar.tool, for MCP listTools request.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: Object.values(Charts).map(chart => (chart as any).tool), }; });
  • Tool metadata definition (name, description, schema) and export for registration.
    const tool = { name: "generate_polar_chart", description: "Generate a polar chart (rose, radar, pie) to display numerical differences among different categories using radius and angle in polar coordinates.", inputSchema: convertZodToJsonSchema(schema), }; export const polar = { schema, tool, };

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/VisActor/vchart-mcp-server'

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