You're viewing a demo portfolio

Join the waitlist
PRSM

data_query

Active

Tool of stagenth · 数据工具箱

declared in 1.28.1

查询 / 过滤 / 分组聚合数据文件,返回**实际数据行(JSON)**供 AI 直接分析(1 credit/次)。 支持 CSV/TSV/JSON/NDJSON/Parquet,两种用法: · 原始 SQL(表名固定 t):sql="SELECT 商品, sum(销量) s FROM t GROUP BY 商品 ORDER BY s DESC LIMIT 5" · 结构化(不用写 SQL):group_by=["地区"], measures=["销售额"], agg="sum", sort_by="销售额", descending=true, limit=10 SQL 仅允许单条只读 SELECT/WITH,禁止读文件/建表/联网。结果硬上限 1000 行,超出置 truncated=True。失败自动退款。 返回 {ok, format, mode, columns, total_rows, returned_rows, truncated, rows[]}。

Parameters schema

{
  "type": "object",
  "title": "data_queryArguments",
  "properties": {
    "agg": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Agg",
      "default": null,
      "description": "聚合方式 sum/avg/count/min/max/median(默认 sum;count=数每组行数、无需 measures)"
    },
    "fmt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Fmt",
      "default": null,
      "description": "格式 csv/tsv/json/ndjson/parquet;缺省自动识别"
    },
    "sql": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sql",
      "default": null,
      "description": "只读 SQL,表名固定为 t。例:SELECT 地区, sum(金额) AS 合计 FROM t GROUP BY 地区 ORDER BY 合计 DESC LIMIT 10。仅允许单条 SELECT/WITH,禁止读文件/建表/联网。给了 sql 就忽略下面的结构化参数。"
    },
    "limit": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Limit",
      "default": null,
      "description": "最多返回多少行(取前 N / Top-N);硬上限 1000"
    },
    "columns": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        {
          "type": "null"
        }
      ],
      "title": "Columns",
      "default": null,
      "description": "明细模式:只返回这些列;缺省返回全部列"
    },
    "file_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "File Id",
      "default": null,
      "description": "已上传的数据文件 ID(与 data_base64 二选一)"
    },
    "filters": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        {
          "type": "null"
        }
      ],
      "title": "Filters",
      "default": null,
      "description": "行过滤条件(AND 组合),每项 {column, op, value}。op 可选:eq/ne/gt/ge/lt/le/contains/in/notnull/isnull。例:[{\"column\":\"状态\",\"op\":\"eq\",\"value\":\"失败\"},{\"column\":\"金额\",\"op\":\"ge\",\"value\":1000}]"
    },
    "sort_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sort By",
      "default": null,
      "description": "按哪一列排序(可为分组后的 measure 或 count 列)"
    },
    "group_by": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        {
          "type": "null"
        }
      ],
      "title": "Group By",
      "default": null,
      "description": "分组维度列。给了就进聚合模式:按这些列分组,对 measures 求 agg"
    },
    "measures": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        {
          "type": "null"
        }
      ],
      "title": "Measures",
      "default": null,
      "description": "聚合模式:要统计的数值列;缺省=所有非分组的数值列"
    },
    "descending": {
      "type": "boolean",
      "title": "Descending",
      "default": false,
      "description": "降序排序(取 Top-N 常用 true)"
    },
    "data_base64": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Data Base64",
      "default": null,
      "description": "数据文件内容 base64(与 file_id 二选一)"
    }
  }
}

What this tool wraps· 1 endpoint

min confidence0.700.50

Parent server

stagenth · 数据工具箱

1/7 registries
View full server →