Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat(erp): add deleteMethodOperation function and MCP tool (#853)

Brad Barbin274803da4ef2
diff --git a/apps/erp/app/modules/items/items.service.ts b/apps/erp/app/modules/items/items.service.ts
index fb6dddeab3..54fb3ae717 100644
--- a/apps/erp/app/modules/items/items.service.ts
+++ b/apps/erp/app/modules/items/items.service.ts
@@ -306,6 +306,13 @@ export async function assertMethodOperationIsDraft(
}
}
+export async function deleteMethodOperation(
+ client: SupabaseClient<Database>,
+ methodOperationId: string
+) {
+ return client.from("methodOperation").delete().eq("id", methodOperationId);
+}
+
export async function deleteMethodOperationStep(
client: SupabaseClient<Database>,
id: string
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
index fbf7c91bff..dbc20be1f3 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
@@ -1,6 +1,6 @@
{
- "generated": "2026-06-02T15:45:21.146Z",
- "totalTools": 1083,
+ "generated": "2026-06-03T00:53:36.292Z",
+ "totalTools": 1084,
"modules": 15,
"tools": [
{
@@ -3139,6 +3139,20 @@
"companyId"
]
},
+ {
+ "name": "items_deleteMethodOperation",
+ "module": "items",
+ "classification": "DESTRUCTIVE",
+ "description": "delete method operation",
+ "paramCount": 1,
+ "serviceParams": [
+ "client",
+ "methodOperationId"
+ ],
+ "injectAuth": [
+ "companyId"
+ ]
+ },
{
"name": "items_deleteMethodOperationStep",
"module": "items",
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tools/items.ts b/apps/erp/app/routes/api+/mcp+/lib/tools/items.ts
index 543070c1a6..4116787542 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/tools/items.ts
+++ b/apps/erp/app/routes/api+/mcp+/lib/tools/items.ts
@@ -26,6 +26,7 @@ import {
deleteMaterialGrade,
deleteMaterialSubstance,
deleteMethodMaterial,
+ deleteMethodOperation,
assertMethodOperationIsDraft,
deleteMethodOperationStep,
deleteMethodOperationParameter,
@@ -447,6 +448,21 @@ export const registerItemsTools: RegisterTools = (server, ctx) => {
}, "Failed: items_assertMethodOperationIsDraft"),
);
+ server.registerTool(
+ "items_deleteMethodOperation",
+ {
+ description: "delete method operation",
+ inputSchema: z.object({
+ methodOperationId: z.string(),
+ }),
+ annotations: DESTRUCTIVE_ANNOTATIONS,
+ },
+ withErrorHandling(async (params) => {
+ const result = await deleteMethodOperation(ctx.client, params.methodOperationId);
+ return toMcpResult(result);
+ }, "Failed: items_deleteMethodOperation"),
+ );
+
server.registerTool(
"items_deleteMethodOperationStep",
{