Skip to main content
Glama
VisActor

vchart-mcp-server

Official
by VisActor

generate_wordcloud_venn

Create word clouds to visualize word frequency or Venn diagrams to show set relationships and intersections from your data.

Instructions

Generate a word cloud to visualize word frequency or importance, or a Venn diagram to show relationships such as intersections and unions between sets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outputNoChart output type. Defaults to 'image'.image
widthNoChart width. Optional, defaults to 500.
heightNoChart height. Optional, defaults to 500.
chartTypeYes
dataTableYesData for the chart, e.g., [{ word: 'TEST', value: 10 }].
colorFieldYesSpecifies the field in the dataset that represents each word (for word clouds) or the set (for Venn diagrams). For Venn diagrams, use a comma-separated string to describe the set. This field must exist in the dataset.
valueFieldYesSpecifies the field representing the metric value. Required for Venn diagrams.
chartThemeNoChart theme. Optional, defaults to 'light'.
titleNoChart title text.
subTitleNoChart subtitle text.
titleOrientNoTitle position in the chart.
backgroundNoChart background color (hex). Optional, defaults to white.
colorsNoColor palette for chart elements.

Implementation Reference

  • MCP call_tool request handler that implements execution for all chart tools by mapping the tool name to the corresponding chart module ("wordcloud_venn" for generate_wordcloud_venn), validating inputs with the schema, and calling generateChartByType.
    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 input schema definition for the generate_wordcloud_venn tool, including parameters for data, fields, dimensions, styling, and chart type (wordcloud or venn).
    const schema = z.object({
      output: ChartOutputSchema, // Output format/schema for the chart
      width: WidthSchema, // Chart width
      height: HeightSchema, // Chart height
      chartType: z.enum(["wordcloud", "venn"]),
    
      dataTable: z
        .array(z.any())
        .describe("Data for the chart, e.g., [{ word: 'TEST', value: 10 }].")
        .nonempty({ message: "data cannot be empty." }), // Data array must not be empty
    
      colorField: z
        .string()
        .nonempty({ message: "The field for words or sets cannot be empty." })
        .describe(
          "Specifies the field in the dataset that represents each word (for word clouds) or the set (for Venn diagrams). For Venn diagrams, use a comma-separated string to describe the set. This field must exist in the dataset."
        ),
    
      valueField: z
        .string()
        .describe(
          "Specifies the field representing the metric value. Required for Venn diagrams."
        ),
    
      chartTheme: ThemeSchema, // Chart theme
      title: TitleTextSchema, // Chart title
      subTitle: TitleSubTextSchema, // Chart subtitle
      titleOrient: TitleOrientSchema, // Title orientation
    
      background: BackgroundSchema, // Chart background
      colors: ColorsSchema, // Chart colors
    });
  • src/server.ts:34-38 (registration)
    MCP list_tools request handler that registers all chart tools, including generate_wordcloud_venn, by returning their tool definitions from the Charts modules.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: Object.values(Charts).map(chart => (chart as any).tool),
      };
    });
  • Tool metadata definition (name, description, inputSchema) and export as wordcloud_venn module for use in Charts namespace.
    const tool = {
      name: "generate_wordcloud_venn",
      description:
        "Generate a word cloud to visualize word frequency or importance, or a Venn diagram to show relationships such as intersections and unions between sets.",
      inputSchema: convertZodToJsonSchema(schema),
    };
    
    export const wordcloud_venn = {
      schema,
      tool,
    };
  • Core chart generation utility function called by the handler, processes input options into VChart spec using generateChart from @visactor/generate-vchart library, renders to image/html/spec based on chartType (wordcloud_venn here) and handles axis, title, data field mapping.
    export async function generateChartByType(chartType: string, options: any) {
      const {
        title,
        subTitle,
        titleOrient,
        xAxisType,
        xAxisOrient,
        xAxisTitle,
        xAxisHasGrid,
        xAxisHasLabel,
        xAxisHasTick,
    
        yAxisType,
        yAxisOrient,
        yAxisTitle,
        yAxisHasGrid,
        yAxisHasLabel,
        yAxisHasTick,
    
        leftYAxisTitle,
        leftYAxisHasGrid,
        leftYAxisHasLabel,
        leftYAxisHasTick,
    
        rightYAxisTitle,
        rightYAxisHasGrid,
        rightYAxisHasLabel,
        rightYAxisHasTick,
    
        angleAxisTitle,
        angleAxisHasGrid,
        angleAxisHasLabel,
        angleAxisHasTick,
        angleAxisType,
    
        radiusAxisHasGrid,
        radiusAxisHasLabel,
        radiusAxisHasTick,
        radiusAxisType,
        radiusAxisTitle,
    
        output,
        width,
        height,
        ...res
      } = options;
    
      const opts = { ...res };
      const titleObj = filterValidAttributes({
        text: title,
        subText: subTitle,
        orient: titleOrient,
      });
      const xAxisObj = filterValidAttributes({
        type: xAxisType,
        orient: xAxisOrient,
        title: xAxisTitle,
        hasGrid: xAxisHasGrid,
        hasLabel: xAxisHasLabel,
        hasTick: xAxisHasTick,
      });
      const yAxisObj = filterValidAttributes({
        type: yAxisType,
        orient: yAxisOrient,
        title: yAxisTitle,
        hasGrid: yAxisHasGrid,
        hasLabel: yAxisHasLabel,
        hasTick: yAxisHasTick,
      });
      const leftYAxisObj = filterValidAttributes({
        title: leftYAxisTitle,
        hasGrid: leftYAxisHasGrid,
        hasLabel: leftYAxisHasLabel,
        hasTick: leftYAxisHasTick,
      });
      const rightYAxisObj = filterValidAttributes({
        title: rightYAxisTitle,
        hasGrid: rightYAxisHasGrid,
        hasLabel: rightYAxisHasLabel,
        hasTick: rightYAxisHasTick,
      });
      const angleAxisObj = filterValidAttributes({
        title: angleAxisTitle,
        hasGrid: angleAxisHasGrid,
        hasLabel: angleAxisHasLabel,
        hasTick: angleAxisHasTick,
        type: angleAxisType,
      });
      const radiusAxisObj = filterValidAttributes({
        hasGrid: radiusAxisHasGrid,
        hasLabel: radiusAxisHasLabel,
        hasTick: radiusAxisHasTick,
        type: radiusAxisType,
        title: radiusAxisTitle,
      });
    
      const cell: Record<string, string> = {};
    
      [
        "xField",
        "yField",
        "colorField",
        "categoryField",
        "valueField",
        "wordField",
        "sizeField",
        "timeField",
        "sourceField",
        "targetField",
        "setsField",
        "radiusField",
      ].forEach((fieldName) => {
        if (isValid(options[fieldName])) {
          cell[fieldName.replace("Field", "")] = options[fieldName];
          delete opts[fieldName];
        }
      });
    
      opts.cell = cell;
    
      if (!isEmpty(titleObj)) {
        opts.title = titleObj;
      }
    
      const axes = [
        xAxisObj,
        yAxisObj,
        leftYAxisObj,
        rightYAxisObj,
        angleAxisObj,
        radiusAxisObj,
      ];
    
      if (axes.some((axis) => !isEmpty(axis))) {
        opts.axes = axes.filter((axis) => !isEmpty(axis));
      }
    
      const { spec } = generateChart(options.chartType ?? chartType, opts);
    
      if (!spec) {
        return null;
      }
    
      if (output === "spec") {
        if (isValid(width)) {
          spec.width = width;
        }
        if (isValid(height)) {
          spec.height = height;
        }
    
        return {
          spec: spec,
        };
      }
    
      return gentrateChartImageOrHtml(output, spec, {
        width: `${width ?? 500}px`,
        height: `${height ?? 500}px`,
      });
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but provides minimal behavioral information. It states what the tool generates but doesn't mention output format options (image, HTML, spec), performance characteristics, error conditions, or any side effects. For a complex 13-parameter visualization tool, this is inadequate.

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

Conciseness4/5

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

The description is appropriately concise with two clear clauses describing the two chart types. It's front-loaded with the main purpose and wastes no words. However, it could be slightly more structured by separating the two visualization types more distinctly.

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?

For a complex 13-parameter visualization tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns (image data, HTML, specification), how to interpret results, error handling, or provide examples. The high parameter count and lack of structured metadata require more descriptive context.

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?

With 92% schema description coverage, the schema already documents most parameters well. The description adds no parameter-specific information beyond what's in the schema. It mentions 'word frequency or importance' and 'relationships between sets' which loosely relate to dataTable, colorField, and valueField, but provides no additional semantic context.

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 generates visualizations (word clouds or Venn diagrams) for specific purposes: word clouds visualize word frequency/importance, and Venn diagrams show relationships between sets. It distinguishes from siblings by specifying these two chart types, though it doesn't explicitly contrast with other chart-generation tools.

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?

No guidance is provided on when to use this tool versus the nine sibling chart-generation tools. The description mentions the two chart types but doesn't explain when to choose word clouds over Venn diagrams or when to use this versus other visualization tools like heatmaps or scatter charts.

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

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