delete_application
Removes a specific application from the ArgoCD MCP server by specifying its applicationName, ensuring resource cleanup and management.
Instructions
delete_application deletes application
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| applicationName | Yes |
Implementation Reference
- src/server/server.ts:248-258 (handler)The handler function for the 'delete_application' MCP tool. It constructs deletion options from input parameters and calls the ArgoCDClient's deleteApplication method.async ({ applicationName, applicationNamespace, cascade, propagationPolicy }) => { const options: Record<string, string | boolean> = {}; if (applicationNamespace) options.appNamespace = applicationNamespace; if (cascade !== undefined) options.cascade = cascade; if (propagationPolicy) options.propagationPolicy = propagationPolicy; return await this.argocdClient.deleteApplication( applicationName, Object.keys(options).length > 0 ? options : undefined ); }
- src/server/server.ts:234-247 (schema)Zod input schema validating parameters for the 'delete_application' tool: applicationName (required), applicationNamespace (optional), cascade (optional boolean), propagationPolicy (optional string). Uses ApplicationNamespaceSchema for namespace validation.{ applicationName: z.string(), applicationNamespace: ApplicationNamespaceSchema.optional().describe( 'The namespace where the application is located. Required if application is not in the default namespace.' ), cascade: z .boolean() .optional() .describe('Whether to cascade the deletion to child resources'), propagationPolicy: z .string() .optional() .describe('Deletion propagation policy (e.g., "Foreground", "Background", "Orphan")') },
- src/server/server.ts:231-259 (registration)Registration of the 'delete_application' tool in the MCP server using addJsonOutputTool, specifying name, description, input schema, and handler callback. Only registered if not in read-only mode.this.addJsonOutputTool( 'delete_application', 'delete_application deletes application. Specify applicationNamespace if the application is in a non-default namespace to avoid permission errors.', { applicationName: z.string(), applicationNamespace: ApplicationNamespaceSchema.optional().describe( 'The namespace where the application is located. Required if application is not in the default namespace.' ), cascade: z .boolean() .optional() .describe('Whether to cascade the deletion to child resources'), propagationPolicy: z .string() .optional() .describe('Deletion propagation policy (e.g., "Foreground", "Background", "Orphan")') }, async ({ applicationName, applicationNamespace, cascade, propagationPolicy }) => { const options: Record<string, string | boolean> = {}; if (applicationNamespace) options.appNamespace = applicationNamespace; if (cascade !== undefined) options.cascade = cascade; if (propagationPolicy) options.propagationPolicy = propagationPolicy; return await this.argocdClient.deleteApplication( applicationName, Object.keys(options).length > 0 ? options : undefined ); } );
- src/argocd/client.ts:95-120 (helper)ArgoCDClient method implementing the actual DELETE request to /api/v1/applications/{name} with query parameters for namespace, cascade, and propagationPolicy.public async deleteApplication( applicationName: string, options?: { appNamespace?: string; cascade?: boolean; propagationPolicy?: string; } ) { const queryParams: Record<string, string | boolean> = {}; if (options?.appNamespace) { queryParams.appNamespace = options.appNamespace; } if (options?.cascade !== undefined) { queryParams.cascade = options.cascade; } if (options?.propagationPolicy) { queryParams.propagationPolicy = options.propagationPolicy; } const { body } = await this.client.delete<V1alpha1Application>( `/api/v1/applications/${applicationName}`, Object.keys(queryParams).length > 0 ? queryParams : undefined ); return body; }
- src/shared/models/schema.ts:3-11 (schema)Shared Zod schema for ArgoCD application namespace, used in the delete_application tool schema. Validates as non-empty string with detailed description.export const ApplicationNamespaceSchema = z .string() .min(1) .describe( `The namespace where the ArgoCD application resource will be created. This is the namespace of the Application resource itself, not the destination namespace for the application's resources. You can specify any valid Kubernetes namespace (e.g., 'argocd', 'argocd-apps', 'my-namespace', etc.). The default ArgoCD namespace is typically 'argocd', but you can use any namespace you prefer.` );