qingflow-mcp 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -126,6 +126,16 @@ Example:
126
126
  }
127
127
  ```
128
128
 
129
+ For single record details (`qf_record_get`), the same column controls are supported:
130
+
131
+ ```json
132
+ {
133
+ "apply_id": "497600278750478338",
134
+ "max_columns": 5,
135
+ "select_columns": [1, "客户名称"]
136
+ }
137
+ ```
138
+
129
139
  Optional env vars:
130
140
 
131
141
  ```bash
package/dist/server.js CHANGED
@@ -223,14 +223,26 @@ const listOutputSchema = z.object({
223
223
  meta: apiMetaSchema
224
224
  });
225
225
  const recordGetInputSchema = z.object({
226
- apply_id: z.union([z.string().min(1), z.number().int()])
226
+ apply_id: z.union([z.string().min(1), z.number().int()]),
227
+ max_columns: z.number().int().positive().max(200).optional(),
228
+ select_columns: z
229
+ .array(z.union([z.string().min(1), z.number().int()]))
230
+ .min(1)
231
+ .max(200)
232
+ .optional()
227
233
  });
228
234
  const recordGetOutputSchema = z.object({
229
235
  ok: z.literal(true),
230
236
  data: z.object({
231
237
  apply_id: z.union([z.string(), z.number(), z.null()]),
232
238
  answer_count: z.number().int().nonnegative(),
233
- record: z.unknown()
239
+ record: z.unknown(),
240
+ applied_limits: z
241
+ .object({
242
+ column_cap: z.number().int().positive().nullable(),
243
+ selected_columns: z.array(z.string()).nullable()
244
+ })
245
+ .optional()
234
246
  }),
235
247
  meta: apiMetaSchema
236
248
  });
@@ -457,13 +469,26 @@ server.registerTool("qf_record_get", {
457
469
  try {
458
470
  const response = await client.getRecord(String(args.apply_id));
459
471
  const record = asObject(response.result) ?? {};
460
- const answerCount = asArray(record.answers).length;
472
+ const projection = projectAnswersForOutput({
473
+ answers: asArray(record.answers),
474
+ maxColumns: args.max_columns,
475
+ selectColumns: args.select_columns
476
+ });
477
+ const projectedRecord = {
478
+ ...record,
479
+ answers: projection.answers
480
+ };
481
+ const answerCount = projection.answers.length;
461
482
  return okResult({
462
483
  ok: true,
463
484
  data: {
464
485
  apply_id: record.applyId ?? null,
465
486
  answer_count: answerCount,
466
- record: response.result
487
+ record: projectedRecord,
488
+ applied_limits: {
489
+ column_cap: args.max_columns ?? null,
490
+ selected_columns: projection.selectedColumns
491
+ }
467
492
  },
468
493
  meta: buildMeta(response)
469
494
  }, `Fetched record ${String(args.apply_id)}`);
@@ -931,6 +956,21 @@ function projectRecordItemsColumns(params) {
931
956
  selectedColumns: normalizedSelectors.length > 0 ? normalizedSelectors : null
932
957
  };
933
958
  }
959
+ function projectAnswersForOutput(params) {
960
+ const normalizedSelectors = normalizeColumnSelectors(params.selectColumns);
961
+ const selectorSet = new Set(normalizedSelectors.map((item) => normalizeColumnSelector(item)));
962
+ let projected = params.answers;
963
+ if (selectorSet.size > 0) {
964
+ projected = projected.filter((answer) => answerMatchesAnySelector(answer, selectorSet));
965
+ }
966
+ if (params.maxColumns !== undefined && projected.length > params.maxColumns) {
967
+ projected = projected.slice(0, params.maxColumns);
968
+ }
969
+ return {
970
+ answers: projected,
971
+ selectedColumns: normalizedSelectors.length > 0 ? normalizedSelectors : null
972
+ };
973
+ }
934
974
  function fitListItemsWithinSize(params) {
935
975
  let candidate = params.items;
936
976
  let size = jsonSizeBytes(candidate);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qingflow-mcp",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",