Format Conversion
编程式构建多级合并表头、分组小计、动态列报表
用三种语言从你的代码中调用此工具。
curl -X POST 'https://api.elysiatools.com/zh/api/tools/xlsx-dynamic-report-builder' \
-H 'Content-Type: application/json' \
-d '{"dataJson":"[\n {\n \"region\": \"APAC\",\n \"dept\": \"Sales\",\n \"revenue\": 12000,\n \"cost\": 7200,\n \"profit\": 4800\n },\n {\n \"region\": \"APAC\",\n \"dept\": \"Ops\",\n \"revenue\": 8000,\n \"cost\": 5200,\n \"profit\": 2800\n },\n {\n \"region\": \"EMEA\",\n \"dept\": \"Sales\",\n \"revenue\": 15000,\n \"cost\": 8600,\n \"profit\": 6400\n },\n {\n \"region\": \"EMEA\",\n \"dept\": \"Ops\",\n \"revenue\": 9000,\n \"cost\": 5700,\n \"profit\": 3300\n }\n]","groupBy":"region","fixedColumns":"region,dept","valueColumns":"revenue,cost,profit","headerGroupsJson":"{\n \"Organization\": [\n \"region\",\n \"dept\"\n ],\n \"Financials\": [\n \"revenue\",\n \"cost\",\n \"profit\"\n ]\n}","includeGrandTotal":true,"sheetName":"Dynamic Report"}'以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。
POST https://api.elysiatools.com/zh/api/tools/xlsx-dynamic-report-builder| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| dataJson | textarea | 是 | — |
| groupBy | text | 否 | — |
| fixedColumns | text | 否 | — |
| valueColumns | text | 否 | — |
| headerGroupsJson | textarea | 否 | — |
| includeGrandTotal | checkbox | 否 | — |
| sheetName | text | 否 | — |
文件结果
{
"filePath": "/public/processing/randomid.ext",
"fileName": "output.ext",
"contentType": "application/octet-stream",
"size": 1024,
"metadata": {
"key": "value"
},
"error": "Error message (optional)",
"message": "Notification message (optional)"
}将此工具加入你的 Model Context Protocol 服务,让 AI 智能体可以列出并调用它。
将以下内容加入你的 MCP 客户端配置:
{
"mcpServers": {
"elysiatools-xlsx-dynamic-report-builder": {
"name": "xlsx-dynamic-report-builder",
"description": "编程式构建多级合并表头、分组小计、动态列报表",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=xlsx-dynamic-report-builder",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}连接到 SSE 端点后,列出已开放的工具:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}通过工具 id 调用,参数由其参数表构建:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "xlsx-dynamic-report-builder",
"arguments": {
"dataJson": "[\n {\n \"region\": \"APAC\",\n \"dept\": \"Sales\",\n \"revenue\": 12000,\n \"cost\": 7200,\n \"profit\": 4800\n },\n {\n \"region\": \"APAC\",\n \"dept\": \"Ops\",\n \"revenue\": 8000,\n \"cost\": 5200,\n \"profit\": 2800\n },\n {\n \"region\": \"EMEA\",\n \"dept\": \"Sales\",\n \"revenue\": 15000,\n \"cost\": 8600,\n \"profit\": 6400\n },\n {\n \"region\": \"EMEA\",\n \"dept\": \"Ops\",\n \"revenue\": 9000,\n \"cost\": 5700,\n \"profit\": 3300\n }\n]",
"groupBy": "region",
"fixedColumns": "region,dept",
"valueColumns": "revenue,cost,profit",
"headerGroupsJson": "{\n \"Organization\": [\n \"region\",\n \"dept\"\n ],\n \"Financials\": [\n \"revenue\",\n \"cost\",\n \"profit\"\n ]\n}",
"includeGrandTotal": true,
"sheetName": "Dynamic Report"
}
}
}有问题或反馈?请联系 [email protected]