Skip to main content
Glama
argoproj-labs

argocd-mcp

Official

sync_application

Sync ArgoCD applications to deploy configurations from source repositories. Specify namespace for non-default applications, use dry runs for testing, and prune removed resources.

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

  • Core handler function that executes the sync logic by constructing the sync request and making the API call to ArgoCD.
    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;
    }
  • Registers the MCP tool 'sync_application' with description, input schema, and execution callback that delegates to ArgoCDClient.
    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
        );
      }
    );
  • Zod schema defining the input parameters for the sync_application tool.
    {
      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"])'
        )
    },
  • Shared Zod schema for application namespace used in sync_application input.
    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?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions avoiding permission errors with namespace specification, which hints at authentication needs, but fails to describe what 'sync' actually does behaviorally: whether it creates/destroys resources, applies configuration changes, reconciles state, or has side effects. The dryRun and prune parameters in the schema suggest destructive potential, but the description doesn't warn about this.

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 brief (two sentences) but inefficiently structured. The first sentence is a tautology that adds no value. The second sentence provides useful but limited guidance about namespace. It's front-loaded with waste rather than essential information.

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?

For a 6-parameter mutation tool with no annotations and no output schema, the description is inadequate. It doesn't explain what 'sync' means operationally, what resources are affected, success/failure behavior, or return values. The schema covers parameter details well, but the description fails to provide necessary context for safe and effective 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 83% (high), so the baseline is 3 even without parameter information in the description. The description adds minimal value by emphasizing applicationNamespace importance for permission errors, but doesn't explain other parameters like dryRun, prune, revision, or syncOptions beyond what the schema already documents.

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

Purpose2/5

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

The description states 'sync_application syncs application' which is a tautology that merely restates the tool name. It adds minimal value by mentioning namespace specification to avoid permission errors, but fails to explain what 'sync' means in this context or what resources are being synchronized. The purpose remains vague compared to sibling tools like create_application or update_application.

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 description provides no guidance on when to use this tool versus alternatives like update_application or run_resource_action. It mentions namespace specification to avoid permission errors, which is a technical prerequisite rather than usage context. There's no explicit when/when-not guidance or comparison with sibling tools.

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