@qingflow-tech/qingflow-app-user-mcp 1.0.4 → 1.0.6

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.
Files changed (27) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/pyproject.toml +2 -1
  4. package/skills/qingflow-app-user/SKILL.md +2 -1
  5. package/skills/qingflow-app-user/references/data-gotchas.md +8 -4
  6. package/skills/qingflow-app-user/references/public-surface-sync.md +6 -4
  7. package/skills/qingflow-app-user/references/record-patterns.md +14 -4
  8. package/skills/qingflow-record-analysis/SKILL.md +103 -166
  9. package/skills/qingflow-record-analysis/agents/openai.yaml +2 -2
  10. package/skills/qingflow-record-analysis/references/analysis-gotchas.md +56 -110
  11. package/skills/qingflow-record-analysis/references/analysis-patterns.md +106 -119
  12. package/skills/qingflow-record-analysis/references/business-context.md +74 -0
  13. package/skills/qingflow-record-analysis/references/confidence-reporting.md +49 -72
  14. package/skills/qingflow-record-analysis/references/data-access-playbook.md +106 -0
  15. package/skills/qingflow-record-analysis/references/pandas-recipes.md +172 -0
  16. package/skills/qingflow-record-analysis/references/report-format.md +76 -0
  17. package/skills/qingflow-record-insert/SKILL.md +28 -7
  18. package/skills/qingflow-record-update/SKILL.md +1 -1
  19. package/src/qingflow_mcp/backend_client.py +55 -1
  20. package/src/qingflow_mcp/cli/commands/record.py +63 -6
  21. package/src/qingflow_mcp/cli/formatters.py +101 -1
  22. package/src/qingflow_mcp/public_surface.py +2 -1
  23. package/src/qingflow_mcp/response_trim.py +235 -10
  24. package/src/qingflow_mcp/server.py +19 -12
  25. package/src/qingflow_mcp/server_app_user.py +30 -13
  26. package/src/qingflow_mcp/tools/record_tools.py +13425 -8817
  27. package/skills/qingflow-record-analysis/references/dsl-templates.md +0 -93
@@ -33,7 +33,7 @@ def build_user_server() -> FastMCP:
33
33
 
34
34
  If `app_key` is unknown, use `app_list` or `app_search` first.
35
35
  If the app is known but the data range is not, use `app_get` first and choose from `accessible_views`.
36
- If an accessible view has `analysis_supported=false`, do not use it for `record_list` or `record_analyze`. `boardView` and `ganttView` are special UI views, not list/analyze targets.
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.
38
38
 
39
39
  ## Shared Helper
