Skip to main content
Glama
argoproj-labs

argocd-mcp

Official

sync_application

Sync an ArgoCD application to its desired state. Supports dry run, prune, and syncing to a specific revision.

Instructions

sync_application syncs application. Specify applicationNamespace if the application is in a non-default namespace to avoid permission errors.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
applicationNameYes
applicationNamespaceNoThe namespace where the application is located. Required if application is not in the default namespace.
dryRunNoPerform a dry run sync without applying changes
pruneNoRemove resources that are no longer defined in the source
revisionNoSync to a specific revision instead of the latest
syncOptionsNoAdditional sync options (e.g., ["CreateNamespace=true", "PrunePropagationPolicy=foreground"])

Implementation Reference

  • The ArgoCDClient.syncApplication method that executes the sync logic, POSTing to /api/v1/applications/{name}/sync with options like appNamespace, dryRun, prune, revision, and syncOptions.
    public async syncApplication(
      applicationName: string,
      options?: {
        appNamespace?: string;
        dryRun?: boolean;
        prune?: boolean;
        revision?: string;
        syncOptions?: string[];
      }
    ) {
      const syncRequest: Record<string, string | boolean | string[]> = {};
    
      if (options?.appNamespace) {
        syncRequest.appNamespace = options.appNamespace;
      }
      if (options?.dryRun !== undefined) {
        syncRequest.dryRun = options.dryRun;
      }
      if (options?.prune !== undefined) {
        syncRequest.prune = options.prune;
      }
      if (options?.revision) {
        syncRequest.revision = options.revision;
      }
      if (options?.syncOptions) {
        syncRequest.syncOptions = options.syncOptions;
      }
    
      const { body } = await this.client.post<V1alpha1Application, V1alpha1Application>(
        `/api/v1/applications/${applicationName}/sync`,
        null,
        Object.keys(syncRequest).length > 0 ? syncRequest : undefined
      );
      return body;
    }
  • Input schema for the 'sync_application' tool, defining applicationName (string), applicationNamespace (optional), dryRun (optional boolean), prune (optional boolean), revision (optional string), and syncOptions (optional array of strings) via Zod.
    'sync_application syncs 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.'
      ),
      dryRun: z
        .boolean()
        .optional()
        .describe('Perform a dry run sync without applying changes'),
      prune: z
        .boolean()
        .optional()
        .describe('Remove resources that are no longer defined in the source'),
      revision: z
        .string()
        .optional()
        .describe('Sync to a specific revision instead of the latest'),
      syncOptions: z
        .array(z.string())
        .optional()
        .describe(
          'Additional sync options (e.g., ["CreateNamespace=true", "PrunePropagationPolicy=foreground"])'
        )
    },
  • Registration of the 'sync_application' tool via addJsonOutputTool within the Server constructor, wrapping the handler callback that delegates to argocdClient.syncApplication.
    this.addJsonOutputTool(
      'sync_application',
      'sync_application syncs 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.'
        ),
        dryRun: z
          .boolean()
          .optional()
          .describe('Perform a dry run sync without applying changes'),
        prune: z
          .boolean()
          .optional()
          .describe('Remove resources that are no longer defined in the source'),
        revision: z
          .string()
          .optional()
          .describe('Sync to a specific revision instead of the latest'),
        syncOptions: z
          .array(z.string())
          .optional()
          .describe(
            'Additional sync options (e.g., ["CreateNamespace=true", "PrunePropagationPolicy=foreground"])'
          )
      },
      async ({ applicationName, applicationNamespace, dryRun, prune, revision, syncOptions }) => {
        const options: Record<string, string | boolean | string[]> = {};
        if (applicationNamespace) options.appNamespace = applicationNamespace;
        if (dryRun !== undefined) options.dryRun = dryRun;
        if (prune !== undefined) options.prune = prune;
        if (revision) options.revision = revision;
        if (syncOptions) options.syncOptions = syncOptions;
    
        return await this.argocdClient.syncApplication(
          applicationName,
          Object.keys(options).length > 0 ? options : undefined
        );
      }
    );
  • The addJsonOutputTool private method that wraps tool registration with JSON output formatting and error handling.
    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) }]
          };
        }
      });
    }
  • The ApplicationNamespaceSchema Zod schema used for the optional applicationNamespace parameter of sync_application.
    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.`
      );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description does not disclose any behavioral traits (e.g., whether the operation is destructive, permission requirements, side effects). The description is far too brief to compensate for the lack of annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short (two sentences) with no wasted words, but it is too brief given the complexity of the tool (6 parameters, sync operation). It could be more informative without sacrificing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a moderate parameter count, the description is incomplete. It fails to explain what 'sync' entails, return behavior, errors, or any important context needed for correct use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is high (83%), so the baseline is 3. The description adds some context for 'applicationNamespace' (permission errors), but adds no meaning beyond the schema for other parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'syncs' and the resource 'application'. It communicates the core function, but does not differentiate from sibling tools like 'update_application' or 'create_application', which could cause confusion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The only usage guidance is about specifying 'applicationNamespace' for non-default namespaces to avoid errors. No guidance on when to use this tool versus alternatives, nor prerequisites or context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/argoproj-labs/argocd-mcp'

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