save_data
Store data in named tables for creating visualizations later. Save datasets to reference when generating charts and graphs with Vega-Lite syntax.
Instructions
A tool which allows you to save data to a named table for later use in visualizations. When to use this tool:
Use this tool when you have data that you want to visualize later. How to use this tool:
Provide the name of the table to save the data to (for later reference) and the data itself.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the table to save the data to | |
| data | Yes | The data to save |
Implementation Reference
- Handler implementation for the save_data tool: extracts name and data from arguments, stores data in global saved_data dict, returns success message.if name == "save_data": save_name = arguments["name"] saved_data[save_name] = arguments["data"] return [types.TextContent(type="text", text=f"Data saved successfully to table {save_name}")]
- src/mcp_server_vegalite/server.py:83-98 (registration)Registration of the save_data tool in list_tools() handler, including name, description, and input schema definition.types.Tool( name="save_data", description=SAVE_DATA_TOOL_DESCRIPTION, inputSchema={ "type": "object", "properties": { "name": {"type": "string", "description": "The name of the table to save the data to"}, "data": { "type": "array", "items": {"type": "object", "description": "Row of the table as a dictionary/object"}, "description": "The data to save", }, }, "required": ["name", "data"], }, ),
- Input schema for save_data tool: requires 'name' (string) and 'data' (array of objects).inputSchema={ "type": "object", "properties": { "name": {"type": "string", "description": "The name of the table to save the data to"}, "data": { "type": "array", "items": {"type": "object", "description": "Row of the table as a dictionary/object"}, "description": "The data to save", }, }, "required": ["name", "data"], },
- Global saved_data dictionary used by save_data handler to store named data tables; pre-populated with sample data.saved_data = { "sample_data": [ {"name": "Alice", "age": 25, "city": "New York"}, {"name": "Bob", "age": 30, "city": "San Francisco"}, {"name": "Charlie", "age": 35, "city": "Los Angeles"}, ] }