update_application
Modify ArgoCD application configurations to change deployment source, destination, or sync policies for continuous delivery updates.
Instructions
update_application updates application
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| applicationName | Yes | ||
| application | Yes |
Implementation Reference
- src/server/server.ts:221-230 (registration)Registers the MCP 'update_application' tool with input schema and inline handler that delegates to ArgoCDClientthis.addJsonOutputTool( 'update_application', 'update_application updates application', { applicationName: z.string(), application: ApplicationSchema }, async ({ applicationName, application }) => await this.argocdClient.updateApplication( applicationName, application as V1alpha1Application ) );
- src/argocd/client.ts:86-92 (handler)Core handler logic: performs HTTP PUT to ArgoCD API endpoint /api/v1/applications/{applicationName} with the application manifestpublic async updateApplication(applicationName: string, application: V1alpha1Application) { const { body } = await this.client.put<V1alpha1Application, V1alpha1Application>( `/api/v1/applications/${applicationName}`, null, application ); return body;
- src/shared/models/schema.ts:22-67 (schema)Zod schema for validating the input 'application' object (V1alpha1Application) used by the toolexport const ApplicationSchema = z.object({ metadata: z.object({ name: z.string(), namespace: ApplicationNamespaceSchema }), spec: z.object({ project: z.string(), source: z.object({ repoURL: z.string(), path: z.string(), targetRevision: z.string() }), syncPolicy: z.object({ syncOptions: z.array(z.string()), automated: z.object({ prune: z.boolean(), selfHeal: z.boolean() }).optional(), retry: z .object({ limit: z.number(), backoff: z.object({ duration: z.string(), maxDuration: z.string(), factor: z.number() }) }) }), destination: z.object({ server: z.string().optional(), namespace: z.string().optional(), name: z.string().optional() }) .refine( (data: { server?: string; name?: string }) => (!data.server && !!data.name) || (!!data.server && !data.name), { message: "Only one of server or name must be specified in destination" } ) .describe( `The destination of the application. Only one of server or name must be specified.` ) }) });
- src/server/server.ts:321-340 (helper)Helper method that wraps tool callbacks to provide JSON output formatting and error handling for all tools including update_application.private addJsonOutputTool<Args extends ZodRawShape, T>( name: string, description: string, paramsSchema: Args, cb: (...cbArgs: Parameters<ToolCallback<Args>>) => T ) { this.tool(name, description, paramsSchema as ZodRawShape, async (...args) => { try { const result = await cb.apply(this, args as Parameters<ToolCallback<Args>>); return { isError: false, content: [{ type: 'text', text: JSON.stringify(result) }] }; } catch (error) { return { isError: true, content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }] }; } });