sync_application
Syncs application configurations specified by 'applicationName' in ArgoCD MCP server to ensure consistent and accurate deployment states.
Instructions
sync_application syncs application
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| applicationName | Yes |
Implementation Reference
- src/server/server.ts:287-299 (handler)Tool handler for 'sync_application', constructs sync options and delegates to ArgoCD client.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 ); }
- src/server/server.ts:263-286 (schema)Zod input schema defining 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"])' ) },
- src/server/server.ts:260-300 (registration)Registers the 'sync_application' tool using addJsonOutputTool helper with name, description, schema, and handler.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 ); } );
- src/argocd/client.ts:122-156 (helper)Core implementation of application sync via ArgoCD API POST to /sync endpoint.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; }