data_min
Identify minimum values for each column in a dataset using the MCP Data Wrangler server. Analyze data by providing the input file path for streamlined preprocessing and descriptive statistics.
Instructions
Minimum values for each column
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input_data_file_path | No | Path to the input data file |
Implementation Reference
- The main handler function for the 'data_min' tool, which computes the minimum value for each column in the input dataframe and returns it as JSON.
async def handle_data_min( arguments: dict[str, Any], ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: data_min_input = DataMinInputSchema.from_args(arguments) min_df = data_min_input.df.min() # Convert the DataFrame to a dictionary format min_dict = { "description": "Minimum values for each column", "min_values": {col: str(val) if val is not None else None for col, val in zip(min_df.columns, min_df.row(0))}, } return [ types.TextContent( type="text", text=json.dumps(min_dict), ) ] - Pydantic schema for input validation of the 'data_min' tool, including static methods to load data from file path argument.
class DataMinInputSchema(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) -> "DataMinInputSchema": data = Data.from_file(input_data_file_path) return DataMinInputSchema(df=data.df) @staticmethod def from_args(arguments: dict[str, Any]) -> "DataMinInputSchema": input_data_file_path = arguments["input_data_file_path"] return DataMinInputSchema.from_schema(input_data_file_path=input_data_file_path) - src/mcp_server_data_wrangler/tools/tools.py:102-106 (registration)Registration of the 'data_min' tool in the MCP tools list, specifying name, description, and input schema.
types.Tool( name=MCPServerDataWrangler.data_min.value[0], description=MCPServerDataWrangler.data_min.value[1], inputSchema=DataMinInputSchema.input_schema(), ), - src/mcp_server_data_wrangler/tools/tools.py:159-159 (registration)Mapping of the 'data_min' tool name to its handler function in the dispatch dictionary.
MCPServerDataWrangler.data_min.value[0]: handle_data_min, - src/mcp_server_data_wrangler/tools/tools.py:47-47 (registration)Enum definition associating 'data_min' with its name and description.
data_min = ("data_min", "Minimum values for each column")