Skip to main content
Glama

data_schema

Analyze and validate the structure of input data files to ensure compatibility with data wrangling processes in the MCP Data Wrangler server.

Instructions

Data schema of the input data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_data_file_pathNoPath to the input data file

Implementation Reference

  • The main handler function for the 'data_schema' tool. It processes input arguments, loads the data using DataSchemaInputSchema, extracts the schema from the dataframe, converts it to a dictionary, and returns it as JSON text content.
    async def handle_data_schema( arguments: dict[str, Any], ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: data_schema_input = DataSchemaInputSchema.from_args(arguments) schema = data_schema_input.df.schema schema_dict = {col: str(dtype) for col, dtype in schema.items()} return [ types.TextContent( type="text", text=json.dumps( { "description": "Data schema of the input data", "schema": schema_dict, } ), ) ]
  • Pydantic model defining the input schema for the 'data_schema' tool, including the JSON schema definition via input_schema(), and factory methods to load data from file or arguments.
    class DataSchemaInputSchema(Data): model_config = ConfigDict( validate_assignment=True, frozen=True, extra="forbid", arbitrary_types_allowed=True, ) @staticmethod def input_schema() -> dict: return { "type": "object", "properties": { "input_data_file_path": { "type": "string", "description": "Path to the input data file", }, }, } @staticmethod def from_schema(input_data_file_path: str) -> "DataSchemaInputSchema": data = Data.from_file(input_data_file_path) return DataSchemaInputSchema(df=data.df) @staticmethod def from_args(arguments: dict[str, Any]) -> "DataSchemaInputSchema": input_data_file_path = arguments["input_data_file_path"] return DataSchemaInputSchema.from_schema(input_data_file_path=input_data_file_path)
  • Registration of the 'data_schema' tool in the list of MCP tools returned by MCPServerDataWrangler.tools(), specifying name, description, and input schema.
    types.Tool( name=MCPServerDataWrangler.data_schema.value[0], description=MCPServerDataWrangler.data_schema.value[1], inputSchema=DataSchemaInputSchema.input_schema(), ),
  • Mapping of the 'data_schema' tool name to its handler function in the tool_to_handler dictionary.
    MCPServerDataWrangler.data_schema.value[0]: handle_data_schema,
  • Enum definition providing the name and description for the 'data_schema' tool.
    data_schema = ("data_schema", "Data schema of the input data")

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/shibuiwilliam/mcp-server-data-wrangler'

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