Skip to main content
Glama
akuity

argocd-mcp

Official
by akuity

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
NameRequiredDescriptionDefault
applicationNameYes
applicationYes

Implementation Reference

  • Registers the MCP 'update_application' tool with input schema and inline handler that delegates to ArgoCDClient
    this.addJsonOutputTool(
      'update_application',
      'update_application updates application',
      { applicationName: z.string(), application: ApplicationSchema },
      async ({ applicationName, application }) =>
        await this.argocdClient.updateApplication(
          applicationName,
          application as V1alpha1Application
        )
    );
  • Core handler logic: performs HTTP PUT to ArgoCD API endpoint /api/v1/applications/{applicationName} with the application manifest
    public async updateApplication(applicationName: string, application: V1alpha1Application) {
      const { body } = await this.client.put<V1alpha1Application, V1alpha1Application>(
        `/api/v1/applications/${applicationName}`,
        null,
        application
      );
      return body;
  • Zod schema for validating the input 'application' object (V1alpha1Application) used by the tool
    export 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.`
          )
      })
    });
  • 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) }]
          };
        }
      });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/akuity/argocd-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server