@qingflow-tech/qingflow-app-builder-mcp 1.0.7 → 1.0.9

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.7
6
+ npm install @qingflow-tech/qingflow-app-builder-mcp@1.0.9
7
7
  ```
8
8
 
9
9
  Run:
10
10
 
11
11
  ```bash
12
- npx -y -p @qingflow-tech/qingflow-app-builder-mcp@1.0.7 qingflow-app-builder-mcp
12
+ npx -y -p @qingflow-tech/qingflow-app-builder-mcp@1.0.9 qingflow-app-builder-mcp
13
13
  ```
14
14
 
15
15
  Environment:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qingflow-tech/qingflow-app-builder-mcp",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Builder MCP for Qingflow app/package/system design and staged solution workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qingflow-mcp"
7
- version = "1.0.7"
7
+ version = "1.0.9"
8
8
  description = "User-authenticated MCP server for Qingflow"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -52,28 +52,49 @@ Treat these as the official surface. Do not default to `package_create`, `packag
52
52
  - App base permissions:
53
53
  - trust `app_get.editability.can_edit_app_base` for app base-info writes like app name, icon, and visibility
54
54
  - `can_edit_form` only means schema/form-route capability; it no longer implies app base-info write capability
55
+ - Partial update rule:
56
+ - for existing views, custom buttons, associated resources, and charts, prefer `patch_views` / `patch_buttons` / `patch_resources` / `patch_charts`
57
+ - each patch item uses the object's real selector field (`view_key` / `button_id` / `associated_item_id` / `chart_id`, or unique name where supported) plus `set` and optional `unset`; do not send a literal `selector` key for these tools
58
+ - use `upsert_*` for creation or full target configuration; do not send a partial `upsert_*` and expect the backend to merge missing required fields
55
59
  - Portal work:
56
60
  - `portal_apply` is the public write path
57
61
  - in edit mode, omitting `sections` means “preserve existing layout and update base info only”
58
62
  - supplying `sections` means full replace semantics for sections
59
63
  - Chart work:
60
- - `app_charts_apply` is the public write path
64
+ - `app_charts_apply` is the public write path for app-source QingBI report bodies/configs; it creates/updates reports with `dataSourceType=qingflow`
65
+ - dataset BI reports are not created or edited by `app_charts_apply` yet; create them in QingBI first, then attach the existing report with `app_associated_resources_apply` and `report_source="dataset"`
66
+ - it does not attach the report to the Qingflow app associated-resource display; use `app_associated_resources_apply` for that
67
+ - supported `chart_type` values include legacy public aliases `target`, `table` and QingBI types such as `summary`, `columnar`, `area`, `stacked_area`, `funnel`, `waterfall`, `gauge`, `heatmap`, `histogram`, `treemap`, `radar`, `stacked_bar`, `stacked_column`, `scatter`, `ring`, `rose`, `dualaxes`, `map`, and `timeline`
68
+ - use `patch_charts` for changing a chart name, visibility, filters, or one config fragment on an existing chart
61
69
  - `visibility` is a public capability and should be treated as a base-only permission update
62
70
  - do not model chart visibility changes as raw config rewrites
63
71
  - Button work:
64
72
  - `app_custom_buttons_apply` is the public write path for custom button bodies and view placement
73
+ - use `patch_buttons` for changing a single existing button parameter such as URL, text, icon, style, or add-data mapping
65
74
  - for add-data buttons, use `trigger_add_data_config.target_app_key + field_mappings/default_values`; do not handwrite raw `que_relation`
75
+ - use `field_mappings` for dynamic current-record values, including system fields such as `数据ID` (`field_id=-17`) and `编号` (`field_id=0`)
76
+ - to prefill a target relation field with the current source record, map `{"source_field": "数据ID", "target_field": "目标引用字段"}`; use `default_values` only for static constants
77
+ - if field type compatibility is unclear, read [references/match-rules.md](references/match-rules.md)
66
78
  - bind buttons to views through `view_configs[].buttons[]`; default to `placement`: `header` or `detail`
79
+ - builder `view_configs[].view_key` uses the raw key from `app_get.views[].view_key`, without a `custom:` prefix
67
80
  - `buttons` is required in merge mode; do not send a view config with only `view_key`
