Skip to main content
Glama
shibuiwilliam

MCP Data Wrangler

data_std

Calculate standard deviation for each column in a dataset. Specify input file path and delta degrees of freedom (ddof) for precise statistical analysis.

Instructions

Standard deviation values for each column

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ddofNoDelta Degrees of Freedom: the divisor used in the calculation is N - ddof
input_data_file_pathYesPath to the input data file

Implementation Reference

  • The main handler function that processes input arguments, computes standard deviation on the dataframe columns, and returns the result as JSON text content.
    async def handle_data_std( arguments: dict[str, Any], ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: data_std_input = DataStdInputSchema.from_args(arguments) std_df = data_std_input.df.std(ddof=data_std_input.ddof) # Convert the DataFrame to a dictionary format std_dict = { "description": f"Standard deviation values for each column with ddof={data_std_input.ddof}", "std_values": {col: str(val) if val is not None else None for col, val in zip(std_df.columns, std_df.row(0))}, } return [ types.TextContent( type="text", text=json.dumps(std_dict), ) ]
  • Pydantic input schema class for validating tool arguments, defining the JSON schema, and loading data from file into a dataframe with optional ddof parameter.
    class DataStdInputSchema(Data): model_config = ConfigDict( validate_assignment=True, frozen=True, extra="forbid", arbitrary_types_allowed=True, ) ddof: int = Field( default=1, description="Delta Degrees of Freedom: the divisor used in the calculation is N - ddof", ge=0 ) @staticmethod def input_schema() -> dict: return { "type": "object", "properties": { "input_data_file_path": { "type": "string", "description": "Path to the input data file", }, "ddof": { "type": "integer", "description": "Delta Degrees of Freedom: the divisor used in the calculation is N - ddof", "minimum": 0, "default": 1, }, }, "required": ["input_data_file_path"], } @staticmethod def from_schema(input_data_file_path: str, ddof: int = 1) -> "DataStdInputSchema": data = Data.from_file(input_data_file_path) return DataStdInputSchema( df=data.df, ddof=ddof, ) @staticmethod def from_args(arguments: dict[str, Any]) -> "DataStdInputSchema": input_data_file_path = arguments["input_data_file_path"] ddof = arguments.get("ddof", 1) return DataStdInputSchema.from_schema( input_data_file_path=input_data_file_path, ddof=ddof, )
  • Registers the 'data_std' tool in the MCP tools list with name, description, and input schema.
    types.Tool( name=MCPServerDataWrangler.data_std.value[0], description=MCPServerDataWrangler.data_std.value[1], inputSchema=DataStdInputSchema.input_schema(), ),
  • Maps the 'data_std' tool name to its handler function in the tool-to-handler dictionary.
    MCPServerDataWrangler.data_std.value[0]: handle_data_std,
  • Defines the tool name and description in the MCPServerDataWrangler enum.
    data_std = ("data_std", "Standard deviation values for each column")
Install Server

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