Skip to main content
Glama
markomitranic

Data Visualization MCP Server

visualize_data

Transform complex datasets into clear, interpretable visuals using the Vega-Lite grammar. Use this tool to visualize multi-dimensional data from saved tables, enhancing understanding and analysis.

Instructions

A tool which allows you to produce a data visualization using the Vega-Lite grammar. When to use this tool:

  • At times, it will be advantageous to provide the user with a visual representation of some data, rather than just a textual representation.

  • This tool is particularly useful when the data is complex or has many dimensions, making it difficult to understand in a tabular format. It is not useful for singular data points. How to use this tool:

  • Prior to visualization, data must be saved to a named table using the save_data tool.

  • After saving the data, use this tool to visualize the data by providing the name of the table with the saved data and a Vega-Lite specification.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
data_nameYesThe name of the data table to visualize
vegalite_specificationYesThe vegalite v5 specification for the visualization. Do not include the data field, as this will be added automatically.

Implementation Reference

  • The core handler logic for the 'visualize_data' tool. Retrieves data by name from saved_data, injects it into the Vega-Lite spec, renders to PNG if output_type is 'png', otherwise returns text content with artifact.
    elif name == "visualize_data": data_name = arguments["data_name"] vegalite_specification = eval(arguments["vegalite_specification"]) data = saved_data[data_name] vegalite_specification["data"] = {"values": data} if output_type == "png": png = vlc.vegalite_to_png(vl_spec=vegalite_specification, scale=2) png = base64.b64encode(png).decode("utf-8") return [types.ImageContent(type="image", data=png, mimeType="image/png")] else: return [ types.TextContent( type="text", text=f"Visualized data from table {data_name} with provided spec.", artifact=vegalite_specification, ) ]
  • Tool registration in the list_tools() handler, defining the tool's name, description reference, and input schema.
    types.Tool( name="visualize_data", description=VISUALIZE_DATA_TOOL_DESCRIPTION, inputSchema={ "type": "object", "properties": { "data_name": { "type": "string", "description": "The name of the data table to visualize", }, "vegalite_specification": { "type": "string", "description": "The vegalite v5 specification for the visualization. Do not include the data field, as this will be added automatically.", }, }, "required": ["data_name", "vegalite_specification"], }, ),
  • Pydantic-like input schema for the visualize_data tool, specifying required parameters: data_name (string) and vegalite_specification (string).
    inputSchema={ "type": "object", "properties": { "data_name": { "type": "string", "description": "The name of the data table to visualize", }, "vegalite_specification": { "type": "string", "description": "The vegalite v5 specification for the visualization. Do not include the data field, as this will be added automatically.", }, }, "required": ["data_name", "vegalite_specification"], },

Other Tools

Related 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/markomitranic/mcp-vegalite-server'

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