68
81
  - `view_configs[].mode` defaults to `merge`; use `mode: "replace"` or an explicit empty `buttons: []` to clear a view's custom button bindings
69
- - `placement=list` is experimental because some backend deployments reject it with `LIST_BUTTON_BACKEND_UNSUPPORTED`
82
+ - `placement=list` configures row/list buttons and maps to the backend `INSIDE` button position
70
83
  - advanced bindings may use `button_limit`, `button_formula`, `button_formula_type`, and `print_tpls` only when visibility or print-template behavior is required
71
84
  - Associated resources:
72
- - `app_associated_resources_apply` is the public write path for the app-level associated report/view pool and per-view display config
73
- - `associated_item_id` must come from `app_get.associated_resources[].associated_item_id`; it is not `chart_id`, `chart_key`, or `view_key`
74
- - do not pass backend raw `sourceType`; view resources infer the internal Qingflow view source, report/chart resources default to BI app reports, and dataset reports use `report_source="dataset"`
85
+ - `app_associated_resources_apply` is the public write path for the Qingflow app-level associated report/view pool and per-view display config
86
+ - it attaches existing BI reports/views for in-app display; it does not create or edit QingBI report bodies/configs, including dataset reports
87
+ - use `patch_resources` for changing match rules or other existing associated-resource parameters; the tool preserves backend-required raw fields internally
88
+ - `associated_item_id` is the backend internal associated-resource id; for `view_configs`, `remove_associated_item_ids`, and `reorder_associated_item_ids`, you may pass `associated_item_id` or an existing resource's `chart_id`/`chart_key`/`view_key`, and the tool resolves it to the internal id
89
+ - before creating a resource, check `app_get.associated_resources` for the same `target_app_key + view_key/chart_key`; if it already exists, use `patch_resources` with that `associated_item_id`
90
+ - `client_key` is only a same-call reference for `view_configs[].associated_item_refs`; it is not saved and cannot deduplicate later calls
91
+ - do not pass backend raw `sourceType`; view resources infer the internal Qingflow view source, report/chart resources default to BI app reports, and existing dataset reports use `report_source="dataset"`
92
+ - use `match_mappings` for associated view/report filters; dynamic conditions use `source_field`, static conditions use `value`
93
+ - if field type compatibility is unclear, read [references/match-rules.md](references/match-rules.md)
75
94
  - Views and flows:
76
95
  - stay on `app_views_apply` / `app_flow_apply`
96
+ - use `patch_views` for existing-view parameter changes such as `query_conditions`, `filters`, `columns`, or visibility
97
+ - builder view writes use raw `view_key` values from `app_get.views`; `custom:<viewKey>` is a record-data `view_id` form, not a builder `view_key`
77
98
  - use `builder_tool_contract` whenever the minimal legal shape is unclear
78
99
  - keep view `filters` and `query_conditions` separate: `filters` are fixed saved filters; `query_conditions` configure the frontend query panel fields and only take effect after users enter query values
79
100
  - configure associated reports/views through `app_associated_resources_apply`, not through `app_views_apply`
@@ -100,8 +121,10 @@ Treat these as the official surface. Do not default to `package_create`, `packag
100
121
  - fields -> `app_schema_apply`
101
122
  - layout -> `app_layout_apply`
102
123
  - flow -> `app_flow_apply`
103
- - views -> `app_views_apply`
104
- - charts -> `app_charts_apply`
124
+ - existing views -> `app_views_apply.patch_views`; new/full views -> `app_views_apply.upsert_views`
125
+ - existing buttons -> `app_custom_buttons_apply.patch_buttons`; new/full buttons -> `app_custom_buttons_apply.upsert_buttons`
126
+ - existing associated resources -> `app_associated_resources_apply.patch_resources`; new/full resources -> `app_associated_resources_apply.upsert_resources`
127
+ - existing charts -> `app_charts_apply.patch_charts`; new/full charts -> `app_charts_apply.upsert_charts`
105
128
  - portal -> `portal_apply`
106
129
  - package metadata/layout -> `package_apply`
107
130
  8. Use `app_publish_verify` only when the user explicitly wants final publish/live verification or you need a dedicated verification pass
@@ -127,6 +150,9 @@ Treat these as the official surface. Do not default to `package_create`, `packag
127
150
  - For portals, distinguish clearly between:
128
151
  - base-info-only update with layout preserved
