run_resource_action
Execute specific actions on ArgoCD-managed resources by specifying the application name, namespace, and resource details.
Instructions
run_resource_action runs an action on a resource
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ||
| applicationName | Yes | ||
| applicationNamespace | Yes | The namespace of the application. Note that this may differ from the namespace of individual resources. Make sure to verify the application namespace in the Application resource — it is often argocd, but not always. | |
| resourceRef | Yes |
Implementation Reference
- src/argocd/client.ts:299-318 (handler)The core handler function that executes the tool logic by making a POST request to the ArgoCD API to run the specified action on the resource.public async runResourceAction( applicationName: string, applicationNamespace: string, resourceRef: V1alpha1ResourceResult, action: string ) { const { body } = await this.client.post<string, V1alpha1Application>( `/api/v1/applications/${applicationName}/resource/actions`, { appNamespace: applicationNamespace, namespace: resourceRef.namespace, resourceName: resourceRef.name, group: resourceRef.group, kind: resourceRef.kind, version: resourceRef.version }, action ); return body; }
- src/server/server.ts:301-317 (registration)Registers the MCP tool 'run_resource_action' with its input schema and handler that delegates to ArgoCDClient.runResourceAction.this.addJsonOutputTool( 'run_resource_action', 'run_resource_action runs an action on a resource', { applicationName: z.string(), applicationNamespace: ApplicationNamespaceSchema, resourceRef: ResourceRefSchema, action: z.string() }, async ({ applicationName, applicationNamespace, resourceRef, action }) => await this.argocdClient.runResourceAction( applicationName, applicationNamespace, resourceRef as V1alpha1ResourceResult, action ) );
- src/shared/models/schema.ts:13-20 (schema)Zod schema defining the ResourceRef input parameter used in the run_resource_action tool.export const ResourceRefSchema = z.object({ uid: z.string(), kind: z.string(), namespace: z.string(), name: z.string(), version: z.string(), group: z.string() });
- src/shared/models/schema.ts:2-11 (schema)Zod schema defining the ApplicationNamespace input parameter used in the run_resource_action tool.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.` );