@@ -49,7 +49,7 @@ If an accessible view has `analysis_supported=false`, do not use it for `record_
49
49
  Call `record_insert_schema_get` before `record_insert`.
50
50
  Call `record_update_schema_get` before `record_update`.
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_list`, `record_get`, or `record_analyze`.
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 `record_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.
@@ -60,7 +60,9 @@ Call `record_import_schema_get` when the import field mapping is unclear before
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
62
  `record_update_schema_get` returns the current record's overall update-ready writable field set across matched accessible views; read `writable_fields` and `payload_template`.
63
- `record_browse_schema_get(view_id=...)` returns browse-schema fields for the selected accessible view.
63
+ `record_browse_schema_get(view_id=...)` returns the same readable fields shown in the selected Qingflow table view header.
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
+ `searchQueIds` is a backend full-text search scope, not an output-column/projection mechanism.
64
66
  `record_code_block_schema_get` returns code-block-ready schema for exact code block field selection.
65
67
  `record_import_schema_get` returns import-ready column metadata.
66
68
 
@@ -70,16 +72,19 @@ Inside `optional_fields`, any field with `may_become_required=true` is still wri
70
72
 
71
73
  ## Analytics Path
72
74
 
73
- `app_get -> record_browse_schema_get(view_id=...) -> record_analyze`
75
+ `app_get -> record_browse_schema_get(view_id=...) -> record_access -> Python`
74
76
 
75
77
  Prefer `view_id` entries from `accessible_views` where `analysis_supported=true`.
76
78
 
77
- Use this DSL shape:
79
+ Use `record_access` to write local CSV shard files, then use Python to compute counts, rankings, ratios, trends, and final conclusions. `record_access` does not return bulk `items`; read `files[].local_path`. CSV columns are readable and field-id anchored, such as `项目状态__field_343283094`, and `fields[]` is the compact metadata source.
80
+ For analysis-style tasks, prefer an explicit time range or business filter. If `record_access.status == "needs_scope"`, do not treat it as a failure; ask for a time/business scope or retry with a user-provided period using `scope.suggested_time_fields` / `scope.recommended_where_examples`. If `record_access.status == "partial"`, read the returned files only as a limited subset and do not give a final full-population conclusion.
81
+ Use `chart_get` only when the user provides a report URL / chart_id or explicitly asks to read an existing report. Do not use QingBI as the default analysis route.
78
82
 
79
- - `dimensions`: `{{field_id, alias, bucket}}`
80
- - `metrics`: `{{op, field_id, alias}}`
81
- - `filters`: `{{field_id, op, value}}`
82
- - `sort`: `{{by, order}}`
83
+ Use this data-access DSL shape:
84
+
85
+ - `columns`: `[{{field_id}}]`
86
+ - `where`: `[{{field_id, op, value}}]`
87
+ - `order_by`: `[{{field_id, direction}}]`
83
88
 
84
89
  Important key rules:
85
90
 
@@ -89,12 +94,16 @@ Important key rules:
89
94
  - Do **not** use `aggregation`
90
95
  - Do **not** use `operator`
91
96
 
97
+ `record_list` is for browsing and sample checks, not final analysis conclusions.
98
+ For fuzzy single-record lookup, use `record_list(query=..., query_fields=[{{field_id}}])` to find candidates, read `lookup.next_action`, and only call `record_get` after one candidate is clear.
99
+ `record_list.query_fields` maps to backend full-text search scope (`searchQueIds`); `record_list.columns` only controls displayed fields.
100
+
92
101
  Analysis answers must include concrete numbers. When applicable, include percentages based on the returned totals.
93
102
 
94
103
  ## Record CRUD Path
95
104
 
96
105
  `app_get -> record_browse_schema_get(view_id=...) -> record_list / record_get`
97
- `record_insert_schema_get -> record_insert`
106
+ `record_insert_schema_get -> record_insert(items)`
98
107
  `record_update_schema_get -> record_update`
99
108
  `record_list / record_get -> record_delete`
100
109
  `record_code_block_schema_get -> record_code_block_run`
@@ -102,11 +111,12 @@ Analysis answers must include concrete numbers. When applicable, include percent
102
111
  `portal_get -> view_get -> record_list`
103
112
 
104
113
  - Use `columns` as `[{{field_id}}]`
114
+ - Use `query` plus optional `query_fields` when the user provides fuzzy record-identifying text
105
115
  - Use `where` items as `{{field_id, op, value}}`
106
116
  - Use `order_by` items as `{{field_id, direction}}`
107
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
108
118
 
109
- - `record_insert` uses an applicant-node `fields` map keyed by field title.
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.
110
120
  - `record_update` uses a field-title keyed `fields` map and internally selects the first accessible view that can execute the current payload.
111
121
  - For insert, `runtime_linked_required_fields` means required-but-not-directly-writable fields that are usually supplied by runtime linkage or upstream context.
112
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.
@@ -115,10 +125,14 @@ Analysis answers must include concrete numbers. When applicable, include percent
115
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.
116
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 accessible view that can cover the payload.
117
127
  - `record_delete` deletes by `record_id` or `record_ids`.
118
- - When readback shape matters after insert or update, prefer `record_get(..., output_profile="normalized")` or `record_list(..., output_profile="normalized")`.
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
+ - 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
+ - `record_get.columns` are focus hints only; they do not project the detail fields. Read facts from top-level `fields[]`.
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.
119
132
 
120
133
  - Read relation targets from `record_insert_schema_get` / `record_update_schema_get` relation metadata before preparing relation writes.
121
- - Member and department fields may be written with natural strings directly on `record_insert` / `record_update`; only fall back to `record_member_candidates` or `record_department_candidates` when the user wants explicit candidate browsing or the write returns ambiguity that needs confirmation.
134
+ - Member, department, and relation fields may be written with natural strings directly on `record_insert` / `record_update`; only fall back to candidate tools when the user wants explicit candidate browsing or the write returns ambiguity that needs confirmation.
135
+ - For batch insert `partial_success`, read `created_record_ids`, failed `items[].row_number`, and `failed_fields`; repair only failed rows and never retry the whole batch after any row has `write_executed=true`.
122
136
  - When candidate browsing must match a real update/write scope, pass `record_id`, `workflow_node_id`, and any pending `fields` context to the candidate tool; otherwise the candidate result is only a static applicant-node preview.
123
137
  - If explicit candidate browsing is needed for default-all member or department fields, prefer those field candidate tools instead of starting with `directory_*`.
124
138
 
@@ -146,9 +160,12 @@ Use `record_code_block_run` when the user wants to execute a form code-block fie
146
160
 
147
161
  ## Export Path
148
162
 
163
+ Use export only when the user explicitly asks to export/download/generate an Excel or export file.
164
+
149
165
  `view_get -> record_export_start -> record_export_status_get -> record_export_get`
150
166
 
151
167
  - `record_export_direct` is the one-shot path that starts export, waits, downloads locally, and still returns remote download links.
168
+ - Do not use `record_export_direct` as the default analysis path; use `record_access -> Python` instead.
152
169
  - Export v1 supports record views only and follows the same public `view_id` semantics as `record_list`.
153
170
  - `record_export_start` / `record_export_direct` support frontend-like row selection:
154
171
  - omit `record_ids` to export all rows in the selected view