129
152
  - full sections replace
153
+ - For object apply tools, distinguish clearly between:
154
+ - `patch_*`: public partial parameter replacement; the tool hydrates current config and full-saves internally
155
+ - `upsert_*`: create or full target configuration; omitted fields may mean default/clear depending on that object
130
156
  - For charts, distinguish clearly between:
131
157
  - base / visibility change
132
158
  - real chart-config change
@@ -149,10 +175,10 @@ Treat these as the official surface. Do not default to `package_create`, `packag
149
175
  - Add/update/remove fields: `app_schema_apply`
150
176
  - Merge or replace layout: `app_layout_apply`
151
177
  - Replace workflow: `app_flow_apply`
152
- - Upsert/remove views: `app_views_apply`
153
- - Upsert/remove custom buttons and bind them to header/detail view positions: `app_custom_buttons_apply`
154
- - Manage app associated reports/views and per-view display: `app_associated_resources_apply`
155
- - Upsert/remove/reorder charts: `app_charts_apply`
178
+ - Upsert/patch/remove views: `app_views_apply`
179
+ - Upsert/patch/remove custom buttons and bind them to header/detail view positions: `app_custom_buttons_apply`
180
+ - Upsert/patch/remove app associated reports/views and per-view display: `app_associated_resources_apply`
181
+ - Upsert/patch/remove/reorder charts: `app_charts_apply`
156
182
  - Create or update portal pages: `portal_apply`
157
183
  - Release your own stale edit lock: `app_release_edit_lock_if_mine`
158
184
  - Final publish verification: `app_publish_verify`
@@ -176,8 +202,9 @@ Use `app_custom_buttons_apply` for the whole custom-button path: button body, ad
176
202
  "trigger_add_data_config": {
177
203
  "target_app_key": "WORKLOG_APP",
178
204
  "field_mappings": [
179
- {"source_field": "员工名称", "target_field": "员工"},
180
- {"source_field": "所属部门", "target_field": "部门"}
205
+ {"source_field": "数据ID", "target_field": "关联员工"},
206
+ {"source_field": "员工名称", "target_field": "员工姓名"},
207
+ {"source_field": "所属部门", "target_field": "部门名称"}
181
208
  ],
182
209
  "default_values": {
183
210
  "工时类型": "日常工作",
@@ -200,13 +227,16 @@ Use `app_custom_buttons_apply` for the whole custom-button path: button body, ad
200
227
  }
201
228
  ```
202
229
 
203
- `button_ref` may be a same-call `client_key` or an existing `button_id`. Default placements are `header` and `detail`; `list` is experimental and should only be used when the user explicitly asks for row/list buttons.
230
+ `button_ref` may be a same-call `client_key` or an existing `button_id`. Supported placements are `header`, `detail`, and `list`; `list` maps to the backend `INSIDE` row/list button position.
231
+
232
+ For add-data buttons that create a child record linked back to the current record, map `source_field: "数据ID"` to the target relation field. Do not use raw `que_relation` unless maintaining an existing backend config.
204
233
 
205
234
  ## Resources
206
235
 
207
236
  - Shared public-surface baseline: [public-surface-sync.md](../qingflow-app-user/references/public-surface-sync.md)
208
237
  - Environment switching: [references/environments.md](references/environments.md)
209
238
  - Tool choice and sequencing: [references/tool-selection.md](references/tool-selection.md)
239
+ - Field matching rules: [references/match-rules.md](references/match-rules.md)
210
240
  - Result semantics and gotchas: [references/gotchas.md](references/gotchas.md)
211
241
  - Create one app in an existing package: [references/create-app.md](references/create-app.md)
212
242
  - Update fields only: [references/update-schema.md](references/update-schema.md)
@@ -25,16 +25,37 @@
25
25
  - `app_custom_buttons_apply` and `app_associated_resources_apply` publish after at least one write succeeds and do not accept `publish=false`
26
26
  - `app_publish_verify` is for explicit final verification, not the default next step after every write
27
27
 
