You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ad203a2
Browse filesBrowse the repository at this point in the historyBrowse files
fix(mcp): delete_records reads at the cap, stops on a fault, needs both data scopes
Contract-review fixes on the delete_records tool (#30891):
- The filter selection is read at the cap, not one row past it; whether
more match is the aggregate count's answer. The cap+1 probe stays only
for a bridge without aggregate. The per-call cap follows the deployment's
read window down (OS_DATA_MAX_PAGE_SIZE / OS_DATA_QUERY_ROW_BUDGET), since
the data door refuses a larger read; an id list longer than that cap is
refused before anything is read.
- A row's throw is judged with the REST data door's own classifier
(mapDataError): a 4xx verdict is a refusal and is grouped, a 5xx verdict
is a fault and stops the call, answered isError with the fault, the
record it stopped at and the call's progress.
- delete_records registers only under both data:read and data:write.
- The error-code ledger's ACTION_CONFIRMATION_REQUIRED rows name both
delete tools.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibx1NhZMrqCvW7FBxg5
Copy file name to clipboardExpand all lines: .changeset/30891-mcp-delete-records.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,17 @@
5
5
6
6
feat(mcp): `delete_records` deletes many records of one object in one confirmed call, by a filter or an id list (#30891)
7
7
8
-
Clause-②: yes (widening) — the MCP surface (HTTP `/api/v1/mcp` and the stdio server) registers one more `data:write` tool, `delete_records`; no existing tool, input or answer changes.
8
+
Clause-②: yes (widening) — the MCP surface (HTTP `/api/v1/mcp` and the stdio server) registers one more tool, `delete_records`, offered to an OAuth token that carries both `data:read` and `data:write`; no existing tool, input or answer changes.
9
9
Metadata-protocol: none
10
10
11
11
An agent that had to clear a set of records called `delete_record` once per row, and confirmed each one. `delete_records` takes the selection as `where` (a filter, `{}` for every record) or `recordIds` (an id list), never both.
12
12
13
13
-**The preview is the refusal.** A call without `confirm: true` deletes nothing. It answers `delete_record`'s refusal (`428``ACTION_CONFIRMATION_REQUIRED`, the same `details` keys, `details.actionName` naming `delete_records`) with a `preview` member beside `error`: how many records the selection matches for this caller (`matched`), how many a confirmed call attempts (`wouldAttempt`), up to ten sample ids and, for an id list, the ids that name no readable record (`notFound`). The agent shows that to its human and retries with `confirm: true` once they approve.
14
14
-**A confirmed call deletes each record as `delete_record` does**, through the same bridge member, under the caller's permissions, row-level security and the object's delete rules (`beforeDelete` hooks, restricted relations). No caller bypasses a package's locking rule, an administrator included. Records a rule refuses stay, and the answer groups them by code, status and reason, with their ids: `{ matched, attempted, deleted, refused, refusals: [{ code, status, reason, count, recordIds }], remaining, cap }`. A refusal's `details` stays off the wire, as on every other tool.
15
-
-**At most 200 records per call**, the bound REST `POST /data/:object/deleteMany` applies by default (`batch.maxBatchSize`). A filter is worked in id order; when more than 200 match, the answer says how many remain and the next call with the same selection continues. When the deployment has no aggregate support, the answer says `matchedMoreThan: 200` instead of guessing a count.
15
+
-**A fault is not a refusal.** A rule's refusal and a fault are told apart the way the REST `/data` door tells them apart (its own classifier): a 4xx verdict (a coded rule refusal, a sandboxed hook body's `400 HOOK_ABORTED`) is grouped and the call goes on; a 5xx verdict (a code hook's bare `throw new Error`, a lost connection, a driver error, a driver's own string code) stops the call at that record. The tool error names the fault and the record, and carries the call's `progress` (`deleted`, `stoppedAt`, `notAttempted`): the records deleted before it stay deleted.
16
+
-**At most 200 records per call**, the bound REST `POST /data/:object/deleteMany` applies by default (`batch.maxBatchSize`). A filter is read in id order at the cap, and the count says whether more match; when more than 200 match, the answer says how many remain and the next call with the same selection continues. When the deployment has no aggregate support, the answer says `matchedMoreThan: 200` instead of guessing a count. On a deployment whose read page size or row budget (`OS_DATA_MAX_PAGE_SIZE`, `OS_DATA_QUERY_ROW_BUDGET`) is under 200, one call runs at that size, since the data door refuses a larger read, and the answer's `cap` names it; a longer id list is refused before anything is read.
17
+
-**Scopes.** Over OAuth the tool needs both `data:read` and `data:write`: its preview reads the selection's ids and count, a read a `data:write`-only token is not granted.
16
18
17
19
What a preview cannot say: which records a delete rule will refuse. The engine has no delete dry run, so the rules are judged when the confirmed call runs, and the preview says so.
18
20
19
-
`@objectstack/spec` changes only a doc comment: `AIActionConfirmation` names `delete_records` as the third door of the confirmation member.
21
+
`@objectstack/spec` changes only doc comments: `AIActionConfirmation` names `delete_records` as the third door of the confirmation member, and the error-code ledger's `ACTION_CONFIRMATION_REQUIRED` rows name both delete tools.
Copy file name to clipboardExpand all lines: content/docs/ai/connect-mcp.mdx
+9-2Lines changed: 9 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -254,7 +254,7 @@ Thirteen tools, generated from your metadata:
254
254
|`query_records` / `get_record`| Read data (list queries are capped at 50 rows per page by default) |
255
255
|`aggregate_records`| Grouped aggregation (registered when the active driver supports it) |
256
256
|`create_record` / `update_record` / `delete_record`| Write data |
257
-
|`delete_records`| Delete many records of one object, by a filter or an id list, at most 200 per call |
257
+
|`delete_records`| Delete many records of one object, by a filter or an id list, at most 200 per call (an OAuth token needs both `data:read` and `data:write`) |
258
258
|`list_actions` / `run_action`| Discover and invoke your business actions by name |
259
259
|`resume_run`| Finish a flow action that paused on a screen, by submitting the screen's values |
260
260
@@ -395,7 +395,14 @@ drive this MCP server. Same word, different layer.
395
395
locking hook, a restricted relation), which no caller bypasses, an
396
396
administrator included. Records a rule refuses stay, and the answer counts
397
397
them grouped by reason with their ids; when more than 200 match it says how
398
-
many remain, and the next call continues.
398
+
many remain, and the next call continues. On a deployment whose read page
399
+
size or row budget (`OS_DATA_MAX_PAGE_SIZE`, `OS_DATA_QUERY_ROW_BUDGET`) is
400
+
under 200, one call runs at that size instead, and the answer's `cap` says
401
+
so. A fault (a store error, a crash)
402
+
is not a refusal: it stops the call, and the error names the record it
403
+
stopped at and how many were already deleted. Because the preview reads ids
404
+
and a count, an OAuth token is offered the tool only when it carries both
0 commit comments