Delete Project
delete_projectPermanently delete a project and all associated environments, credentials, and test history using its UUID. This action cannot be undone and returns an error if the project does not 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 that executes the delete_project tool logic. Creates a DebuggAIServerClient, calls deleteProject, returns success or handles 404/errors.
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)Zod schema definition for DeleteProjectInput (uuid: z.string().uuid()) and the inferred type.
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: name='delete_project', title, description, and inputSchema. Also the validated variant that wires schema + handler together.
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/index.ts:34-45 (registration)Tool registry: buildDeleteProjectTool() and buildValidatedDeleteProjectTool() are called in initTools() to register the tool.
export function initTools(ctx: ProjectContext | null): void { const tools: Tool[] = [ buildTestPageChangesTool(ctx), buildTriggerCrawlTool(ctx), buildProbePageTool(), buildSearchProjectsTool(), buildSearchEnvironmentsTool(), buildCreateEnvironmentTool(), buildUpdateEnvironmentTool(), buildDeleteEnvironmentTool(), buildUpdateProjectTool(), buildDeleteProjectTool(), - services/index.ts:134-137 (helper)Service-layer helper that performs the actual HTTP DELETE request to the API endpoint api/v1/projects/{uuid}/.
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}/`); }