28
+ ## BI Reports
29
+
30
+ - Use `app_charts_apply` for QingBI report body/config creation or updates.
31
+ - Use `app_associated_resources_apply` only when an existing BI report or view needs to appear in the Qingflow app associated-resource area or a specific view.
32
+ - `app_charts_apply` currently creates/updates app-source BI reports only (`dataSourceType=qingflow`); dataset BI reports can only be attached when they already exist.
33
+ - Creating a chart with `app_charts_apply` does not automatically show it in the Qingflow app UI; attach it separately if display is required.
34
+ - `target` and `table` remain compatibility aliases for QingBI `indicator` and `detail`; use the real QingBI chart type when you need a specific type such as `summary`, `columnar`, `stacked_bar`, `scatter`, or `dualaxes`.
35
+
28
36
  ## Custom buttons
29
37
 
30
38
  - Use `app_custom_buttons_apply` for button creation/update/removal and view placement; do not split placement into `app_views_apply.buttons` unless you are maintaining a legacy patch.
39
+ - When changing one existing button parameter, use `patch_buttons` with `set/unset`. Do not send a partial `upsert_buttons` object and expect the backend to preserve hidden required fields.
31
40
  - For add-data buttons, prefer semantic `trigger_add_data_config.target_app_key`, `field_mappings`, and `default_values`.
32
41
  - Do not handwrite raw `que_relation` unless you are preserving an existing backend config. If `field_mappings` and `que_relation` are mixed, the tool blocks the write.
42
+ - `field_mappings.source_field` can use source app fields and supported system fields such as `数据ID` (`field_id=-17`) and `编号` (`field_id=0`).
43
+ - To fill a target relation field with the current source record, map `{"source_field": "数据ID", "target_field": "目标引用字段"}`. Use `default_values` only for static constants.
44
+ - For field type compatibility, read `references/match-rules.md`.
33
45
  - Default button placements are `header` and `detail`; these map to the frontend's header and detail button areas.
34
46
  - `view_configs[].buttons` is required in merge mode. Do not send a view config with only `view_key`; it is blocked to avoid no-op writes and accidental publish.
47
+ - Builder view configs use raw `view_key` from `app_get.views[].view_key`; do not prefix it with `custom:`. The `custom:<viewKey>` form is for record-data `view_id`.
35
48
  - View button bindings merge by default. Use `view_configs[].mode="replace"` to replace the full set, or pass an explicit empty `buttons: []` when you intend to clear all custom button bindings for that view.
36
49
  - Advanced view button bindings can include `button_limit`, `button_formula`, `button_formula_type`, and `print_tpls`, but keep ordinary buttons simple unless the user asks for conditional visibility or print templates.
37
- - `placement=list` is experimental for row/list buttons. Some backend deployments still reject it. If the tool returns `LIST_BUTTON_BACKEND_UNSUPPORTED`, treat `header/detail` as applied when verified and report list placement as unsupported by the current backend route.
50
+ - `placement=list` configures row/list buttons. The tool maps it to the backend `INSIDE` button position, not a raw `LIST` config type.
51
+
52
+ ## Associated resources
53
+
54
+ - Before creating an associated view/report, check `app_get.associated_resources` for the same `target_app_key + view_key/chart_key`.
55
+ - If the resource already exists, use `patch_resources` with its `associated_item_id`; do not call `upsert_resources` again.
56
+ - For per-view display, remove, and reorder, existing associated reports/views may be referenced by `associated_item_id`, `chart_id`/`chart_key`, or `view_key`; the tool resolves these to the internal id before writing.
57
+ - `client_key` is only a same-call alias for `view_configs[].associated_item_refs`. It is not stored by Qingflow and cannot prevent duplicates in later calls.
58
+ - Repeated `upsert_resources` without `associated_item_id` can create multiple app-level associated items pointing to the same view/report.
38
59
 
39
60
  ## Readback scope
40
61
 
@@ -44,6 +65,15 @@
44
65
  - Use `app_get_flow` before workflow work
45
66
  - Use `app_get_views` before view work
46
67
 
68
+ ## Partial update discipline
69
+
70
+ - Existing views, custom buttons, associated resources, and charts support the same public partial pattern: `patch_*[].set` plus optional `patch_*[].unset`.
71
+ - The backend may still save a full payload. The MCP/CLI patch path is responsible for reading current config and preserving fields the user did not mention.
72
+ - Do not use `upsert_views`, `upsert_buttons`, `upsert_resources`, or `upsert_charts` for a tiny parameter replacement unless you are deliberately providing the full desired target config.
73
+ - `app_layout_apply(mode=merge)` is already a safe layout merge path; `mode=replace` is full layout replacement.
74
+ - `portal_apply` without `sections` is base-info-only. Supplying `sections` replaces the portal sections list.
75
+ - `app_flow_apply` is intentionally replace-only for the public linear workflow graph.
76
+
47
77
  ## Workflow dependencies
