Skip to main content
Glama

infer_schema

Sample a CSV, Excel, JSON, or JSONL file to infer column types and generate a draft V2 schema for a new or rebuilt data source.

Instructions

Infer column types by sampling the head of a data file (CSV/Excel/JSON/JSONL) and generate a draft V2 schema structure. Use it when creating a schema for a new data source or rebuilding an existing schema; read-only, nothing is written to disk - the caller decides whether to save the returned draft. Returns a schema dictionary with V2 fields such as id, name and columns (each column carries its inferred type: string/integer/float/decimal/boolean/date). Note: type inference is based on a sample (1000 rows by default), so extreme values outside the sample may change the actual type; review the draft by hand before verifying it with validate_data. The file path must be inside the server working directory, otherwise the call fails.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_idNoTable ID. Pass the existing id when replacing a schema to preserve references; a new id is generated otherwise
data_fileYesPath to a CSV/Excel/JSON/JSONL data file (must be inside the server working directory; paths outside it are rejected)
table_nameNoTable display name; defaults to the data file name
sample_rowsNoNumber of rows to sample (default 1000; must be a positive integer). Larger samples infer types more accurately but run slower
source_pathNosource.path written into the schema (path to the data file, relative); omitted when not provided

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.1.11
    • changedInput schema / properties / data_file / description
      Previous value: -"CSV/Excel/JSON 数据文件路径"New value: +"Path to a CSV/Excel/JSON/JSONL data file (must be inside the server working directory; paths outside it are rejected)"
    • changedInput schema / properties / sample_rows / description
      Previous value: -"采样行数(默认 1000)"New value: +"Number of rows to sample (default 1000; must be a positive integer). Larger samples infer types more accurately but run slower"
    • changedInput schema / properties / source_path / description
      Previous value: -"写入 schema 的 source.path"New value: +"source.path written into the schema (path to the data file, relative); omitted when not provided"
    • changedInput schema / properties / table_id / description
      Previous value: -"表 ID(替换既有 schema 时传原 id)"New value: +"Table ID. Pass the existing id when replacing a schema to preserve references; a new id is generated otherwise"
    • changedInput schema / properties / table_name / description
      Previous value: -"表显示名"New value: +"Table display name; defaults to the data file name"
  2. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so well: it declares read-only behavior, that nothing is written to disk and the caller decides whether to save, the approximate sample size driving inference, the failure mode for paths outside the working directory, and the caveat that out-of-sample extreme values may change the real type.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action, followed by usage, return shape, caveats and constraints in a logical order. It is on the long side and repeats the sample-size default that the schema already states, but every sentence carries usable information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, so the description justifiably describes the returned schema dictionary and its V2 fields. Combined with the usage trigger, the sampling caveat and the path restriction, an agent has everything needed to call this correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters like table_id, sample_rows and source_path are already documented in the schema; the description largely restates the default 1000-row sample and the working-directory path constraint. It adds the semantic link between the draft's column types and the sample, but little beyond structured data.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('infer column types by sampling the head of a data file') and names the artifact produced ('generate a draft V2 schema structure'). It is clearly distinguishable from validate_data, which the description positions as a separate verification step.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says when to use it ('when creating a schema for a new data source or rebuilding an existing schema') and points to validate_data as the downstream verification step. It stops short of stating when *not* to use it or naming a true alternative tool for the same job.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.