Skip to main content
Glama
lubo3395
by lubo3395

创建 Excel 文件

xlsx_create
Destructive

Create Excel xlsx files from JSON data. Supports object arrays or two-dimensional arrays for rows and columns, with configurable sheet name and file overwrite.

Instructions

从 JSON 数据创建新的 xlsx 文件。

参数:

  • file_path (string, 必填): 输出 xlsx 文件路径

  • data (string, 必填): JSON 数据字符串

    • 对象数组格式: [{"姓名": "张三", "年龄": 30}, {"姓名": "李四", "年龄": 25}]

    • 二维数组格式: [["姓名", "年龄"], ["张三", 30], ["李四", 25]]

  • sheet_name (string, 默认 "Sheet1"): sheet 名称

  • overwrite (boolean, 默认 false): 文件已存在时是否覆盖

返回:

  • file_path: 输出文件路径

  • sheet_name: sheet 名称

  • rows: 总行数

  • cols: 总列数

示例:

  • "创建 test.xlsx,包含 [{name:'张三',age:30},{name:'李四',age:25}]" -> { file_path: "test.xlsx", data: '[{"name":"张三","age":30},{"name":"李四","age":25}]' }

  • "覆盖已有文件" -> { file_path: "test.xlsx", data: "...", overwrite: true }

错误处理:

  • 文件已存在且未设置 overwrite: "文件已存在: ..."

  • 输出目录不存在: "输出目录不存在: ..."

  • 数据格式无效: "数据格式无效: ..."

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes输出 xlsx 文件路径
dataYesJSON 数据: 可以是对象数组 [{"col1":"val1",...}] 或二维数组 [["h1","h2"],["v1","v2"]]
sheet_nameNosheet 名称Sheet1
overwriteNo如果文件已存在是否覆盖
Behavior5/5

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

Annotations indicate destructiveHint=true, and the description elaborates on destructive behavior (overwriting, error if exists and no overwrite). It also covers error conditions and return values.

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?

The description is well-structured with sections for parameters, return values, examples, and error handling. It is comprehensive but slightly verbose in places (e.g., examples repeating param info).

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?

Given no output schema, the description fully covers return values, all parameters, and error cases. It provides enough context for correct invocation without ambiguity.

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

Parameters5/5

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

Schema coverage is 100%, but the description adds substantial value with detailed data format examples, explanation of JSON structures, and clarification of overwrite behavior. This goes well beyond the schema.

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?

The description clearly states it creates a new xlsx file from JSON data. It distinguishes from sibling tools which handle adding sheets, listing, reading, and updating cells.

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 description provides thorough parameter details, examples, and error handling. While it doesn't explicitly state when to use vs alternatives, the context makes it clear for creation tasks.

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

Install Server

Other 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/lubo3395/mcp-xlsx-server'

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