Delete Custom Rule
delete_custom_rulePermanently delete a custom rule to stop it from running on future scans, while preserving tags already applied to past scans.
Instructions
Permanently delete a custom rule. Already-applied tags on past scans are preserved; the rule simply stops running on future scans.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rule_id | Yes | Rule UUID to delete. |
Implementation Reference
- The tool definition and handler for 'delete_custom_rule'. The handler calls ctx.api.deleteCustomRule(input.rule_id) and returns { deleted: true } on success.
export const deleteCustomRuleTool: Tool<DeleteCustomRuleInputShape, DeleteCustomRuleOutput> = { name: "delete_custom_rule", description: "Permanently delete a custom rule. Already-applied tags on past scans are preserved; the rule simply stops running on future scans.", annotations: { title: "Delete Custom Rule", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false, }, inputSchema: z.object(DeleteCustomRuleInputShape), handler: async (input, ctx): Promise<Result<DeleteCustomRuleOutput, ToolError>> => { const result = await ctx.api.deleteCustomRule(input.rule_id); if (result.isErr()) return err(mapApiError(result.error)); return ok({ deleted: true }); }, }; - Input schema (rule_id: z.string().uuid()) and output type (DeleteCustomRuleOutput with { deleted: true }).
const DeleteCustomRuleInputShape = { rule_id: z.string().uuid().describe("Rule UUID to delete."), } as const; type DeleteCustomRuleInputShape = typeof DeleteCustomRuleInputShape; export interface DeleteCustomRuleOutput { readonly deleted: true; } - src/application/tool-registry.ts:60-164 (registration)Import and registration of deleteCustomRuleTool in the tool registry (import on line 60, register call on line 164).
import { deleteCustomRuleTool } from "./tools/custom-rules/delete-custom-rule.tool.js"; import { getCustomRuleTool } from "./tools/custom-rules/get-custom-rule.tool.js"; import { listCustomRulesTool } from "./tools/custom-rules/list-custom-rules.tool.js"; import { testCustomRuleTool } from "./tools/custom-rules/test-custom-rule.tool.js"; import { updateCustomRuleTool } from "./tools/custom-rules/update-custom-rule.tool.js"; import { listEmulatorsTool } from "./tools/emulators/list-emulators.tool.js"; import { listGeosTool } from "./tools/geos/list-geos.tool.js"; import { listInvoicesTool } from "./tools/invoicing/list-invoices.tool.js"; import { createPolicySetTool } from "./tools/policy-sets/create-policy-set.tool.js"; import { deletePolicySetTool } from "./tools/policy-sets/delete-policy-set.tool.js"; import { getPolicySetTool } from "./tools/policy-sets/get-policy-set.tool.js"; import { listPolicySetsTool } from "./tools/policy-sets/list-policy-sets.tool.js"; import { requestPolicySetApprovalTool } from "./tools/policy-sets/request-policy-set-approval.tool.js"; import { updatePolicySetTool } from "./tools/policy-sets/update-policy-set.tool.js"; import { cancelRunTool } from "./tools/runs/cancel-run.tool.js"; import { getRunTool } from "./tools/runs/get-run.tool.js"; import { listRunScansTool } from "./tools/runs/list-run-scans.tool.js"; import { cancelScanTool } from "./tools/scans/cancel-scan.tool.js"; import { createBulkScansTool } from "./tools/scans/create-bulk-scans.tool.js"; import { createScanTool } from "./tools/scans/create-scan.tool.js"; import { getScanTool } from "./tools/scans/get-scan.tool.js"; import { listScansTool } from "./tools/scans/list-scans.tool.js"; import { recheckScansTool } from "./tools/scans/recheck-scans.tool.js"; import { deleteTagDefinitionTool } from "./tools/tags/delete-tag-definition.tool.js"; import { getTagDefinitionTool } from "./tools/tags/get-tag-definition.tool.js"; import { listScanTagsTool } from "./tools/tags/list-scan-tags.tool.js"; import { listTagsTool } from "./tools/tags/list-tags.tool.js"; import { updateTagDefinitionTool } from "./tools/tags/update-tag-definition.tool.js"; import { bulkReplayWebhookTool } from "./tools/webhooks/bulk-replay-webhook.tool.js"; import { createWebhookTool } from "./tools/webhooks/create-webhook.tool.js"; import { deleteWebhookTool } from "./tools/webhooks/delete-webhook.tool.js"; import { getWebhookTool } from "./tools/webhooks/get-webhook.tool.js"; import { listWebhookDeliveriesTool } from "./tools/webhooks/list-webhook-deliveries.tool.js"; import { listWebhookEventTypesTool } from "./tools/webhooks/list-webhook-event-types.tool.js"; import { listWebhooksTool } from "./tools/webhooks/list-webhooks.tool.js"; import { replayWebhookDeliveryTool } from "./tools/webhooks/replay-webhook-delivery.tool.js"; import { rotateWebhookSecretTool } from "./tools/webhooks/rotate-webhook-secret.tool.js"; import { testWebhookTool } from "./tools/webhooks/test-webhook.tool.js"; import { updateWebhookTool } from "./tools/webhooks/update-webhook.tool.js"; /** * Register every tool with the supplied callback. Grouped by domain * for readability — no order significance. */ export function registerAllTools(register: RegisterTool): void { // account register(getAccountTool); register(updateOrgTool); register(listOrgUsersTool); register(inviteUserTool); register(updateUserRoleTool); register(removeUserTool); register(transferOwnershipTool); register(listOrgRolesTool); register(listApiKeysTool); register(createApiKeyTool); register(revokeApiKeyTool); // reference data register(listGeosTool); register(listEmulatorsTool); // scans register(getScanTool); register(listScansTool); register(cancelScanTool); register(createBulkScansTool); register(createScanTool); register(recheckScansTool); // campaigns register(getCampaignTool); register(listCampaignsTool); register(archiveCampaignTool); register(unarchiveCampaignTool); register(cancelCampaignTool); register(runCampaignTool); register(createCampaignTool); register(updateCampaignTool); register(listCampaignRunsTool); register(listCampaignsPickerTool); // runs register(getRunTool); register(listRunScansTool); register(cancelRunTool); // campaign groups register(getCampaignGroupTool); register(listCampaignGroupsTool); register(createCampaignGroupTool); register(updateCampaignGroupTool); register(runCampaignGroupTool); register(cancelCampaignGroupTool); register(archiveCampaignGroupTool); register(unarchiveCampaignGroupTool); register(pauseCampaignGroupScheduleTool); register(resumeCampaignGroupScheduleTool); // tags register(listTagsTool); register(getTagDefinitionTool); register(updateTagDefinitionTool); register(deleteTagDefinitionTool); register(listScanTagsTool); // custom rules register(listCustomRulesTool); register(getCustomRuleTool); register(createCustomRuleTool); register(updateCustomRuleTool); register(deleteCustomRuleTool); - Infrastructure implementation: HTTP API gateway calls DELETE /api/v1/custom-rules/{rule_id} to delete a custom rule.
async deleteCustomRule(id: string): Promise<Result<null, ApiError>> { return call( "DELETE", "/api/v1/custom-rules/{rule_id}", { params: { path: { rule_id: id } } }, parseEmpty ); }, - Domain port interface: declares deleteCustomRule(id: string) method that tools depend on.
deleteCustomRule(id: string): Promise<Result<null, ApiError>>;