48
78
 
49
79
  - Approval-style flows usually require an explicit status field
@@ -66,6 +96,7 @@
66
96
  - `assignees.role_ids` / `assignees.member_uids` / `assignees.member_emails`
67
97
  - `permissions.editable_fields`
68
98
  - For view work, treat `columns` as the only canonical public key. `app_get_views` and `app_views_apply` should all be read and written in that shape.
99
+ - For existing view parameter changes, prefer `patch_views`. Example: to change only query-panel fields, set only `query_conditions`; the tool will preserve columns, filters, date config, card fields, buttons, and other backend-required fields.
69
100
  - For layout work, treat `title + rows` as the only canonical public section shape. `fields`, `field_ids`, and `columns` may appear in legacy/internal shapes, but they are not the preferred public write shape.
70
101
  - A created view is not enough to claim a filter succeeded. When `app_views_apply` returns `partial_success`, `views_verified=false`, or `details.filter_mismatches`, treat the view as present but the filter as unverified.
71
102
  - If duplicate view names exist, do not retry by name. Read the exact `view_key` and target that one.
@@ -0,0 +1,114 @@
1
+ # Builder Match Rules
2
+
3
+ Use this reference for builder-side field matching rules in custom buttons and associated view/report filters.
4
+
5
+ This is not the same thing as `record_access` analysis filters or normal view `filters`.
6
+
7
+ ## Where These Rules Apply
8
+
9
+ - `app_custom_buttons_apply.upsert_buttons[].trigger_add_data_config.field_mappings`
10
+ - `app_custom_buttons_apply.patch_buttons[].set.trigger_add_data_config.field_mappings`
11
+ - `app_associated_resources_apply.upsert_resources[].match_mappings`
12
+ - `app_associated_resources_apply.patch_resources[].set.match_mappings`
13
+
14
+ Prefer semantic mappings. Do not handwrite raw `que_relation` or `match_rules` unless you are preserving an existing backend config.
15
+
16
+ ## System Fields
17
+
18
+ System fields can participate in mappings:
19
+
20
+ - `数据ID`, `row_record_id`, `apply_id`, `_id` -> `field_id=-17`
21
+ This is the current record's real apply/record ID.
22
+ - `编号`, `数据编号`, `record_number` -> `field_id=0`
23
+ This is the frontend-visible record number. It may be custom formatted and is not the same as `数据ID`.
24
+
25
+ Explicit selectors such as `{"field_id": -17}` and `{"field_id": 0}` are allowed and remove ambiguity.
26
+
27
+ ## Custom Buttons
28
+
29
+ Use `field_mappings` for dynamic values copied from the current source record:
30
+
31
+ ```json
32
+ {
33
+ "target_app_key": "WORKLOG_APP",
34
+ "field_mappings": [
35
+ {"source_field": "数据ID", "target_field": "关联员工"},
36
+ {"source_field": "员工名称", "target_field": "员工姓名"}
37
+ ],
38
+ "default_values": {
39
+ "状态": "待提交"
40
+ }
41
+ }
42
+ ```
43
+
44
+ Use `default_values` only for static constants. Do not use `default_values` as the preferred way to pass the current record.
45
+
46
+ For an existing button, put the same semantic config under `patch_buttons[].set`:
47
+
48
+ ```json
49
+ {
50
+ "button_id": 3858041,
51
+ "set": {
52
+ "trigger_add_data_config": {
53
+ "target_app_key": "WORKLOG_APP",
54
+ "field_mappings": [
55
+ {"source_field": "数据ID", "target_field": "关联员工"}
56
+ ],
57
+ "default_values": {
58
+ "状态": "待提交"
59
+ }
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ## Associated Resources
66
+
67
+ Use `match_mappings` for associated view/report filters:
68
+
69
+ ```json
70
+ {
71
+ "graph_type": "view",
72
+ "target_app_key": "WORKLOG_APP",
73
+ "view_key": "WORKLOG_VIEW",
74
+ "match_mappings": [
75
+ {"target_field": "关联员工", "source_field": "数据ID"},
76
+ {"target_field": "状态", "value": "待提交"}
77
+ ]
78
+ }
79
+ ```
80
+
81
+ Dynamic conditions use `source_field`; static conditions use `value`.
82
+
83
+ For an existing associated resource, put the same filter mapping under `patch_resources[].set`:
84
+
85
+ ```json
86
+ {
87
+ "associated_item_id": 3497587,
88
+ "set": {
89
+ "match_mappings": [
90
+ {"target_field": "关联员工", "source_field": "数据ID"}
91
+ ]
92
+ }
93
+ }
94
+ ```
95
+
96
+ ## Type Compatibility
97
+
98
+ - Relation fields: match another relation field with the same target app, or match `数据ID(-17)` when the target relation points to the current source app.
99
+ - Record ID `数据ID(-17)`: can match relation fields that point to the current source app, or ID-compatible text/number fields.
100
+ - Record number `编号(0)`: can match text, long text, number, amount, or another record-number field.
101
+ - Member fields: only match member fields.
102
+ - Department fields: only match department fields.
103
+ - Option fields: single select, multi select, and boolean can match option-family fields or static option values.
104
+ - Date fields: date and datetime can match each other.
105
+ - Text fields: text, long text, phone, and email can match each other.
106
+ - Number fields: number and amount can match each other.
107
+ - Attachment, subtable, code block, Q-Linker, and address fields are not default match fields.
108
+
109
+ ## Error Interpretation
110
+
111
+ - Field not found: re-read `app_get` or `app_get_fields` and retry with an exact title or `field_id`.
112
+ - Type mismatch: choose a compatible source/target pair from the matrix above.
113
+ - Reference source mismatch: the target relation field points to a different app; choose a relation field that points back to the current source app, or match a non-relation field.
114
+ - Mixed raw and semantic modes: use either semantic `field_mappings/match_mappings` or raw `que_relation/match_rules`, never both in the same item.
@@ -45,12 +45,14 @@ These execute normalized patches. Some app apply tools publish by default and st
45
45
  - `app_schema_apply`: create app shell or change fields
46
46
  - `app_layout_apply`: merge or replace layout
47
47
  - `app_flow_apply`: replace workflow
48
- - `app_views_apply`: upsert or remove views
49
- - `app_custom_buttons_apply`: create, update, or remove custom buttons; configure add-data field mappings/default values; bind buttons to header/detail view positions; merge-mode view configs require `buttons`; use `view_configs[].mode="replace"` or `buttons=[]` to clear a view's custom button bindings; `placement=list` is experimental
50
- - `app_associated_resources_apply`: manage app associated reports/views and per-view display config; publishes after successful writes; omit raw `sourceType`, and use `report_source="dataset"` only for BI dataset reports
51
- - `app_charts_apply`: upsert/remove/reorder QingBI charts; charts are immediate-live and do not publish; use `chart_id` when names are not unique
48
+ - `app_views_apply`: use `patch_views` for existing-view parameter replacement; use `upsert_views` for creation or full target config; remove views by key
49
+ - `app_custom_buttons_apply`: use `patch_buttons` for existing-button parameter replacement; use `upsert_buttons` for creation or full target config; configure add-data field mappings/default values; bind buttons to header/detail/list view positions; `placement=list` maps to the backend `INSIDE` row/list button position; merge-mode view configs require `buttons`; use `view_configs[].mode="replace"` or `buttons=[]` to clear a view's custom button bindings. For child-record creation linked to the current source record, map `source_field: "数据ID"` to the target relation field.
50
+ - `app_associated_resources_apply`: attach existing BI reports/views to the Qingflow app associated-resource pool and per-view display area; it does not create or edit QingBI report bodies/configs. Use `patch_resources` for existing associated-resource parameter replacement; use `upsert_resources` for creation or full target config; `view_configs`, remove, and reorder may reference existing resources by internal `associated_item_id` or by `chart_id`/`chart_key`/`view_key`; use `match_mappings` for associated view/report filters; publishes after successful writes; omit raw `sourceType`, and use `report_source="dataset"` only to attach an existing BI dataset report. Before `upsert_resources`, read `app_get.associated_resources` and reuse an existing matching `target_app_key + view_key/chart_key`; repeated upsert can create duplicates because `client_key` is only valid inside one apply call.
51
+ - `app_charts_apply`: create/edit/remove/reorder app-source QingBI report bodies/configs with `dataSourceType=qingflow`; it does not create/edit dataset BI reports and does not attach reports to Qingflow app associated-resource display. Use `patch_charts` for existing-chart parameter replacement; use `upsert_charts` for creation or full target config; supports `target/table` aliases plus QingBI chart types such as `summary`, `columnar`, `area`, `funnel`, `radar`, `scatter`, `dualaxes`, and `map`; charts are immediate-live and do not publish; use `chart_id` when names are not unique
52
52
  - `portal_apply`: create or replace-update portal pages; use `dash_key` for update mode or `package_id + dash_name` for create mode; edit mode may omit `sections` for base-info-only updates; when sections are supplied they still use replace semantics
53
53
 
54
+ For object-level updates, the safe partial syntax is `patch_*` with the object's real selector field plus `set` and optional `unset`. `selector` is only a concept, not a literal key. Examples: `patch_views: [{"view_key": "VIEW_KEY", "set": {...}}]`, `patch_buttons: [{"button_id": 1001, "set": {...}}]`, `patch_resources: [{"associated_item_id": 123, "set": {...}}]`, `patch_charts: [{"chart_id": 456, "set": {...}}]`. The tool reads the current backend config, merges the patch, then submits the full backend payload internally. Do not send a partial `upsert_*` and expect missing required fields to be preserved.
55
+
54
56
  ## Explicit post-apply tools
55
57
 
56
58
  - `app_publish_verify`: explicit final publish verification when the user asks for live confirmation
@@ -70,9 +72,11 @@ These execute normalized patches. Some app apply tools publish by default and st
70
72
  - Add workflow:
71
73
  `builder_tool_contract -> app_get_fields -> app_get_flow -> role_search/member_search -> app_flow_apply -> app_get_flow`
72
74
  - Add views:
73
- `builder_tool_contract -> app_get_fields -> app_get_views -> app_views_apply -> app_get_views`
75
+ `builder_tool_contract -> app_get_fields -> app_get_views -> app_views_apply.patch_views/upsert_views -> app_get_views`
74
76
  - Add QingBI charts:
75
- `builder_tool_contract -> app_get_fields -> app_get_charts -> app_charts_apply -> app_get_charts`
77
+ `builder_tool_contract -> app_get_fields -> app_get_charts -> app_charts_apply.patch_charts/upsert_charts -> app_get_charts`
78
+ - Show an existing QingBI chart inside a Qingflow app/view:
79
+ `app_get -> app_associated_resources_apply.upsert_resources/patch_resources + view_configs -> app_get`
76
80
  - Create or update a portal:
77
81
  `builder_tool_contract -> portal_get -> portal_apply -> portal_get`
78
82
 
@@ -30,9 +30,11 @@ Canonical rules before any example:
30
30
  - Treat `fields` only as a legacy alias the MCP may normalize, not as the preferred shape
31
31
  - Use `filters` with canonical keys `field_name`, `operator`, `value`/`values`
32
32
  - Use `query_conditions` for the frontend query panel. Do not put query-panel fields into `filters`.
33
- - Use `app_associated_resources_apply` for the frontend associated report/view area. `associated_item_id` must be copied from `app_get.associated_resources[].associated_item_id`; it is not `chart_id` or `chart_key`. Do not write backend raw `sourceType`; reports default to BI app reports, and dataset reports use `report_source="dataset"`.
33
+ - Use `app_associated_resources_apply` for the frontend associated report/view area. `associated_item_id` is the internal associated-resource id from `app_get.associated_resources`; `view_configs`, remove, and reorder may also pass an existing resource's `chart_id`/`chart_key`/`view_key`, which the tool resolves to the internal id. Do not write backend raw `sourceType`; reports default to BI app reports, and dataset reports use `report_source="dataset"`. Use `match_mappings` for associated view/report filters; read `match-rules.md` if field type compatibility is unclear.
34
34
  - For gantt, use `start_field`, `end_field`, and optionally `title_field`
35
35
  - If `app_get.views` or `app_get_views` shows duplicate view names, include `view_key` in `upsert_views[]` and update that exact target
36
+ - Builder view writes always use the raw `view_key` from `app_get.views[].view_key`, such as `emsrao25rs02`. Do not pass `custom:emsrao25rs02`; that prefixed form is only for record-data `view_id`.
37
+ - For an existing view, prefer `patch_views` for parameter replacement. Do not send a partial `upsert_views` object such as only `name/type/query_conditions`; backend view saves require other type-specific fields, and the patch path preserves them for you.
36
38
 
37
39
  Apply a default table view:
38
40
 
@@ -57,7 +59,7 @@ Apply a default table view:
57
59
  ```
