get_application
Get an ArgoCD application by name. Specify a namespace to retrieve applications from non-default namespaces.
Instructions
get_application returns application by application name. Optionally specify the application namespace to get applications from non-default namespaces.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| applicationName | Yes | ||
| applicationNamespace | No | 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. |
Implementation Reference
- src/server/server.ts:81-90 (registration)Registration of the 'get_application' tool on the MCP server with input schema and callback.
this.addJsonOutputTool( 'get_application', 'get_application returns application by application name. Optionally specify the application namespace to get applications from non-default namespaces.', { applicationName: z.string(), applicationNamespace: ApplicationNamespaceSchema.optional() }, async ({ applicationName, applicationNamespace }) => await this.argocdClient.getApplication(applicationName, applicationNamespace) ); - src/argocd/client.ts:82-89 (handler)Handler that executes the tool logic: makes an HTTP GET request to the ArgoCD API to fetch an application by name, optionally filtered by namespace.
public async getApplication(applicationName: string, appNamespace?: string) { const queryParams = appNamespace ? { appNamespace } : undefined; const { body } = await this.client.get<V1alpha1Application>( `/api/v1/applications/${applicationName}`, queryParams ); return body; } - src/shared/models/schema.ts:3-11 (schema)Zod schema for the optional 'applicationNamespace' parameter used by the 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.` ); - src/server/server.ts:345-365 (helper)Helper wrapper that registers the tool with the MCP server and JSON-serializes the result.
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) }] }; } }); }