@qingflow-tech/qingflow-app-builder-mcp 1.0.7 → 1.0.8
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 +36 -10
- package/skills/qingflow-app-builder/references/gotchas.md +23 -1
- package/skills/qingflow-app-builder/references/match-rules.md +114 -0
- package/skills/qingflow-app-builder/references/tool-selection.md +8 -6
- package/skills/qingflow-app-builder/references/update-views.md +19 -19
- package/src/qingflow_mcp/builder_facade/models.py +171 -9
- package/src/qingflow_mcp/builder_facade/service.py +2030 -83
- package/src/qingflow_mcp/cli/commands/builder.py +8 -0
- package/src/qingflow_mcp/cli/commands/record.py +55 -1
- package/src/qingflow_mcp/public_surface.py +2 -2
- package/src/qingflow_mcp/response_trim.py +14 -0
- package/src/qingflow_mcp/server.py +1 -0
- package/src/qingflow_mcp/server_app_builder.py +12 -2
- package/src/qingflow_mcp/server_app_user.py +1 -0
- package/src/qingflow_mcp/tools/ai_builder_tools.py +189 -7
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.8
|
|
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.8 qingflow-app-builder-mcp
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Environment:
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -52,28 +52,45 @@ 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
64
|
- `app_charts_apply` is the public write path
|
|
65
|
+
- use `patch_charts` for changing a chart name, visibility, filters, or one config fragment on an existing chart
|
|
61
66
|
- `visibility` is a public capability and should be treated as a base-only permission update
|
|
62
67
|
- do not model chart visibility changes as raw config rewrites
|
|
63
68
|
- Button work:
|
|
64
69
|
- `app_custom_buttons_apply` is the public write path for custom button bodies and view placement
|
|
70
|
+
- use `patch_buttons` for changing a single existing button parameter such as URL, text, icon, style, or add-data mapping
|
|
65
71
|
- for add-data buttons, use `trigger_add_data_config.target_app_key + field_mappings/default_values`; do not handwrite raw `que_relation`
|
|
72
|
+
- use `field_mappings` for dynamic current-record values, including system fields such as `数据ID` (`field_id=-17`) and `编号` (`field_id=0`)
|
|
73
|
+
- to prefill a target relation field with the current source record, map `{"source_field": "数据ID", "target_field": "目标引用字段"}`; use `default_values` only for static constants
|
|
74
|
+
- if field type compatibility is unclear, read [references/match-rules.md](references/match-rules.md)
|
|
66
75
|
- bind buttons to views through `view_configs[].buttons[]`; default to `placement`: `header` or `detail`
|
|
76
|
+
- builder `view_configs[].view_key` uses the raw key from `app_get.views[].view_key`, without a `custom:` prefix
|
|
67
77
|
- `buttons` is required in merge mode; do not send a view config with only `view_key`
|
|
68
78
|
- `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`
|
|
79
|
+
- `placement=list` configures row/list buttons and maps to the backend `INSIDE` button position
|
|
70
80
|
- advanced bindings may use `button_limit`, `button_formula`, `button_formula_type`, and `print_tpls` only when visibility or print-template behavior is required
|
|
71
81
|
- Associated resources:
|
|
72
82
|
- `app_associated_resources_apply` is the public write path for the app-level associated report/view pool and per-view display config
|
|
83
|
+
- use `patch_resources` for changing match rules or other existing associated-resource parameters; the tool preserves backend-required raw fields internally
|
|
73
84
|
- `associated_item_id` must come from `app_get.associated_resources[].associated_item_id`; it is not `chart_id`, `chart_key`, or `view_key`
|
|
85
|
+
- 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`
|
|
86
|
+
- `client_key` is only a same-call reference for `view_configs[].associated_item_refs`; it is not saved and cannot deduplicate later calls
|
|
74
87
|
- 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"`
|
|
88
|
+
- use `match_mappings` for associated view/report filters; dynamic conditions use `source_field`, static conditions use `value`
|
|
89
|
+
- if field type compatibility is unclear, read [references/match-rules.md](references/match-rules.md)
|
|
75
90
|
- Views and flows:
|
|
76
91
|
- stay on `app_views_apply` / `app_flow_apply`
|
|
92
|
+
- use `patch_views` for existing-view parameter changes such as `query_conditions`, `filters`, `columns`, or visibility
|
|
93
|
+
- 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
94
|
- use `builder_tool_contract` whenever the minimal legal shape is unclear
|
|
78
95
|
- 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
96
|
- configure associated reports/views through `app_associated_resources_apply`, not through `app_views_apply`
|
|
@@ -100,8 +117,10 @@ Treat these as the official surface. Do not default to `package_create`, `packag
|
|
|
100
117
|
- fields -> `app_schema_apply`
|
|
101
118
|
- layout -> `app_layout_apply`
|
|
102
119
|
- flow -> `app_flow_apply`
|
|
103
|
-
- views -> `app_views_apply`
|
|
104
|
-
-
|
|
120
|
+
- existing views -> `app_views_apply.patch_views`; new/full views -> `app_views_apply.upsert_views`
|
|
121
|
+
- existing buttons -> `app_custom_buttons_apply.patch_buttons`; new/full buttons -> `app_custom_buttons_apply.upsert_buttons`
|
|
122
|
+
- existing associated resources -> `app_associated_resources_apply.patch_resources`; new/full resources -> `app_associated_resources_apply.upsert_resources`
|
|
123
|
+
- existing charts -> `app_charts_apply.patch_charts`; new/full charts -> `app_charts_apply.upsert_charts`
|
|
105
124
|
- portal -> `portal_apply`
|
|
106
125
|
- package metadata/layout -> `package_apply`
|
|
107
126
|
8. Use `app_publish_verify` only when the user explicitly wants final publish/live verification or you need a dedicated verification pass
|
|
@@ -127,6 +146,9 @@ Treat these as the official surface. Do not default to `package_create`, `packag
|
|
|
127
146
|
- For portals, distinguish clearly between:
|
|
128
147
|
- base-info-only update with layout preserved
|
|
129
148
|
- full sections replace
|
|
149
|
+
- For object apply tools, distinguish clearly between:
|
|
150
|
+
- `patch_*`: public partial parameter replacement; the tool hydrates current config and full-saves internally
|
|
151
|
+
- `upsert_*`: create or full target configuration; omitted fields may mean default/clear depending on that object
|
|
130
152
|
- For charts, distinguish clearly between:
|
|
131
153
|
- base / visibility change
|
|
132
154
|
- real chart-config change
|
|
@@ -149,10 +171,10 @@ Treat these as the official surface. Do not default to `package_create`, `packag
|
|
|
149
171
|
- Add/update/remove fields: `app_schema_apply`
|
|
150
172
|
- Merge or replace layout: `app_layout_apply`
|
|
151
173
|
- 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
|
-
-
|
|
155
|
-
- Upsert/remove/reorder charts: `app_charts_apply`
|
|
174
|
+
- Upsert/patch/remove views: `app_views_apply`
|
|
175
|
+
- Upsert/patch/remove custom buttons and bind them to header/detail view positions: `app_custom_buttons_apply`
|
|
176
|
+
- Upsert/patch/remove app associated reports/views and per-view display: `app_associated_resources_apply`
|
|
177
|
+
- Upsert/patch/remove/reorder charts: `app_charts_apply`
|
|
156
178
|
- Create or update portal pages: `portal_apply`
|
|
157
179
|
- Release your own stale edit lock: `app_release_edit_lock_if_mine`
|
|
158
180
|
- Final publish verification: `app_publish_verify`
|
|
@@ -176,8 +198,9 @@ Use `app_custom_buttons_apply` for the whole custom-button path: button body, ad
|
|
|
176
198
|
"trigger_add_data_config": {
|
|
177
199
|
"target_app_key": "WORKLOG_APP",
|
|
178
200
|
"field_mappings": [
|
|
179
|
-
{"source_field": "
|
|
180
|
-
{"source_field": "
|
|
201
|
+
{"source_field": "数据ID", "target_field": "关联员工"},
|
|
202
|
+
{"source_field": "员工名称", "target_field": "员工姓名"},
|
|
203
|
+
{"source_field": "所属部门", "target_field": "部门名称"}
|
|
181
204
|
],
|
|
182
205
|
"default_values": {
|
|
183
206
|
"工时类型": "日常工作",
|
|
@@ -200,13 +223,16 @@ Use `app_custom_buttons_apply` for the whole custom-button path: button body, ad
|
|
|
200
223
|
}
|
|
201
224
|
```
|
|
202
225
|
|
|
203
|
-
`button_ref` may be a same-call `client_key` or an existing `button_id`.
|
|
226
|
+
`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.
|
|
227
|
+
|
|
228
|
+
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
229
|
|
|
205
230
|
## Resources
|
|
206
231
|
|
|
207
232
|
- Shared public-surface baseline: [public-surface-sync.md](../qingflow-app-user/references/public-surface-sync.md)
|
|
208
233
|
- Environment switching: [references/environments.md](references/environments.md)
|
|
209
234
|
- Tool choice and sequencing: [references/tool-selection.md](references/tool-selection.md)
|
|
235
|
+
- Field matching rules: [references/match-rules.md](references/match-rules.md)
|
|
210
236
|
- Result semantics and gotchas: [references/gotchas.md](references/gotchas.md)
|
|
211
237
|
- Create one app in an existing package: [references/create-app.md](references/create-app.md)
|
|
212
238
|
- Update fields only: [references/update-schema.md](references/update-schema.md)
|
|
@@ -28,13 +28,25 @@
|
|
|
28
28
|
## Custom buttons
|
|
29
29
|
|
|
30
30
|
- 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.
|
|
31
|
+
- 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
32
|
- For add-data buttons, prefer semantic `trigger_add_data_config.target_app_key`, `field_mappings`, and `default_values`.
|
|
32
33
|
- 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.
|
|
34
|
+
- `field_mappings.source_field` can use source app fields and supported system fields such as `数据ID` (`field_id=-17`) and `编号` (`field_id=0`).
|
|
35
|
+
- To fill a target relation field with the current source record, map `{"source_field": "数据ID", "target_field": "目标引用字段"}`. Use `default_values` only for static constants.
|
|
36
|
+
- For field type compatibility, read `references/match-rules.md`.
|
|
33
37
|
- Default button placements are `header` and `detail`; these map to the frontend's header and detail button areas.
|
|
34
38
|
- `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.
|
|
39
|
+
- 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
40
|
- 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
41
|
- 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`
|
|
42
|
+
- `placement=list` configures row/list buttons. The tool maps it to the backend `INSIDE` button position, not a raw `LIST` config type.
|
|
43
|
+
|
|
44
|
+
## Associated resources
|
|
45
|
+
|
|
46
|
+
- Before creating an associated view/report, check `app_get.associated_resources` for the same `target_app_key + view_key/chart_key`.
|
|
47
|
+
- If the resource already exists, use `patch_resources` with its `associated_item_id`; do not call `upsert_resources` again.
|
|
48
|
+
- `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.
|
|
49
|
+
- Repeated `upsert_resources` without `associated_item_id` can create multiple app-level associated items pointing to the same view/report.
|
|
38
50
|
|
|
39
51
|
## Readback scope
|
|
40
52
|
|
|
@@ -44,6 +56,15 @@
|
|
|
44
56
|
- Use `app_get_flow` before workflow work
|
|
45
57
|
- Use `app_get_views` before view work
|
|
46
58
|
|
|
59
|
+
## Partial update discipline
|
|
60
|
+
|
|
61
|
+
- Existing views, custom buttons, associated resources, and charts support the same public partial pattern: `patch_*[].set` plus optional `patch_*[].unset`.
|
|
62
|
+
- 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.
|
|
63
|
+
- 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.
|
|
64
|
+
- `app_layout_apply(mode=merge)` is already a safe layout merge path; `mode=replace` is full layout replacement.
|
|
65
|
+
- `portal_apply` without `sections` is base-info-only. Supplying `sections` replaces the portal sections list.
|
|
66
|
+
- `app_flow_apply` is intentionally replace-only for the public linear workflow graph.
|
|
67
|
+
|
|
47
68
|
## Workflow dependencies
|
|
48
69
|
|
|
49
70
|
- Approval-style flows usually require an explicit status field
|
|
@@ -66,6 +87,7 @@
|
|
|
66
87
|
- `assignees.role_ids` / `assignees.member_uids` / `assignees.member_emails`
|
|
67
88
|
- `permissions.editable_fields`
|
|
68
89
|
- 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.
|
|
90
|
+
- 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
91
|
- 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
92
|
- 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
93
|
- 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`:
|
|
49
|
-
- `app_custom_buttons_apply`:
|
|
50
|
-
- `app_associated_resources_apply`:
|
|
51
|
-
- `app_charts_apply`:
|
|
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`: use `patch_resources` for existing associated-resource parameter replacement; use `upsert_resources` for creation or full target config; use `match_mappings` for associated view/report filters; manage per-view display config; publishes after successful writes; omit raw `sourceType`, and use `report_source="dataset"` only for BI dataset reports. 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`: use `patch_charts` for existing-chart parameter replacement; use `upsert_charts` for creation or full target config; remove/reorder QingBI charts; 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,9 @@ 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`
|
|
76
78
|
- Create or update a portal:
|
|
77
79
|
`builder_tool_contract -> portal_get -> portal_apply -> portal_get`
|
|
78
80
|
|
|
@@ -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` 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"`. 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
|
-
|
|
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
|
-
"
|
|
71
|
+
"patch_views": [
|
|
70
72
|
{
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
"
|
|
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 must come 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`. 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": [],
|