58
60
  After `app_views_apply` returns canonical arguments or blocking issues, prefer reusing its `suggested_next_call.arguments` directly. Do not rewrite aliases back into non-canonical keys such as `column_names`.
59
61
 
60
- Table view with fixed filter plus frontend query conditions:
62
+ Existing table view: replace only frontend query conditions:
61
63
 
62
64
  ```json
63
65
  {
@@ -66,23 +68,16 @@ Table view with fixed filter plus frontend query conditions:
66
68
  "profile": "default",
67
69
  "app_key": "APP_123",
68
70
  "publish": true,
69
- "upsert_views": [
71
+ "patch_views": [
70
72
  {
71
- "name": "客户查询视图",
72
- "type": "table",
73
- "columns": ["客户名称", "负责人", "客户状态", "创建时间"],
74
- "filters": [
75
- {
76
- "field_name": "客户状态",
77
- "operator": "eq",
78
- "value": "有效"
73
+ "view_key": "VIEW_KEY",
74
+ "set": {
75
+ "query_conditions": {
76
+ "enabled": true,
77
+ "exact": false,
78
+ "hide_before_query": false,
79
+ "rows": [["客户名称", "负责人"], ["创建时间"]]
79
80
  }
80
- ],
81
- "query_conditions": {
82
- "enabled": true,
83
- "exact": false,
84
- "hide_before_query": false,
85
- "rows": [["客户名称", "负责人"], ["创建时间"]]
86
81
  }
87
82
  }
88
83
  ],
@@ -96,6 +91,7 @@ Meaning:
96
91
  - `filters` are saved view filters and apply immediately when the view opens.
97
92
  - `query_conditions` only configures which fields appear in the frontend query panel. The query values come later from the user through the page.
98
93
  - `query_conditions.rows` is a matrix of field names and is compiled to backend `queryCondition` field ids.
94
+ - The patch call preserves the view's existing columns, saved filters, type-specific date/card/board config, buttons, visibility, and other backend-required fields.
99
95
 
100
96
  View associated resources example:
101
97
 
@@ -120,7 +116,7 @@ View associated resources example:
120
116
  }
121
117
  ```
