@qingflow-tech/qingflow-app-builder-mcp 1.0.9 → 1.0.11
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 +2 -2
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/skills/qingflow-app-builder/SKILL.md +8 -0
- package/skills/qingflow-app-builder/references/create-app.md +39 -2
- package/skills/qingflow-app-builder/references/tool-selection.md +2 -2
- package/skills/qingflow-app-builder/references/update-views.md +2 -1
- package/src/qingflow_mcp/builder_facade/models.py +43 -2
- package/src/qingflow_mcp/builder_facade/service.py +1476 -172
- package/src/qingflow_mcp/cli/commands/app.py +3 -16
- package/src/qingflow_mcp/cli/commands/builder.py +68 -13
- package/src/qingflow_mcp/cli/commands/record.py +16 -1
- package/src/qingflow_mcp/cli/formatters.py +32 -1
- package/src/qingflow_mcp/cli/main.py +204 -3
- package/src/qingflow_mcp/public_surface.py +3 -1
- package/src/qingflow_mcp/response_trim.py +70 -13
- package/src/qingflow_mcp/server.py +10 -9
- package/src/qingflow_mcp/server_app_builder.py +53 -7
- package/src/qingflow_mcp/server_app_user.py +12 -15
- package/src/qingflow_mcp/solution/compiler/icon_utils.py +294 -0
- package/src/qingflow_mcp/tools/ai_builder_tools.py +1642 -75
- package/src/qingflow_mcp/tools/app_tools.py +53 -8
- package/src/qingflow_mcp/tools/package_tools.py +16 -2
- package/src/qingflow_mcp/tools/record_tools.py +1423 -70
- package/src/qingflow_mcp/tools/resource_read_tools.py +3 -0
|
@@ -58,7 +58,7 @@ def trim_public_response(tool_name: str | None, payload: dict[str, Any]) -> dict
|
|
|
58
58
|
return payload
|
|
59
59
|
if _looks_like_failure_payload(payload):
|
|
60
60
|
status = str(payload.get("status") or "").lower()
|
|
61
|
-
if tool_name in {"user:record_insert", "user:record_update"} and status in {
|
|
61
|
+
if tool_name in {"user:record_insert", "user:record_update", "user:record_delete"} and status in {
|
|
62
62
|
"blocked",
|
|
63
63
|
"needs_confirmation",
|
|
64
64
|
"partial_success",
|
|
@@ -73,8 +73,10 @@ def trim_success_response(tool_name: str | None, payload: dict[str, Any]) -> dic
|
|
|
73
73
|
return payload
|
|
74
74
|
trimmed = deepcopy(payload)
|
|
75
75
|
drop_keys = COMMON_SUCCESS_DROP_TOP
|
|
76
|
-
if tool_name
|
|
76
|
+
if tool_name in {"user:record_get", "user:record_logs_get"}:
|
|
77
77
|
drop_keys = COMMON_SUCCESS_DROP_TOP - {"output_profile"}
|
|
78
|
+
if tool_name in {"user:record_insert", "user:record_update", "user:record_delete"} and payload.get("ok") is False:
|
|
79
|
+
drop_keys = drop_keys - {"ok"}
|
|
78
80
|
_drop_top_keys(trimmed, drop_keys)
|
|
79
81
|
transformer = SUCCESS_POLICY_BY_TOOL.get(tool_name or "")
|
|
80
82
|
if transformer is not None:
|
|
@@ -292,7 +294,7 @@ def _trim_workspace_get(payload: JSONObject) -> None:
|
|
|
292
294
|
)
|
|
293
295
|
|
|
294
296
|
|
|
295
|
-
def
|
|
297
|
+
def _trim_app_list_like(payload: JSONObject) -> None:
|
|
296
298
|
payload.pop("apps", None)
|
|
297
299
|
_trim_item_list(payload, "items", allowed=("app_key", "app_name", "package_name"))
|
|
298
300
|
|
|
@@ -392,6 +394,10 @@ def _trim_record_write(payload: JSONObject) -> None:
|
|
|
392
394
|
data.pop("normalized_payload", None)
|
|
393
395
|
data.pop("human_review", None)
|
|
394
396
|
data.pop("action", None)
|
|
397
|
+
for key in ("update_route", "tried_routes"):
|
|
398
|
+
value = payload.get(key)
|
|
399
|
+
if value not in (None, [], {}, ""):
|
|
400
|
+
data[key] = value
|
|
395
401
|
resource = _compact_record_resource(data.get("resource"))
|
|
396
402
|
if resource:
|
|
397
403
|
data["resource"] = resource
|
|
@@ -420,7 +426,7 @@ def _trim_record_write(payload: JSONObject) -> None:
|
|
|
420
426
|
def _trim_record_write_batch(payload: JSONObject, data: JSONObject) -> None:
|
|
421
427
|
data.pop("items", None)
|
|
422
428
|
data.pop("debug", None)
|
|
423
|
-
for key in ("summary", "
|
|
429
|
+
for key in ("summary", "app_key", "mode"):
|
|
424
430
|
if data.get(key) in (None, [], {}, ""):
|
|
425
431
|
data.pop(key, None)
|
|
426
432
|
items = payload.get("items")
|
|
@@ -437,6 +443,8 @@ def _trim_record_write_batch(payload: JSONObject, data: JSONObject) -> None:
|
|
|
437
443
|
"write_executed",
|
|
438
444
|
"verification_status",
|
|
439
445
|
"safe_to_retry",
|
|
446
|
+
"update_route",
|
|
447
|
+
"tried_routes",
|
|
440
448
|
"failed_fields",
|
|
441
449
|
"confirmation_requests",
|
|
442
450
|
"blockers",
|
|
@@ -449,10 +457,8 @@ def _trim_record_write_batch(payload: JSONObject, data: JSONObject) -> None:
|
|
|
449
457
|
for item in items
|
|
450
458
|
if isinstance(item, dict)
|
|
451
459
|
]
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
if value in (None, [], {}, ""):
|
|
455
|
-
payload.pop(key, None)
|
|
460
|
+
if payload.get("items") in (None, [], {}, ""):
|
|
461
|
+
payload.pop("items", None)
|
|
456
462
|
|
|
457
463
|
|
|
458
464
|
def _trim_record_get(payload: JSONObject) -> None:
|
|
@@ -668,6 +674,49 @@ def _trim_record_access(payload: JSONObject) -> None:
|
|
|
668
674
|
payload.update(compact)
|
|
669
675
|
|
|
670
676
|
|
|
677
|
+
def _trim_record_logs(payload: JSONObject) -> None:
|
|
678
|
+
compact: dict[str, Any] = {}
|
|
679
|
+
for key in (
|
|
680
|
+
"ok",
|
|
681
|
+
"status",
|
|
682
|
+
"output_profile",
|
|
683
|
+
"app",
|
|
684
|
+
"view",
|
|
685
|
+
"record",
|
|
686
|
+
"local_dir",
|
|
687
|
+
"summary_path",
|
|
688
|
+
"warnings",
|
|
689
|
+
"unavailable_context",
|
|
690
|
+
"context_integrity",
|
|
691
|
+
):
|
|
692
|
+
value = payload.get(key)
|
|
693
|
+
if value is not None:
|
|
694
|
+
compact[key] = value
|
|
695
|
+
for key in ("data_logs", "workflow_logs"):
|
|
696
|
+
node = payload.get(key)
|
|
697
|
+
if isinstance(node, dict):
|
|
698
|
+
compact[key] = _pick(
|
|
699
|
+
node,
|
|
700
|
+
(
|
|
701
|
+
"status",
|
|
702
|
+
"visible",
|
|
703
|
+
"source",
|
|
704
|
+
"reason",
|
|
705
|
+
"complete",
|
|
706
|
+
"items_count",
|
|
707
|
+
"pages_fetched",
|
|
708
|
+
"page_size",
|
|
709
|
+
"reported_total",
|
|
710
|
+
"local_path",
|
|
711
|
+
"preview_items",
|
|
712
|
+
"warnings",
|
|
713
|
+
"stopped_reason",
|
|
714
|
+
),
|
|
715
|
+
)
|
|
716
|
+
payload.clear()
|
|
717
|
+
payload.update(compact)
|
|
718
|
+
|
|
719
|
+
|
|
671
720
|
def _trim_record_analyze(payload: JSONObject) -> None:
|
|
672
721
|
summary: dict[str, Any] = {}
|
|
673
722
|
completeness = payload.get("completeness")
|
|
@@ -714,13 +763,18 @@ def _trim_record_delete(payload: JSONObject) -> None:
|
|
|
714
763
|
if not isinstance(data, dict):
|
|
715
764
|
return
|
|
716
765
|
resource = data.get("resource")
|
|
717
|
-
deleted_ids
|
|
718
|
-
if isinstance(
|
|
766
|
+
deleted_ids = payload.get("deleted_ids") if isinstance(payload.get("deleted_ids"), list) else data.get("deleted_ids")
|
|
767
|
+
failed_ids = payload.get("failed_ids") if isinstance(payload.get("failed_ids"), list) else data.get("failed_ids")
|
|
768
|
+
if not isinstance(deleted_ids, list):
|
|
769
|
+
deleted_ids = []
|
|
770
|
+
if not isinstance(failed_ids, list):
|
|
771
|
+
failed_ids = []
|
|
772
|
+
if not deleted_ids and isinstance(resource, dict):
|
|
719
773
|
raw_ids = resource.get("record_ids") or resource.get("apply_ids") or resource.get("applyIds")
|
|
720
774
|
if isinstance(raw_ids, list):
|
|
721
775
|
deleted_ids = [str(item) for item in raw_ids if item not in (None, "")]
|
|
722
|
-
data["deleted_ids"] = deleted_ids
|
|
723
|
-
data
|
|
776
|
+
data["deleted_ids"] = [str(item) for item in deleted_ids if item not in (None, "")]
|
|
777
|
+
data["failed_ids"] = [str(item) for item in failed_ids if item not in (None, "")]
|
|
724
778
|
for key in (
|
|
725
779
|
"resource",
|
|
726
780
|
"action",
|
|
@@ -979,7 +1033,7 @@ _register_policy((USER_DOMAIN, BUILDER_DOMAIN), ("auth_use_credential", "auth_wh
|
|
|
979
1033
|
_register_policy((USER_DOMAIN, BUILDER_DOMAIN), ("auth_logout",), _trim_auth_logout)
|
|
980
1034
|
_register_policy((USER_DOMAIN, BUILDER_DOMAIN), ("workspace_list",), _trim_workspace_list)
|
|
981
1035
|
_register_policy((USER_DOMAIN, BUILDER_DOMAIN), ("workspace_get", "workspace_select"), _trim_workspace_get)
|
|
982
|
-
_register_policy((USER_DOMAIN,), ("app_list",
|
|
1036
|
+
_register_policy((USER_DOMAIN,), ("app_list",), _trim_app_list_like)
|
|
983
1037
|
_register_policy((USER_DOMAIN, BUILDER_DOMAIN), ("app_get",), _trim_app_get)
|
|
984
1038
|
_register_policy((BUILDER_DOMAIN,), ("app_repair_code_blocks",), _trim_builder_list_like)
|
|
985
1039
|
_register_policy((USER_DOMAIN, BUILDER_DOMAIN), ("portal_list", "portal_get", "view_get", "chart_get"), _trim_builder_list_like)
|
|
@@ -1022,6 +1076,7 @@ _register_policy((USER_DOMAIN,), ("record_insert", "record_update"), _trim_recor
|
|
|
1022
1076
|
_register_policy((USER_DOMAIN,), ("record_get",), _trim_record_get)
|
|
1023
1077
|
_register_policy((USER_DOMAIN,), ("record_list",), _trim_record_list)
|
|
1024
1078
|
_register_policy((USER_DOMAIN,), ("record_access",), _trim_record_access)
|
|
1079
|
+
_register_policy((USER_DOMAIN,), ("record_logs_get",), _trim_record_logs)
|
|
1025
1080
|
_register_policy((USER_DOMAIN,), ("record_analyze",), _trim_record_analyze)
|
|
1026
1081
|
_register_policy((USER_DOMAIN,), ("record_code_block_run",), _trim_code_block_run)
|
|
1027
1082
|
_register_policy((USER_DOMAIN,), ("task_list",), _trim_task_list)
|
|
@@ -1062,6 +1117,8 @@ _register_policy(
|
|
|
1062
1117
|
(BUILDER_DOMAIN,),
|
|
1063
1118
|
(
|
|
1064
1119
|
"builder_tool_contract",
|
|
1120
|
+
"workspace_icon_catalog_get",
|
|
1121
|
+
"package_list",
|
|
1065
1122
|
"package_get",
|
|
1066
1123
|
"package_apply",
|
|
1067
1124
|
"solution_install",
|
|
@@ -48,7 +48,7 @@ All resource tools operate with the logged-in user's Qingflow permissions.
|
|
|
48
48
|
|
|
49
49
|
## App Discovery
|
|
50
50
|
|
|
51
|
-
If `app_key` is unknown, use `app_list`
|
|
51
|
+
If `app_key` is unknown, use `app_list` first. Pass `query` to filter visible apps by keyword.
|
|
52
52
|
If the app is known but the data range is not, use `app_get` first and choose from `accessible_views`.
|
|
53
53
|
If an accessible view has `analysis_supported=false`, do not use it for `record_access` or `record_list`. `boardView` and `ganttView` are special UI views, not data-access targets.
|
|
54
54
|
`view_get(view_id=...)` also returns `export_capability`; it only means there is a supported export route, not that export permission has been verified.
|
|
@@ -56,9 +56,9 @@ If an accessible view has `analysis_supported=false`, do not use it for `record_
|
|
|
56
56
|
## Schema-First Rule
|
|
57
57
|
|
|
58
58
|
Call `record_insert_schema_get` before `record_insert`.
|
|
59
|
-
|
|
59
|
+
For simple field changes after the target record is clear, call `record_update` directly. Use `record_update_schema_get` for diagnostics, ambiguous fields, or complex writable-scope inspection.
|
|
60
60
|
Call `record_code_block_schema_get` before `record_code_block_run`.
|
|
61
|
-
Call `app_get` first when the data range is unclear, then use `record_browse_schema_get(view_id=...)` before `record_access`, `record_list`, or `
|
|
61
|
+
Call `app_get` first when the data range is unclear, then use `record_browse_schema_get(view_id=...)` before `record_access`, `record_list`, `record_get`, or `record_logs_get`.
|
|
62
62
|
Call `record_import_schema_get` when the import field mapping is unclear before template download or verify.
|
|
63
63
|
|
|
64
64
|
- All `field_id` values must come from the schema response.
|
|
@@ -67,7 +67,7 @@ Call `record_import_schema_get` when the import field mapping is unclear before
|
|
|
67
67
|
## Schema Scope
|
|
68
68
|
|
|
69
69
|
`record_insert_schema_get` returns the current user's insert-ready applicant schema; read `required_fields`, `optional_fields`, `runtime_linked_required_fields`, and `payload_template`.
|
|
70
|
-
`record_update_schema_get` returns the current record's overall update-ready writable field set across matched accessible views; read `writable_fields` and `
|
|
70
|
+
`record_update_schema_get` returns the current record's overall update-ready writable field set and route diagnostics across matched accessible views; read `writable_fields`, `payload_template`, `available_update_routes`, and `recommended_update_route`.
|
|
71
71
|
`record_browse_schema_get(view_id=...)` returns the same readable fields shown in the selected Qingflow table view header.
|
|
72
72
|
`record_access.fields` / CSV columns and `record_list.columns / where / order_by / query_fields` use that exact same view schema.
|
|
73
73
|
`record_code_block_schema_get` returns code-block-ready schema for exact code block field selection.
|
|
@@ -103,9 +103,9 @@ Analysis answers must include concrete numbers. When applicable, include percent
|
|
|
103
103
|
|
|
104
104
|
## Record CRUD Path
|
|
105
105
|
|
|
106
|
-
`app_get -> record_browse_schema_get(view_id=...) -> record_list / record_get`
|
|
106
|
+
`app_get -> record_browse_schema_get(view_id=...) -> record_list / record_get / record_logs_get`
|
|
107
107
|
`record_insert_schema_get -> record_insert(items)`
|
|
108
|
-
`record_update_schema_get -> record_update`
|
|
108
|
+
`record_update` for simple updates; `record_update_schema_get -> record_update` when the writable field scope is unclear.
|
|
109
109
|
`record_list / record_get -> record_delete`
|
|
110
110
|
`record_code_block_schema_get -> record_code_block_run`
|
|
111
111
|
|
|
@@ -116,15 +116,16 @@ Analysis answers must include concrete numbers. When applicable, include percent
|
|
|
116
116
|
- Legacy forms such as bare integer `field_id`, `fieldId`, `operator`, `values`, or `order` may still parse, but they are compatibility-only and not the canonical DSL
|
|
117
117
|
|
|
118
118
|
- `record_insert` defaults to an applicant-node `items` array; each item contains a field-title keyed `fields` map. A single insert is one item.
|
|
119
|
-
- `record_update` uses a field-title keyed `fields` map
|
|
119
|
+
- `record_update` uses a field-title keyed `fields` map. It first tries the data-manager direct update route, then falls back to the frontend custom-view detail edit route when the selected view can cover the payload; if a unique current-user todo task for the same record exposes editable fields, it can finally use the workflow save-only route. Read `update_route` and `tried_routes` after execution.
|
|
120
120
|
- For insert, `runtime_linked_required_fields` means required-but-not-directly-writable fields that are usually supplied by runtime linkage or upstream context.
|
|
121
121
|
- For insert, fields marked `may_become_required=true` stay in `optional_fields`; they are still directly writable, but linked visibility or option-driven rules can make them required at runtime.
|
|
122
122
|
- Read field-level `linkage` whenever present on `record_insert_schema_get` or `record_update_schema_get`; it is the static hint for linked visibility, reference-driven auto fill, and formula/default auto-fill behavior.
|
|
123
123
|
- `linkage.sources` lists upstream field titles that influence the current field; `linkage.affects_fields` lists downstream fields that may change when the current field changes.
|
|
124
124
|
- `linkage.kind=logic_visibility` means linked visibility or option-driven rules are involved; `linkage.kind=reference_fill` means reference/default matching logic is involved; `linkage.kind=formula_fill` means formula/default auto-fill logic is involved.
|
|
125
|
-
- `record_update_schema_get` exposes the overall writable field set for the record, but not every field combination is guaranteed; `record_update` still needs one single matched
|
|
125
|
+
- `record_update_schema_get` exposes the overall writable field set and route candidates for the record, but not every field combination is guaranteed; `record_update` still needs data-manager permission, one single matched custom view that can cover the payload, or one unique editable current-user todo task.
|
|
126
126
|
- `record_delete` deletes by `record_id` or `record_ids`.
|
|
127
127
|
- `record_get` is the single-record frontend detail context tool. It returns detail-page visible fields, one-level relation targets, first-page data/workflow logs, associated views/reports, local readable image assets, local downloadable file assets, unavailable context, and `semantic_context`.
|
|
128
|
+
- Use `record_logs_get` only when the user needs the full visible data/workflow log history for a specific record. It writes JSONL files locally and returns file paths plus completeness metadata; do not expect full log arrays in the response.
|
|
128
129
|
- Read record images from `record_get.media_assets.items[].local_path` when `readable_by_agent=true`; read attachments/documents/tables from `record_get.file_assets.items[].local_path` and `extraction.text_path` when present. `record_get` follows the frontend storage cookie redirect path for Qingflow attachments, and remote file URLs should not be treated as directly readable.
|
|
129
130
|
- `record_get.columns` are focus hints only; they do not project the detail fields. Read facts from top-level `fields[]`.
|
|
130
131
|
- When readback shape matters after insert or update, prefer `record_get` for human/detail-page context, or `record_list(..., output_profile="normalized")` for batch-shaped normalized rows.
|
|
@@ -185,7 +186,7 @@ Use `record_code_block_run` when the user wants to execute a form code-block fie
|
|
|
185
186
|
- `task_action_execute(task_id=..., action=...)` is also supported; MCP resolves the current todo locator internally before calling the real action route.
|
|
186
187
|
- `task_workflow_log_get(task_id=...)` and `task_associated_report_detail_get(task_id=...)` are also supported for the current todo context.
|
|
187
188
|
- Use `task_associated_report_detail_get` for associated view or report details.
|
|
188
|
-
- Use `task_workflow_log_get` for
|
|
189
|
+
- Use `task_workflow_log_get` for the current task context workflow log page. For full record-level data/workflow logs, use `record_logs_get(app_key, record_id, view_id?)`.
|
|
189
190
|
- Task actions operate on `app_key + record_id + workflow_node_id`, not `task_id`.
|
|
190
191
|
|
|
191
192
|
## Time Handling
|
|
@@ -35,15 +35,18 @@ def build_builder_server() -> FastMCP:
|
|
|
35
35
|
"Follow the resource path resolve -> summary read -> apply -> publish_verify. "
|
|
36
36
|
"Use builder_tool_contract when you need a machine-readable contract, aliases, allowed enums, or a minimal valid example for a public builder tool. "
|
|
37
37
|
"Use solution_install when the user explicitly wants to install a packaged solution/template by solution_key, optionally copying bundled demo data. "
|
|
38
|
-
"
|
|
38
|
+
"Use package_list to find visible app packages by keyword and package_get to read package detail before editing; if creating or updating an app package may be appropriate, use package_apply with explicit user intent; otherwise use app_resolve to locate app resources, "
|
|
39
|
+
"Use workspace_icon_catalog_get before creating app packages, apps, or portals when supported icon/color candidates are needed; new workspace resources require explicit non-template icon + color, and the CLI validates choices without inferring business defaults. "
|
|
39
40
|
"app_get as the default app map read, then app_get_fields/app_repair_code_blocks/app_get_layout/app_get_views/app_get_flow/app_get_charts/portal_list/portal_get/view_get/chart_get for focused configuration reads, "
|
|
40
41
|
"member_search/role_search/role_create when workflow assignees must come from the directory or role catalog, preferring roles over explicit members unless the user explicitly names members, "
|
|
41
|
-
"then app_schema_apply/app_layout_apply/app_flow_apply/app_views_apply/app_custom_buttons_apply/app_associated_resources_apply/app_charts_apply/portal_apply to execute normalized patches; these apply tools perform planning, normalization, and dependency checks internally where applicable. Schema/layout/views noop requests skip publish, app_custom_buttons_apply and app_associated_resources_apply publish after at least one write succeeds and expose no draft-only parameter, charts are immediate-live without publish and resolve targets by chart_id first then exact unique chart name, portal updates use replace semantics only when sections are supplied and edit-mode base-info-only updates may omit sections, publish=false only guarantees draft/base-info updates for tools that still expose that parameter, and flow should use publish=false whenever you only want draft/precheck behavior. "
|
|
42
|
+
"then app_schema_apply/app_layout_apply/app_flow_apply/app_views_apply/app_custom_buttons_apply/app_associated_resources_apply/app_charts_apply/portal_apply to execute normalized patches; these apply tools perform planning, normalization, and dependency checks internally where applicable. Schema/layout/views noop requests skip publish, app_custom_buttons_apply and app_associated_resources_apply publish after at least one write succeeds and expose no draft-only parameter, charts are immediate-live without publish and resolve targets by chart_id first then exact unique chart name, portal updates use replace semantics only when sections are supplied and edit-mode base-info-only updates may omit sections, portal pc layout is a 24-column grid and mobile is a 6-column grid so omit position or use layout_preset when unsure, publish=false only guarantees draft/base-info updates for tools that still expose that parameter, and flow should use publish=false whenever you only want draft/precheck behavior. "
|
|
43
|
+
"Builder apply/write outputs include schema_version, operation, summary, and resources[]; use resources[].id/key/name/ids/parent as the stable UI and agent display entry, and keep legacy fields such as field_diff/views_diff/chart_results only for compatibility or troubleshooting. "
|
|
42
44
|
"For existing object parameter replacement, prefer patch_views, patch_buttons, patch_resources, and patch_charts with set/unset; the tool reads current config and full-saves internally, while upsert_* is for creation or full target configuration and should not be used as an incomplete partial update. "
|
|
43
|
-
"For
|
|
44
|
-
"For
|
|
45
|
+
"For builder delete/remove apply results, separate delete execution from readback verification: after DELETE is sent, resources expose delete_executed, readback_status, and safe_to_retry_delete=false. If readback_status is unavailable or still_exists, do not blindly repeat the delete; confirm later with app_get/view_get/chart_get or the relevant apply readback. Views/buttons use single-item readback; associated resources use one app-level resource-pool readback because there is no confirmed single-item GET. "
|
|
46
|
+
"For app_schema_apply, configure data title and data cover directly in field JSON with as_data_title=true and as_data_cover=true; data title is required and exactly one field may be marked, while data cover is optional and must be a top-level attachment field. For multi-app creation, pass apps[]/--apps-file on app_schema_apply; each item may have client_key, and relation fields may use target_app_ref to point at another same-call client_key. "
|
|
47
|
+
"For app_views_apply, keep fixed saved filters in filters and configure the frontend query panel separately with query_conditions; query_conditions.rows is a matrix of field names compiled to backend queryCondition queIds. New views default associated report/view display to visible with limit_type=all; existing views preserve their current associated display unless associated_resources is explicitly patched. "
|
|
45
48
|
"For custom button body create/update/delete and view placement, use app_custom_buttons_apply. For addData buttons, prefer trigger_add_data_config.target_app_key + field_mappings/default_values; do not ask agents to write raw que_relation unless maintaining a legacy config. field_mappings.source_field accepts source schema fields and supported system fields: 数据ID/row_record_id/apply_id/_id means current record id (-17), 编号/record_number means visible record number (0). To fill a target relation with the current record, map {'source_field': '数据ID', 'target_field': '目标引用字段'}; default_values is only for static constants. View button bindings merge by default and merge-mode view_configs must include buttons; use view_configs[].mode=replace or explicit buttons=[] only when clearing/replacing existing bindings is intended. Builder view_key arguments are raw keys from app_get.views[].view_key and must not be prefixed with custom:. "
|
|
46
|
-
"For BI reports, keep report-body development separate from Qingflow in-app display: use app_charts_apply to create, update, remove, or reorder app-source QingBI chart bodies/configs with dataSourceType=qingflow; dataset BI reports are not created or edited by app_charts_apply yet and should be created in QingBI first, then attached with app_associated_resources_apply using report_source=dataset. "
|
|
49
|
+
"For BI reports, keep report-body development separate from Qingflow in-app display: use app_charts_apply to create, update, remove, or reorder app-source QingBI chart bodies/configs with dataSourceType=qingflow; chart dimension/metric/filter/query fields must come from app_get_fields.chart_fields, not record schema or form-only fields; dataset BI reports are not created or edited by app_charts_apply yet and should be created in QingBI first, then attached with app_associated_resources_apply using report_source=dataset. "
|
|
47
50
|
"For associated views/reports, use app_associated_resources_apply. Use match_mappings for filtering associated resources: dynamic current-record conditions use source_field, static conditions use value. match_mappings also supports 数据ID(-17) and 编号(0). Do not ask agents to write raw match_rules unless preserving a legacy backend config. "
|
|
48
51
|
"For associated reports/views, use app_associated_resources_apply for both the app-level associated_resources pool and per-view display config; associated_item_id is the app-level form_asos_chart.id, and view_configs/remove/reorder may also pass an existing resource's chart_id/chart_key/view_key because the tool resolves those to the internal id. Before creating an associated resource, read app_get.associated_resources and reuse an existing matching target_app_key + view_key/chart_key through patch_resources; client_key only works inside one apply call and is not persisted. Do not ask agents to pass backend raw sourceType: views infer the internal Qingflow view source, reports default to BI app reports, and dataset reports use report_source=dataset. "
|
|
49
52
|
"For code_block fields with output bindings, always use qf_output assignment rather than const/let qf_output, and use app_repair_code_blocks when an existing form hangs because output-bound fields stay loading. "
|
|
@@ -176,6 +179,14 @@ def build_builder_server() -> FastMCP:
|
|
|
176
179
|
def builder_tool_contract(tool_name: str = "") -> dict:
|
|
177
180
|
return ai_builder.builder_tool_contract(tool_name=tool_name)
|
|
178
181
|
|
|
182
|
+
@server.tool()
|
|
183
|
+
def workspace_icon_catalog_get(profile: str = DEFAULT_PROFILE) -> dict:
|
|
184
|
+
return ai_builder.workspace_icon_catalog_get(profile=profile)
|
|
185
|
+
|
|
186
|
+
@server.tool()
|
|
187
|
+
def package_list(profile: str = DEFAULT_PROFILE, trial_status: str = "all", query: str = "") -> dict:
|
|
188
|
+
return ai_builder.package_list(profile=profile, trial_status=trial_status, query=query)
|
|
189
|
+
|
|
179
190
|
@server.tool()
|
|
180
191
|
def package_get(profile: str = DEFAULT_PROFILE, package_id: int = 0) -> dict:
|
|
181
192
|
return ai_builder.package_get(profile=profile, package_id=package_id)
|
|
@@ -407,7 +418,30 @@ def build_builder_server() -> FastMCP:
|
|
|
407
418
|
add_fields: list[dict] | None = None,
|
|
408
419
|
update_fields: list[dict] | None = None,
|
|
409
420
|
remove_fields: list[dict] | None = None,
|
|
421
|
+
apps: list[dict] | None = None,
|
|
410
422
|
) -> dict:
|
|
423
|
+
if apps:
|
|
424
|
+
if app_key or app_name or app_title or add_fields or update_fields or remove_fields:
|
|
425
|
+
return _config_failure(
|
|
426
|
+
"app_schema_apply multi-app mode accepts package_id/create_if_missing plus apps only.",
|
|
427
|
+
fix_hint="Use `apps` for batch mode, or use the single-app arguments without `apps`.",
|
|
428
|
+
)
|
|
429
|
+
if package_id is None:
|
|
430
|
+
return _config_failure(
|
|
431
|
+
"app_schema_apply multi-app mode requires package_id.",
|
|
432
|
+
fix_hint="Pass `package_id` and `apps[].app_name` for new apps, or `apps[].app_key` for existing apps.",
|
|
433
|
+
)
|
|
434
|
+
return ai_builder.app_schema_apply(
|
|
435
|
+
profile=profile,
|
|
436
|
+
package_id=package_id,
|
|
437
|
+
visibility=visibility,
|
|
438
|
+
create_if_missing=create_if_missing,
|
|
439
|
+
publish=publish,
|
|
440
|
+
add_fields=[],
|
|
441
|
+
update_fields=[],
|
|
442
|
+
remove_fields=[],
|
|
443
|
+
apps=apps,
|
|
444
|
+
)
|
|
411
445
|
has_app_key = bool((app_key or "").strip())
|
|
412
446
|
has_app_name = bool((app_name or "").strip())
|
|
413
447
|
has_app_title = bool((app_title or "").strip())
|
|
@@ -437,6 +471,7 @@ def build_builder_server() -> FastMCP:
|
|
|
437
471
|
add_fields=add_fields or [],
|
|
438
472
|
update_fields=update_fields or [],
|
|
439
473
|
remove_fields=remove_fields or [],
|
|
474
|
+
apps=[],
|
|
440
475
|
)
|
|
441
476
|
|
|
442
477
|
@server.tool()
|
|
@@ -508,9 +543,12 @@ def build_builder_server() -> FastMCP:
|
|
|
508
543
|
profile: str = DEFAULT_PROFILE,
|
|
509
544
|
dash_key: str = "",
|
|
510
545
|
dash_name: str = "",
|
|
546
|
+
name: str = "",
|
|
511
547
|
package_id: int | None = None,
|
|
512
548
|
publish: bool = True,
|
|
513
549
|
sections: list[dict] | None = None,
|
|
550
|
+
pages: list[dict] | None = None,
|
|
551
|
+
layout_preset: str = "",
|
|
514
552
|
visibility: dict | None = None,
|
|
515
553
|
auth: dict | None = None,
|
|
516
554
|
icon: str | None = None,
|
|
@@ -518,10 +556,14 @@ def build_builder_server() -> FastMCP:
|
|
|
518
556
|
hide_copyright: bool | None = None,
|
|
519
557
|
dash_global_config: dict | None = None,
|
|
520
558
|
config: dict | None = None,
|
|
559
|
+
payload: dict | None = None,
|
|
521
560
|
) -> dict:
|
|
561
|
+
payload = payload if isinstance(payload, dict) else {}
|
|
522
562
|
has_dash_key = bool((dash_key or "").strip())
|
|
523
|
-
|
|
524
|
-
|
|
563
|
+
effective_dash_name = (dash_name or name or str(payload.get("dash_name") or payload.get("dashName") or payload.get("name") or "")).strip()
|
|
564
|
+
has_dash_name = bool(effective_dash_name)
|
|
565
|
+
effective_package_id = package_id if package_id is not None else payload.get("package_id") or payload.get("packageId") or payload.get("package_tag_id")
|
|
566
|
+
has_package_id = effective_package_id is not None
|
|
525
567
|
if has_dash_key and has_package_id:
|
|
526
568
|
return _config_failure(
|
|
527
569
|
"portal_apply accepts exactly one selector mode.",
|
|
@@ -536,9 +578,12 @@ def build_builder_server() -> FastMCP:
|
|
|
536
578
|
profile=profile,
|
|
537
579
|
dash_key=dash_key,
|
|
538
580
|
dash_name=dash_name,
|
|
581
|
+
name=name,
|
|
539
582
|
package_id=package_id,
|
|
540
583
|
publish=publish,
|
|
541
584
|
sections=sections or [],
|
|
585
|
+
pages=pages or [],
|
|
586
|
+
layout_preset=layout_preset,
|
|
542
587
|
visibility=visibility,
|
|
543
588
|
auth=auth,
|
|
544
589
|
icon=icon,
|
|
@@ -546,6 +591,7 @@ def build_builder_server() -> FastMCP:
|
|
|
546
591
|
hide_copyright=hide_copyright,
|
|
547
592
|
dash_global_config=dash_global_config,
|
|
548
593
|
config=config or {},
|
|
594
|
+
payload=payload,
|
|
549
595
|
)
|
|
550
596
|
|
|
551
597
|
@server.tool()
|
|
@@ -31,7 +31,7 @@ def build_user_server() -> FastMCP:
|
|
|
31
31
|
|
|
32
32
|
## App Discovery
|
|
33
33
|
|
|
34
|
-
If `app_key` is unknown, use `app_list`
|
|
34
|
+
If `app_key` is unknown, use `app_list` first. Pass `query` to filter visible apps by keyword.
|
|
35
35
|
If the app is known but the data range is not, use `app_get` first and choose from `accessible_views`.
|
|
36
36
|
If an accessible view has `analysis_supported=false`, do not use it for `record_access` or `record_list`. `boardView` and `ganttView` are special UI views, not data-access targets.
|
|
37
37
|
`view_get(view_id=...)` also returns `export_capability`; it only means there is a supported export route, not that export permission has been verified.
|
|
@@ -47,9 +47,9 @@ If an accessible view has `analysis_supported=false`, do not use it for `record_
|
|
|
47
47
|
## Schema-First Rule
|
|
48
48
|
|
|
49
49
|
Call `record_insert_schema_get` before `record_insert`.
|
|
50
|
-
|
|
50
|
+
For simple field changes after the target record is clear, call `record_update` directly. Use `record_update_schema_get` for diagnostics, ambiguous fields, or complex writable-scope inspection.
|
|
51
51
|
Call `record_code_block_schema_get` before `record_code_block_run`.
|
|
52
|
-
Call `app_get` first when the data range is unclear, then use `record_browse_schema_get(view_id=...)` before `record_access`, `record_list`, or `
|
|
52
|
+
Call `app_get` first when the data range is unclear, then use `record_browse_schema_get(view_id=...)` before `record_access`, `record_list`, `record_get`, or `record_logs_get`.
|
|
53
53
|
Call `record_import_schema_get` when the import field mapping is unclear before template download or verify.
|
|
54
54
|
|
|
55
55
|
- All `field_id` values must come from the schema response.
|
|
@@ -59,7 +59,7 @@ Call `record_import_schema_get` when the import field mapping is unclear before
|
|
|
59
59
|
|
|
60
60
|
`record_insert_schema_get` returns the current user's insert-ready applicant schema; read `required_fields`, `optional_fields`, `runtime_linked_required_fields`, and `payload_template`.
|
|
61
61
|
Inside `optional_fields`, any field with `may_become_required=true` is still writable, but may become required when linked visibility or option-driven runtime rules activate.
|
|
62
|
-
`record_update_schema_get` returns the current record's overall update-ready writable field set across matched accessible views; read `writable_fields` and `
|
|
62
|
+
`record_update_schema_get` returns the current record's overall update-ready writable field set and route diagnostics across matched accessible views; read `writable_fields`, `payload_template`, `available_update_routes`, and `recommended_update_route`.
|
|
63
63
|
`record_browse_schema_get(view_id=...)` returns the same readable fields shown in the selected Qingflow table view header.
|
|
64
64
|
`record_access.fields` / CSV columns and `record_list.columns / where / order_by / query_fields` use that exact same view schema; a missing field means it is not readable in that view.
|
|
65
65
|
`searchQueIds` is a backend full-text search scope, not an output-column/projection mechanism.
|
|
@@ -102,9 +102,9 @@ Analysis answers must include concrete numbers. When applicable, include percent
|
|
|
102
102
|
|
|
103
103
|
## Record CRUD Path
|
|
104
104
|
|
|
105
|
-
`app_get -> record_browse_schema_get(view_id=...) -> record_list / record_get`
|
|
105
|
+
`app_get -> record_browse_schema_get(view_id=...) -> record_list / record_get / record_logs_get`
|
|
106
106
|
`record_insert_schema_get -> record_insert(items)`
|
|
107
|
-
`record_update_schema_get -> record_update`
|
|
107
|
+
`record_update` for simple updates; `record_update_schema_get -> record_update` when the writable field scope is unclear.
|
|
108
108
|
`record_list / record_get -> record_delete`
|
|
109
109
|
`record_code_block_schema_get -> record_code_block_run`
|
|
110
110
|
`portal_list -> portal_get -> chart_get / view_get`
|
|
@@ -117,15 +117,16 @@ Analysis answers must include concrete numbers. When applicable, include percent
|
|
|
117
117
|
- Legacy forms such as bare integer `field_id`, `fieldId`, `operator`, `values`, or `order` may still parse, but they are compatibility-only and not the canonical DSL
|
|
118
118
|
|
|
119
119
|
- `record_insert` defaults to an applicant-node `items` array; each item contains a field-title keyed `fields` map. A single insert is one item.
|
|
120
|
-
- `record_update` uses a field-title keyed `fields` map
|
|
120
|
+
- `record_update` uses a field-title keyed `fields` map. It first tries the data-manager direct update route, then falls back to the frontend custom-view detail edit route when the selected view can cover the payload; if a unique current-user todo task for the same record exposes editable fields, it can finally use the workflow save-only route. Read `update_route` and `tried_routes` after execution.
|
|
121
121
|
- For insert, `runtime_linked_required_fields` means required-but-not-directly-writable fields that are usually supplied by runtime linkage or upstream context.
|
|
122
122
|
- For insert, fields marked `may_become_required=true` stay in `optional_fields`; they are still directly writable, but linked visibility or option-driven rules can make them required at runtime.
|
|
123
123
|
- Read field-level `linkage` whenever present on `record_insert_schema_get` or `record_update_schema_get`; it is the static hint for linked visibility, reference-driven auto fill, and formula/default auto-fill behavior.
|
|
124
124
|
- `linkage.sources` lists upstream field titles that influence the current field; `linkage.affects_fields` lists downstream fields that may change when the current field changes.
|
|
125
125
|
- `linkage.kind=logic_visibility` means linked visibility or option-driven rules are involved; `linkage.kind=reference_fill` means reference/default matching logic is involved; `linkage.kind=formula_fill` means formula/default auto-fill logic is involved.
|
|
126
|
-
- `record_update_schema_get` exposes the overall writable field set for the record, but not every field combination is guaranteed; `record_update` still needs one single matched
|
|
126
|
+
- `record_update_schema_get` exposes the overall writable field set and update route candidates for the record, but not every field combination is guaranteed; `record_update` still needs data-manager permission, one single matched custom view that can cover the payload, or one unique editable current-user todo task.
|
|
127
127
|
- `record_delete` deletes by `record_id` or `record_ids`.
|
|
128
128
|
- `record_get` is the single-record frontend detail context tool. It returns detail-page visible fields, one-level relation targets, first-page data/workflow logs, associated views/reports, local readable image assets, local downloadable file assets, unavailable context, and `semantic_context`.
|
|
129
|
+
- Use `record_logs_get` only when the user needs the full visible data/workflow log history for a specific record. It writes JSONL files locally and returns file paths plus completeness metadata; do not expect full log arrays in the response.
|
|
129
130
|
- Read record images from `record_get.media_assets.items[].local_path` when `readable_by_agent=true`; read attachments/documents/tables from `record_get.file_assets.items[].local_path` and `extraction.text_path` when present. `record_get` follows the frontend storage cookie redirect path for Qingflow attachments, and remote file URLs should not be treated as directly readable.
|
|
130
131
|
- `record_get.columns` are focus hints only; they do not project the detail fields. Read facts from top-level `fields[]`.
|
|
131
132
|
- When readback shape matters after insert or update, prefer `record_get` for human/detail-page context, or `record_list(..., output_profile="normalized")` for batch-shaped normalized rows.
|
|
@@ -190,7 +191,7 @@ Use export only when the user explicitly asks to export/download/generate an Exc
|
|
|
190
191
|
- `task_action_execute(task_id=..., action=...)` is also supported; MCP resolves the current todo locator internally before calling the real action route.
|
|
191
192
|
- `task_workflow_log_get(task_id=...)` and `task_associated_report_detail_get(task_id=...)` are also supported for the current todo context.
|
|
192
193
|
- Use `task_associated_report_detail_get` for associated view or report details.
|
|
193
|
-
- Use `task_workflow_log_get` for
|
|
194
|
+
- Use `task_workflow_log_get` for the current task context workflow log page. For full record-level data/workflow logs, use `record_logs_get(app_key, record_id, view_id?)`.
|
|
194
195
|
- Task actions operate on `app_key + record_id + workflow_node_id`, not `task_id`.
|
|
195
196
|
- Treat `task_action_execute` as the tool-level action enum surface; the current task's real actions are only the ones listed in `task_get.capabilities.available_actions`.
|
|
196
197
|
- Use `task_action_execute(action="save_only", fields=...)` when the user wants to save editable field changes on the current node without advancing the workflow.
|
|
@@ -360,12 +361,8 @@ If the current MCP capability is unsupported, the workflow is awkward, or the us
|
|
|
360
361
|
)
|
|
361
362
|
|
|
362
363
|
@server.tool()
|
|
363
|
-
def app_list(profile: str = DEFAULT_PROFILE) -> dict:
|
|
364
|
-
return apps.app_list(profile=profile)
|
|
365
|
-
|
|
366
|
-
@server.tool()
|
|
367
|
-
def app_search(profile: str = DEFAULT_PROFILE, keyword: str = "", page_num: int = 1, page_size: int = 50) -> dict:
|
|
368
|
-
return apps.app_search(profile=profile, keyword=keyword, page_num=page_num, page_size=page_size)
|
|
364
|
+
def app_list(profile: str = DEFAULT_PROFILE, query: str = "", keyword: str = "") -> dict:
|
|
365
|
+
return apps.app_list(profile=profile, query=query, keyword=keyword)
|
|
369
366
|
|
|
370
367
|
@server.tool()
|
|
371
368
|
def app_get(profile: str = DEFAULT_PROFILE, app_key: str = "") -> dict:
|