save_data
Store data in a named table for future visualization by specifying a table name and providing the dataset. Simplified data management for creating visualizations 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 |
|---|---|---|---|
| data | Yes | The data to save | |
| name | Yes | The name of the table to save the data to |
Implementation Reference
- The core handler logic for the 'save_data' tool. It extracts the table name and data from arguments, stores the data in the global 'saved_data' dictionary, and returns a 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}")]
- The input schema defining the expected parameters for the 'save_data' tool: a required 'name' string for the table and 'data' as an 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"], },
- src/mcp_server_vegalite/server.py:83-98 (registration)The registration of the 'save_data' tool object in the handle_list_tools function, including name, description reference, and schema.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"], }, ),
- Global dictionary initialized with sample data, used by the save_data handler to store user-provided data tables.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"}, ]
- Multi-line description string for the 'save_data' tool, referenced in the tool registration.SAVE_DATA_TOOL_DESCRIPTION = """ 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. """.strip()