Delete Project
delete_projectDelete a project by UUID, permanently removing it along with its environments, credentials, and test history. No undo. Returns deletion confirmation or error if project doesn't exist.
Instructions
Delete a project by UUID. Returns {deleted:true, uuid}. DESTRUCTIVE — removes the project and its associated environments, credentials, and test history. No undo. Returns isError:true + NotFound when already deleted or uuid doesn't exist.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | Yes | UUID of the project to delete. Required. |
Implementation Reference
- handlers/deleteProjectHandler.ts:20-45 (handler)Main handler function for the delete_project tool. Creates a DebuggAIServerClient, calls deleteProject(uuid), and returns {deleted:true, uuid}. Handles 404 errors by returning isError response.
export async function deleteProjectHandler( input: DeleteProjectInput, _context: ToolContext, ): Promise<ToolResponse> { const start = Date.now(); logger.toolStart('delete_project', { uuid: input.uuid }); try { const client = new DebuggAIServerClient(config.api.key); await client.init(); try { await client.deleteProject(input.uuid); logger.toolComplete('delete_project', Date.now() - start); return { content: [{ type: 'text', text: JSON.stringify({ deleted: true, uuid: input.uuid }, null, 2) }], }; } catch (err: any) { if (err?.statusCode === 404 || err?.response?.status === 404) return notFound(input.uuid); throw err; } } catch (error) { logger.toolError('delete_project', error as Error, Date.now() - start); throw handleExternalServiceError(error, 'DebuggAI', 'delete_project'); } } - types/index.ts:138-141 (schema)Schema for delete_project input: requires uuid (string, UUID format). Uses Zod validation.
export const DeleteProjectInputSchema = z.object({ uuid: z.string().uuid(), }).strict(); export type DeleteProjectInput = z.infer<typeof DeleteProjectInputSchema>; - tools/deleteProject.ts:7-21 (registration)Tool definition registration with name 'delete_project', description, and inputSchema (uuid string with required constraint).
export function buildDeleteProjectTool(): Tool { return { name: 'delete_project', title: 'Delete Project', description: DESCRIPTION, inputSchema: { type: 'object', properties: { uuid: { type: 'string', description: 'UUID of the project to delete. Required.' }, }, required: ['uuid'], additionalProperties: false, }, }; } - tools/deleteProject.ts:23-26 (registration)Validated tool builder that combines the tool definition with the Zod inputSchema and the handler function.
export function buildValidatedDeleteProjectTool(): ValidatedTool { const tool = buildDeleteProjectTool(); return { ...tool, inputSchema: DeleteProjectInputSchema, handler: deleteProjectHandler }; } - services/index.ts:134-137 (helper)Service-layer helper that performs the actual HTTP DELETE call to api/v1/projects/{uuid}/ via the transaction client.
public async deleteProject(uuid: string): Promise<void> { if (!this.tx) throw new Error('Client not initialized — call init() first'); await this.tx.delete(`api/v1/projects/${uuid}/`); }