#26867·twenty

MCP: delete_one_*/delete_many_* are advertised for objects excluded from automation and always fail

Author: xgpCreated Sep 28, 2026Updated Sep 28, 2026
Labelsprio: high

Summary

database-tool.provider.ts gates the create/update tools on canObjectBeManagedByAutomation, but gates the delete tools on the record permission alone. The delete services enforce the automation check at execution time regardless. The result is 18 tools that are advertised in the catalog and can never succeed — for every object on the automation exclusion list, delete_one_* and delete_many_* are offered, load a schema, and then always fail.

Reproduction

Create a dashboard over MCP and try to delete it the same way:

execute_tool  create_complete_dashboard  { "title": "delete-repro" }
→ { "success": true, "result": { "dashboardId": "179f0370-…" } }

execute_tool  delete_one_dashboard    { "id": "179f0370-…" }
→ { "success": false, "error": "Failed to delete: Object cannot be deleted by automation" }

execute_tool  delete_many_dashboards  { "filter": { "id": { "in": ["179f0370-…"] } } }
→ { "success": false, "error": "Failed to delete: Object cannot be deleted by workflow" }

The same API key deletes it over GraphQL without complaint, so this is not a permission problem:

graphql
mutation { deleteDashboard(id: "179f0370-…")  { id deletedAt } }   # ok
mutation { destroyDashboard(id: "179f0370-…") { id } }             # ok

So an agent can create a dashboard over MCP but can never remove one. Anything it creates by mistake is permanent as far as the tool surface is concerned.

It is not specific to dashboards — the guard fires before any record lookup:

delete_many_messages        { "filter": { "id": { "in": ["…"] } } }
→ "Failed to delete: Object cannot be deleted by workflow"
delete_many_calendar_events { "filter": { "id": { "in": ["…"] } } }
→ "Failed to delete: Object cannot be deleted by workflow"

Cause

In packages/twenty-server/src/engine/core-modules/tool-provider/providers/database-tool.provider.ts (line numbers from main):

typescript
186:  const canBeManagedByAutomation = canObjectBeManagedByAutomation({ … });
…
280:  if (canUpdateRecords && canBeManagedByAutomation) {   // create_one/create_many/update_one/update_many
…
416:  if (canSoftDeleteRecords) {                           // delete_one/delete_many — guard missing
418:    name: `delete_one_${snakeSingular}`,
441:    name: `delete_many_${snakePlural}`,

Meanwhile both delete services enforce it:

  • record-crud/services/delete-record.service.ts:57 — 'Failed to delete: Object cannot be deleted by automation'
  • record-crud/services/delete-many-records.service.ts:51 — 'Failed to delete: Object cannot be deleted by workflow'

Creates and updates are correctly filtered out of the catalog for these objects; only deletes leak through.

Affected tools

OBJECTS_NOT_MANAGED_BY_AUTOMATION (packages/twenty-shared/src/workflow/utils/canObjectBeManagedByAutomation.ts) lists 13 objects. Four of them (workflow, workflowVersion, workflowRun, workflowAutomatedTrigger) get dedicated WORKFLOW-category tools instead of CRUD tools, so they are unaffected. The remaining nine each contribute two unusable tools:

Object Tools always failing
dashboard delete_one_dashboard, delete_many_dashboards
workspaceMember delete_one_workspace_member, delete_many_workspace_members
message delete_one_message, delete_many_messages
messageThread delete_one_message_thread, delete_many_message_threads
messageChannelMessageAssociation delete_one_message_channel_message_association, delete_many_message_channel_message_associations
messageParticipant delete_one_message_participant, delete_many_message_participants
calendarEvent delete_one_calendar_event, delete_many_calendar_events
calendarEventParticipant delete_one_calendar_event_participant, delete_many_calendar_event_participants
calendarChannelEventAssociation delete_one_calendar_channel_event_association, delete_many_calendar_channel_event_associations

Why this matters

The MCP surface tells agents to trust discovery — get_tool_catalog then learn_tools then execute_tool, and not to guess tool names. A tool that is listed, documented and schema-complete is a promise that the operation is available. Eighteen of them are not, and nothing in the catalog, the descriptions or the object metadata distinguishes them: isSystem, isUIEditable and isUICreatable are exposed on Object, but there is no flag an agent could read to predict the restriction. The only way to discover it is to call the tool and fail.

For an agent doing bulk housekeeping this is worse than a missing tool. A missing tool is planned around; a failing one is discovered halfway through a cleanup, and the agent cannot tell whether it hit a policy, a permission or a transient error.

Suggested fix

One line, matching the create/update branch:

typescript
if (canSoftDeleteRecords && canBeManagedByAutomation) {

Two smaller things worth folding in:

  1. The two services disagree on wording — "cannot be deleted by automation" vs "cannot be deleted by workflow" for the same condition. Worth making identical, and naming the object, since MCP is neither a workflow nor obviously "automation" from the caller's side.
  2. Neither message says the operation is possible over GraphQL or in the UI, which is the actionable part.

Environment

  • twentycrm/twenty:latest, twenty-server 0.2.1, self-hosted via Docker Compose, Postgres 16
  • Line numbers and quoted strings verified against main as well as the running image