get_resource_actions
Retrieve available actions for a Kubernetes resource managed by an ArgoCD application.
Instructions
get_resource_actions returns actions for a resource that is managed by an application
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| applicationName | Yes | ||
| applicationNamespace | Yes | 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. | |
| resourceRef | Yes |
Implementation Reference
- src/server/server.ts:220-234 (handler)Registration of the get_resource_actions MCP tool via addJsonOutputTool with its handler callback that delegates to argocdClient.getResourceActions
this.addJsonOutputTool( 'get_resource_actions', 'get_resource_actions returns actions for a resource that is managed by an application', { applicationName: z.string(), applicationNamespace: ApplicationNamespaceSchema, resourceRef: ResourceRefSchema }, async ({ applicationName, applicationNamespace, resourceRef }) => await this.argocdClient.getResourceActions( applicationName, applicationNamespace, resourceRef as V1alpha1ResourceResult ) ); - src/argocd/client.ts:298-315 (handler)Actual implementation: calls ArgoCD API GET /api/v1/applications/{name}/resource/actions with query parameters and returns the response body containing actions
public async getResourceActions( applicationName: string, applicationNamespace: string, resourceRef: V1alpha1ResourceResult ) { const { body } = await this.client.get<{ actions: V1alpha1ResourceAction[] }>( `/api/v1/applications/${applicationName}/resource/actions`, { appNamespace: applicationNamespace, namespace: resourceRef.namespace, resourceName: resourceRef.name, group: resourceRef.group, kind: resourceRef.kind, version: resourceRef.version } ); return body; } - src/shared/models/schema.ts:13-20 (schema)Zod schema for the resourceRef input parameter (uid, kind, namespace, name, version, group)
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:3-11 (schema)Zod schema for the applicationNamespace input parameter
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.` ); - src/server/server.ts:345-365 (registration)Helper method addJsonOutputTool that wraps McpServer.tool() with JSON stringification of results 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) }] }; } }); }