@qingflow-tech/qingflow-app-builder-mcp 1.0.23 → 1.0.25
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
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Install:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install @qingflow-tech/qingflow-app-builder-mcp@1.0.
|
|
6
|
+
npm install @qingflow-tech/qingflow-app-builder-mcp@1.0.25
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
Run:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npx -y -p @qingflow-tech/qingflow-app-builder-mcp@1.0.
|
|
12
|
+
npx -y -p @qingflow-tech/qingflow-app-builder-mcp@1.0.25 qingflow-app-builder-mcp
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Environment:
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -26,7 +26,7 @@ def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) ->
|
|
|
26
26
|
|
|
27
27
|
schema_applicant = schema_subparsers.add_parser("applicant", help=argparse.SUPPRESS)
|
|
28
28
|
schema_applicant.add_argument("--app-key", required=True)
|
|
29
|
-
schema_applicant.set_defaults(handler=_handle_schema_applicant, format_hint="")
|
|
29
|
+
schema_applicant.set_defaults(handler=_handle_schema_applicant, format_hint="record_schema")
|
|
30
30
|
schema_subparsers._choices_actions = [ # type: ignore[attr-defined]
|
|
31
31
|
action
|
|
32
32
|
for action in schema_subparsers._choices_actions # type: ignore[attr-defined]
|
|
@@ -36,25 +36,25 @@ def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) ->
|
|
|
36
36
|
schema_browse = schema_subparsers.add_parser("browse", help="读取浏览视图表结构")
|
|
37
37
|
schema_browse.add_argument("--app-key", required=True)
|
|
38
38
|
schema_browse.add_argument("--view-id", required=True)
|
|
39
|
-
schema_browse.set_defaults(handler=_handle_schema_browse, format_hint="")
|
|
39
|
+
schema_browse.set_defaults(handler=_handle_schema_browse, format_hint="record_schema")
|
|
40
40
|
|
|
41
41
|
schema_insert = schema_subparsers.add_parser("insert", help="读取新增记录表结构")
|
|
42
42
|
schema_insert.add_argument("--app-key", required=True)
|
|
43
|
-
schema_insert.set_defaults(handler=_handle_schema_insert, format_hint="")
|
|
43
|
+
schema_insert.set_defaults(handler=_handle_schema_insert, format_hint="record_schema")
|
|
44
44
|
|
|
45
45
|
schema_update = schema_subparsers.add_parser("update", help="读取更新记录表结构")
|
|
46
46
|
schema_update.add_argument("--app-key", required=True)
|
|
47
47
|
schema_update.add_argument("--record-id", required=True)
|
|
48
48
|
schema_update.add_argument("--view-id")
|
|
49
|
-
schema_update.set_defaults(handler=_handle_schema_update, format_hint="")
|
|
49
|
+
schema_update.set_defaults(handler=_handle_schema_update, format_hint="record_schema")
|
|
50
50
|
|
|
51
51
|
schema_import = schema_subparsers.add_parser("import", help="读取导入表结构")
|
|
52
52
|
schema_import.add_argument("--app-key", required=True)
|
|
53
|
-
schema_import.set_defaults(handler=_handle_schema_import, format_hint="")
|
|
53
|
+
schema_import.set_defaults(handler=_handle_schema_import, format_hint="record_schema")
|
|
54
54
|
|
|
55
55
|
schema_code_block = schema_subparsers.add_parser("code-block", help="读取代码块执行表结构")
|
|
56
56
|
schema_code_block.add_argument("--app-key", required=True)
|
|
57
|
-
schema_code_block.set_defaults(handler=_handle_schema_code_block, format_hint="")
|
|
57
|
+
schema_code_block.set_defaults(handler=_handle_schema_code_block, format_hint="record_schema")
|
|
58
58
|
|
|
59
59
|
member_candidates = record_subparsers.add_parser("member-candidates", help="读取成员字段候选项")
|
|
60
60
|
member_candidates.add_argument("--app-key", required=True)
|
|
@@ -452,6 +452,102 @@ def _format_record_candidates(result: dict[str, Any]) -> str:
|
|
|
452
452
|
return "\n".join(lines) + "\n"
|
|
453
453
|
|
|
454
454
|
|
|
455
|
+
def _format_record_schema(result: dict[str, Any]) -> str:
|
|
456
|
+
lines = [
|
|
457
|
+
f"Status: {result.get('status') or '-'}",
|
|
458
|
+
f"App Key: {result.get('app_key') or '-'}",
|
|
459
|
+
f"Schema Scope: {result.get('schema_scope') or '-'}",
|
|
460
|
+
]
|
|
461
|
+
if result.get("record_id") not in (None, ""):
|
|
462
|
+
lines.append(f"Record ID: {result.get('record_id')}")
|
|
463
|
+
view_resolution = result.get("view_resolution") if isinstance(result.get("view_resolution"), dict) else {}
|
|
464
|
+
view_id = view_resolution.get("view_id") or view_resolution.get("id")
|
|
465
|
+
if view_id:
|
|
466
|
+
lines.append(f"View ID: {view_id}")
|
|
467
|
+
if result.get("schema_fingerprint") not in (None, ""):
|
|
468
|
+
lines.append(f"Schema Fingerprint: {result.get('schema_fingerprint')}")
|
|
469
|
+
|
|
470
|
+
sections: list[tuple[str, list[Any]]] = []
|
|
471
|
+
for key, label in (
|
|
472
|
+
("fields", "Fields"),
|
|
473
|
+
("required_fields", "Required Fields"),
|
|
474
|
+
("optional_fields", "Optional Fields"),
|
|
475
|
+
("runtime_linked_required_fields", "Runtime Linked Required Fields"),
|
|
476
|
+
("writable_fields", "Writable Fields"),
|
|
477
|
+
("columns", "Import Columns"),
|
|
478
|
+
("input_fields", "Input Fields"),
|
|
479
|
+
("code_block_fields", "Code Block Fields"),
|
|
480
|
+
("ambiguous_fields", "Ambiguous Fields"),
|
|
481
|
+
):
|
|
482
|
+
value = result.get(key)
|
|
483
|
+
if isinstance(value, list):
|
|
484
|
+
sections.append((label, value))
|
|
485
|
+
|
|
486
|
+
for label, items in sections:
|
|
487
|
+
lines.append(f"{label}: {len(items)}")
|
|
488
|
+
for item in items[:20]:
|
|
489
|
+
if isinstance(item, dict):
|
|
490
|
+
lines.append("- " + _schema_item_summary(item))
|
|
491
|
+
else:
|
|
492
|
+
lines.append(f"- {item}")
|
|
493
|
+
if len(items) > 20:
|
|
494
|
+
lines.append(f"... {len(items) - 20} more")
|
|
495
|
+
|
|
496
|
+
payload_template = result.get("payload_template") if isinstance(result.get("payload_template"), dict) else {}
|
|
497
|
+
if payload_template:
|
|
498
|
+
lines.append("Payload Template Keys: " + ", ".join(str(key) for key in list(payload_template.keys())[:20]))
|
|
499
|
+
|
|
500
|
+
available_routes = result.get("available_update_routes") if isinstance(result.get("available_update_routes"), list) else []
|
|
501
|
+
if available_routes:
|
|
502
|
+
route_labels = [
|
|
503
|
+
str(item.get("route_type") or item.get("endpoint_kind") or item.get("view_id") or "-")
|
|
504
|
+
for item in available_routes[:8]
|
|
505
|
+
if isinstance(item, dict)
|
|
506
|
+
]
|
|
507
|
+
lines.append("Available Update Routes: " + ", ".join(route_labels))
|
|
508
|
+
|
|
509
|
+
suggested_next_call = result.get("suggested_next_call") if isinstance(result.get("suggested_next_call"), dict) else {}
|
|
510
|
+
if suggested_next_call.get("tool_name"):
|
|
511
|
+
lines.append(f"Suggested Next Call: {suggested_next_call.get('tool_name')}")
|
|
512
|
+
|
|
513
|
+
_append_warnings(lines, result.get("warnings"))
|
|
514
|
+
_append_verification(lines, result.get("verification"))
|
|
515
|
+
return "\n".join(lines) + "\n"
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
def _schema_item_summary(item: dict[str, Any]) -> str:
|
|
519
|
+
field_id = (
|
|
520
|
+
item.get("field_id")
|
|
521
|
+
or item.get("que_id")
|
|
522
|
+
or item.get("queId")
|
|
523
|
+
or item.get("id")
|
|
524
|
+
or item.get("selector")
|
|
525
|
+
or "-"
|
|
526
|
+
)
|
|
527
|
+
title = item.get("title") or item.get("que_title") or item.get("queTitle") or item.get("name") or item.get("selector") or "-"
|
|
528
|
+
kind = item.get("kind") or item.get("write_kind") or item.get("que_type") or item.get("queType") or item.get("type") or "-"
|
|
529
|
+
parts = [f"{title} ({field_id})", f"kind={kind}"]
|
|
530
|
+
for key in ("required", "writable", "may_become_required", "requires_lookup", "requires_upload"):
|
|
531
|
+
if key in item:
|
|
532
|
+
parts.append(f"{key}={item.get(key)}")
|
|
533
|
+
if item.get("import_value_format") not in (None, ""):
|
|
534
|
+
parts.append(f"import_value_format={item.get('import_value_format')}")
|
|
535
|
+
if item.get("target_app_key") not in (None, ""):
|
|
536
|
+
parts.append(f"target_app_key={item.get('target_app_key')}")
|
|
537
|
+
options = item.get("options") if isinstance(item.get("options"), list) else []
|
|
538
|
+
if options:
|
|
539
|
+
parts.append(f"options={len(options)}")
|
|
540
|
+
bound_outputs = item.get("bound_output_fields") if isinstance(item.get("bound_output_fields"), list) else []
|
|
541
|
+
if bound_outputs:
|
|
542
|
+
parts.append("bound_outputs=" + ",".join(str(value) for value in bound_outputs[:5]))
|
|
543
|
+
aliases = item.get("configured_aliases") if isinstance(item.get("configured_aliases"), list) else []
|
|
544
|
+
if aliases:
|
|
545
|
+
parts.append("aliases=" + ",".join(str(value) for value in aliases[:5]))
|
|
546
|
+
if item.get("format_hint") not in (None, ""):
|
|
547
|
+
parts.append(f"hint={item.get('format_hint')}")
|
|
548
|
+
return " / ".join(parts)
|
|
549
|
+
|
|
550
|
+
|
|
455
551
|
def _format_record_get(result: dict[str, Any]) -> str:
|
|
456
552
|
record = result.get("record") if isinstance(result.get("record"), dict) else {}
|
|
457
553
|
app = result.get("app") if isinstance(result.get("app"), dict) else {}
|
|
@@ -1121,8 +1217,14 @@ def _format_builder_summary(result: dict[str, Any]) -> str:
|
|
|
1121
1217
|
"app_keys",
|
|
1122
1218
|
):
|
|
1123
1219
|
value = result.get(key)
|
|
1220
|
+
if not isinstance(value, list) and isinstance(data, dict):
|
|
1221
|
+
value = data.get(key)
|
|
1124
1222
|
if isinstance(value, list):
|
|
1125
1223
|
lines.append(f"{key}: {len(value)}")
|
|
1224
|
+
for item in value[:8]:
|
|
1225
|
+
lines.append("- " + _builder_item_summary(item))
|
|
1226
|
+
if len(value) > 8:
|
|
1227
|
+
lines.append(f"... {len(value) - 8} more")
|
|
1126
1228
|
components = result.get("components") if isinstance(result.get("components"), list) else []
|
|
1127
1229
|
if components:
|
|
1128
1230
|
lines.append("Component Refs:")
|
|
@@ -1155,6 +1257,53 @@ def _format_builder_summary(result: dict[str, Any]) -> str:
|
|
|
1155
1257
|
return "\n".join(lines) + "\n"
|
|
1156
1258
|
|
|
1157
1259
|
|
|
1260
|
+
def _builder_item_summary(item: Any) -> str:
|
|
1261
|
+
if not isinstance(item, dict):
|
|
1262
|
+
return str(item)
|
|
1263
|
+
preferred_keys = (
|
|
1264
|
+
"app_key",
|
|
1265
|
+
"appKey",
|
|
1266
|
+
"app_name",
|
|
1267
|
+
"appName",
|
|
1268
|
+
"package_id",
|
|
1269
|
+
"packageId",
|
|
1270
|
+
"package_name",
|
|
1271
|
+
"packageName",
|
|
1272
|
+
"dash_key",
|
|
1273
|
+
"dashKey",
|
|
1274
|
+
"dash_name",
|
|
1275
|
+
"dashName",
|
|
1276
|
+
"view_key",
|
|
1277
|
+
"viewKey",
|
|
1278
|
+
"view_name",
|
|
1279
|
+
"viewName",
|
|
1280
|
+
"chart_id",
|
|
1281
|
+
"chartId",
|
|
1282
|
+
"chart_name",
|
|
1283
|
+
"chartName",
|
|
1284
|
+
"field_id",
|
|
1285
|
+
"queId",
|
|
1286
|
+
"title",
|
|
1287
|
+
"queTitle",
|
|
1288
|
+
"name",
|
|
1289
|
+
"role_id",
|
|
1290
|
+
"roleId",
|
|
1291
|
+
"role_name",
|
|
1292
|
+
"roleName",
|
|
1293
|
+
"uid",
|
|
1294
|
+
"userId",
|
|
1295
|
+
"email",
|
|
1296
|
+
)
|
|
1297
|
+
parts = [
|
|
1298
|
+
f"{key}={item.get(key)}"
|
|
1299
|
+
for key in preferred_keys
|
|
1300
|
+
if item.get(key) not in (None, "", [], {})
|
|
1301
|
+
]
|
|
1302
|
+
if not parts:
|
|
1303
|
+
parts = _dict_scalar_lines(item)[:6]
|
|
1304
|
+
return " / ".join(parts) if parts else json.dumps(item, ensure_ascii=False)
|
|
1305
|
+
|
|
1306
|
+
|
|
1158
1307
|
def _format_file_upload_local(result: dict[str, Any]) -> str:
|
|
1159
1308
|
lines = [
|
|
1160
1309
|
f"Upload Kind: {result.get('upload_kind') or result.get('requested_upload_kind') or '-'}",
|
|
@@ -1389,6 +1538,7 @@ _FORMATTERS = {
|
|
|
1389
1538
|
"record_list": _format_record_list,
|
|
1390
1539
|
"record_access": _format_record_access,
|
|
1391
1540
|
"record_candidates": _format_record_candidates,
|
|
1541
|
+
"record_schema": _format_record_schema,
|
|
1392
1542
|
"record_get": _format_record_get,
|
|
1393
1543
|
"record_logs": _format_record_logs,
|
|
1394
1544
|
"record_write": _format_record_write,
|