get_resources
Retrieve Kubernetes manifests for specific resources or all resources managed by an ArgoCD application to inspect deployment configurations.
Instructions
get_resources return manifests for resources specified by resourceRefs. If resourceRefs is empty or not provided, fetches all resources managed by the application.
Input Schema
TableJSON 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. | |
| resourceRefs | No |
Implementation Reference
- src/server/server.ts:175-194 (handler)The MCP tool handler function for 'get_resources'. If no resourceRefs provided, fetches the application resource tree and extracts refs, then fetches manifests in parallel using ArgoCDClient.getResource.async ({ applicationName, applicationNamespace, resourceRefs }) => { let refs = resourceRefs || []; if (refs.length === 0) { const tree = await this.argocdClient.getApplicationResourceTree(applicationName); refs = tree.nodes?.map((node) => ({ uid: node.uid!, version: node.version!, group: node.group!, kind: node.kind!, name: node.name!, namespace: node.namespace! })) || []; } return Promise.all( refs.map((ref) => this.argocdClient.getResource(applicationName, applicationNamespace, ref) ) ); }
- src/shared/models/schema.ts:13-20 (schema)Zod schema defining the ResourceRef object used in the get_resources tool input for specifying resources.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 parameter used in get_resources tool 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.` );
- src/server/server.ts:167-195 (registration)Registration of the 'get_resources' MCP tool, specifying name, description, input schema, and handler callback.this.addJsonOutputTool( 'get_resources', 'get_resources return manifests for resources specified by resourceRefs. If resourceRefs is empty or not provided, fetches all resources managed by the application.', { applicationName: z.string(), applicationNamespace: ApplicationNamespaceSchema, resourceRefs: ResourceRefSchema.array().optional() }, async ({ applicationName, applicationNamespace, resourceRefs }) => { let refs = resourceRefs || []; if (refs.length === 0) { const tree = await this.argocdClient.getApplicationResourceTree(applicationName); refs = tree.nodes?.map((node) => ({ uid: node.uid!, version: node.version!, group: node.group!, kind: node.kind!, name: node.name!, namespace: node.namespace! })) || []; } return Promise.all( refs.map((ref) => this.argocdClient.getResource(applicationName, applicationNamespace, ref) ) ); } );
- src/argocd/client.ts:242-259 (helper)ArgoCDClient helper method to fetch the manifest of a specific resource via the ArgoCD API, used by the get_resources tool handler.public async getResource( applicationName: string, applicationNamespace: string, resourceRef: V1alpha1ResourceResult ) { const { body } = await this.client.get<V1alpha1ApplicationResourceResult>( `/api/v1/applications/${applicationName}/resource`, { appNamespace: applicationNamespace, namespace: resourceRef.namespace, resourceName: resourceRef.name, group: resourceRef.group, kind: resourceRef.kind, version: resourceRef.version } ); return body.manifest; }