122
118
 
123
- Use `{"visible": true, "limit_type": "all"}` to show all app-level associated resources, and `{"visible": false}` to hide the area. The ids above must come from `app_get.associated_resources`. If you create a new associated item in the same call, give it a `client_key` and reference it from `view_configs[].associated_item_refs`.
119
+ Use `{"visible": true, "limit_type": "all"}` to show all app-level associated resources, and `{"visible": false}` to hide the area. The ids above can be internal `associated_item_id` values or existing resource `chart_id`/`chart_key`/`view_key` values from `app_get.associated_resources`. Before creating a resource, check whether the same `target_app_key + view_key/chart_key` already exists; if it does, use `patch_resources` with that `associated_item_id`. Dataset BI reports must already exist in QingBI and should be attached with `report_source="dataset"`; do not try to create them through `app_charts_apply`. If you create a new associated item in the same call, give it a `client_key` and reference it from `view_configs[].associated_item_refs`; `client_key` is not persisted and cannot deduplicate a later call.
124
120
 
125
121
  Create and show a BI indicator-card report in the same call:
126
122
 
@@ -136,7 +132,11 @@ Create and show a BI indicator-card report in the same call:
136
132
  "graph_type": "chart",
137
133
  "target_app_key": "TIMESHEET_APP",
138
134
  "chart_key": "CHART_KEY",
139
- "report_source": "app"
135
+ "report_source": "app",
136
+ "match_mappings": [
137
+ {"target_field": "关联员工", "source_field": "数据ID"},
138
+ {"target_field": "状态", "value": "待提交"}
139
+ ]
140
140
  }
141
141
  ],
142
142
  "remove_associated_item_ids": [],