Skip to main content
Glama
xlsx-for-ai

xlsx-for-ai

by senoff

xlsx_convert

Convert spreadsheets between formats: read xlsx, xls, ods, csv, dbf, JSON and 25+ inputs, then output xlsx, csv, json, md or html. Use it to bring a legacy .xls or .dbf file into an AI agent.

Instructions

Use this when you need to convert a spreadsheet between formats — reads xlsx, xls, xlsb, ods/fods, csv/tsv, dbf, sylk, dif and prn (25+ inputs), plus a file exported or downloaded from Google Sheets; emits xlsx, csv, tsv, json, md, or html. Old binary .xls is read-only: it is accepted as input but never written, so to=xls is refused with a typed 400 unsupported_output_format (an isError result on MCP) — ask for xlsx or csv. DIF, SYLK, ETH, PRN and RTF are not written yet either: those targets get the same typed 400. Often the only way to get a legacy .xls or .dbf into an agent that can't upload one directly. Deterministic and structural, no LLM mapping; exact formula/structure preservation holds on the own-engine path only, so check served_engine in the response (and decline_reason if it reads "incumbent") — a compatibility-engine fallback may not preserve charts, pivots, or other advanced features. For xlsx, xls, csv and json inputs there is no compatibility-engine fallback: if our own writer declines, the call fails with a typed HTTP 501 capability_gap (an isError result on MCP) and retrying the same file does not help. .json is a peer format in both directions: an uploaded .json (JSONL, a bare array of objects, a {"data":[…]} envelope, or a single object) is read into rows and converts to=json, to=csv or to=xlsx, and any supported input converts to=json as one object per row keyed by the header row. A JSON hop carries values only — styles and number formats are dropped, a formula cell emits its computed value rather than the formula text, dates become ISO-8601 strings, and nested fields arrive as flattened dotted column names.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "file_path": "<file_path>",
      "to": "<to>"
    },
    "name": "xlsx_convert"
  }
}

Input Schema

NameRequiredDescriptionDefault
toYesTarget format. Binary formats land bytes in _meta.file_b64; text formats render in body.
sheetNoRender only this sheet (text outputs).
sheetsNoFor text outputs: render every sheet (default) or only the first.
out_pathNoOptional save path for binary outputs (xlsx/xlsb/etc.).
file_pathYesAbsolute path to the source spreadsheet file (any supported format). Pass the path string AS-IS — do NOT read, open, or base64-encode the file; the client handles all file I/O.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv4.3.1
    • removedInput schema / properties / file_b64
      Removed value: -{
      -  "type": "string"
      -}
    • addedInput schema / properties / file_path
      Added value: +{
      +  "description": "Absolute path to the source spreadsheet file (any supported format). Pass the path string AS-IS — do NOT read, open, or base64-encode the file; the client handles all file I/O.",
      +  "type": "string"
      +}
    • removedInput schema / properties / options
      Removed value: -{
      -  "properties": {
      -    "sheet": {
      -      "description": "Render only this sheet (text outputs only).",
      -      "type": "string"
      -    },
      -    "sheets": {
      -      "enum": [
      -        "all",
      -        "first"
      -      ],
      -      "type": "string"
      -    }
      -  },
      -  "type": "object"
      -}
    • addedInput schema / properties / out_path
      Added value: +{
      +  "description": "Optional save path for binary outputs (xlsx/xlsb/etc.).",
      +  "type": "string"
      +}
    • addedInput schema / properties / sheet
      Added value: +{
      +  "description": "Render only this sheet (text outputs).",
      +  "type": "string"
      +}
    • addedInput schema / properties / sheets
      Added value: +{
      +  "description": "For text outputs: render every sheet (default) or only the first.",
      +  "enum": [
      +    "all",
      +    "first"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / to / description
      Previous value: -"Target format. Binary formats return bytes in _meta.file_b64; text formats render in body."New value: +"Target format. Binary formats land bytes in _meta.file_b64; text formats render in body."
    • changedInput schema / properties / to / enum
      Previous value: -[
      -  "csv",
      -  "tsv",
      -  "txt",
      -  "html",
      -  "md",
      -  "json",
      -  "dif",
      -  "sylk",
      -  "eth",
      -  "prn",
      -  "rtf",
      -  "xlsx",
      -  "xlsb",
      -  "xlsm",
      -  "xls",
      -  "ods",
      -  "fods",
      -  "dbf"
      -]New value: +[
      +  "xlsx",
      +  "xlsb",
      +  "xlsm",
      +  "xls",
      +  "ods",
      +  "fods",
      +  "dbf",
      +  "csv",
      +  "tsv",
      +  "txt",
      +  "html",
      +  "md",
      +  "json",
      +  "dif",
      +  "sylk",
      +  "eth",
      +  "prn",
      +  "rtf"
      +]
    • changedInput schema / required
      Previous value: -[
      -  "file_b64",
      -  "to"
      -]New value: +[
      +  "file_path",
      +  "to"
      +]
  2. First observedv3.2.1

TDQS

A4.2/5.0
Behavior5/5

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

Goes well past the annotations (readOnlyHint=false, destructiveHint=false) by disclosing the error contract: typed HTTP 400 unsupported_output_format for refused targets, typed 501 capability_gap with no fallback for xlsx/xls/csv/json inputs, and that retrying the same file will not help. It also discloses the compatibility-engine fallback risk (charts, pivots may not survive) and keyed on served_engine/decline_reason, plus the lossy semantics of a JSON hop. That is exactly the mutation-adjacent context annotations cannot carry.

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

Conciseness3/5

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

The trigger is correctly front-loaded in the first sentence, but the body is a ~250-word block that repeats the same parenthetical three times ("an isError result on MCP") and restates the 400 refusal pattern for two separate format groups. The dense error/engine/JSON content is genuinely load-bearing, yet it could be compressed into structured bullets or a shorter statement of the same rules.

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?

For a converter with an 18-value target enum, five parameters, and a subtle engine-fallback failure mode, the description covers input breadth, output breadth, both error shapes, engine caveats, and cross-format semantic loss. With no output schema present, it still tells the agent where results land (file_b64 in _meta for binary, body for text) and what served_engine means — nothing an agent needs in order to call it correctly is missing.

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

Parameters4/5

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

Schema coverage is 100%, so 3 is the baseline, but the description earns above it: the `to` enum in the schema lists xls, dif, sylk, eth, rtf and prn as valid, while the description reveals those targets are refused or unwritten — information the schema actively misleads on. It also explains the meaning of a json `to` (one object per row keyed by header, flattened dotted nested fields) and the value-only nature of that conversion. It says nothing additional about sheet/sheets/out_path, keeping it at 4.

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

Purpose4/5

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

States a specific verb ("convert") and resource ("a spreadsheet between formats") and enumerates both the 25+ input families and the concrete output set (xlsx, csv, tsv, json, md, html). It never names a sibling such as importable_convert, so an agent still has no explicit differentiation signal, which caps this at 4 rather than 5.

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?

The first clause is an explicit trigger ("Use this when you need to convert a spreadsheet between formats") and it adds when-not guidance: to=xls and other unwritten targets get a typed 400, so "ask for xlsx or csv". It also tells the agent when to check served_engine. What's missing is routing guidance toward any alternative sibling tool, so it is clear context without exclusions among siblings.

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