bulk_delete_qr_codes
Remove multiple QR codes and their analytics simultaneously in one batch operation, handling up to 50 codes with individual error reporting for non-existent items.
Instructions
Delete multiple QR codes and their scan analytics in a single request (up to 50). Items with non-existent short_id are reported as not_found without failing the whole batch.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| short_ids | Yes | Array of short_id strings to delete. Max 50 per request. |
Implementation Reference
- src/modules/qr/qr.service.ts:508-532 (handler)The actual implementation of bulk_delete_qr_codes which iterates over short IDs, checks if they exist for the given API key, and deletes them from the database.
export function bulkDeleteQrCodes(shortIds: string[], apiKeyId: number) { let deleted = 0; let notFound = 0; const results: Array<{ short_id: string; status: "deleted" | "not_found" }> = []; for (const shortId of shortIds) { const existing = db .select() .from(qrCodes) .where(and(eq(qrCodes.shortId, shortId), eq(qrCodes.apiKeyId, apiKeyId))) .get(); if (!existing) { notFound++; results.push({ short_id: shortId, status: "not_found" }); continue; } db.delete(qrCodes).where(eq(qrCodes.shortId, shortId)).run(); deleted++; results.push({ short_id: shortId, status: "deleted" }); } return { deleted, not_found: notFound, items: results }; } - packages/mcp/src/tools.ts:261-274 (registration)MCP tool registration for bulk_delete_qr_codes. It forwards the request to the /api/qr/bulk endpoint.
bulk_delete_qr_codes: { description: "Delete multiple QR codes and their scan analytics in a single request (up to 50). Items with non-existent short_id are reported as not_found without failing the whole batch.", inputSchema: z.object({ short_ids: z .array(z.string()) .min(1) .max(50) .describe("Array of short_id strings to delete. Max 50 per request."), }), handler: async (input: Record<string, unknown>) => { return apiRequest("/api/qr/bulk", { method: "DELETE", body: input }); }, },