Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/argocd/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,21 @@ export class ArgoCDClient {
return body;
}

public async getApplicationManagedResources(applicationName: string) {
public async getApplicationManagedResources(
applicationName: string,
filters?: {
namespace?: string;
name?: string;
version?: string;
group?: string;
kind?: string;
appNamespace?: string;
project?: string;
}
) {
const { body } = await this.client.get<{ items: V1alpha1ResourceDiff[] }>(
`/api/v1/applications/${applicationName}/managed-resources`
`/api/v1/applications/${applicationName}/managed-resources`,
filters
);
return body;
}
Expand Down
35 changes: 31 additions & 4 deletions src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,37 @@ export class Server extends McpServer {
);
this.addJsonOutputTool(
'get_application_managed_resources',
'get_application_managed_resources returns managed resources for application by application name',
{ applicationName: z.string() },
async ({ applicationName }) =>
await this.argocdClient.getApplicationManagedResources(applicationName)
'get_application_managed_resources returns managed resources for application by application name with optional filtering. Use filters to avoid token limits with large applications. Examples: kind="ConfigMap" for config maps only, namespace="production" for specific namespace, or combine multiple filters.',
{
applicationName: z.string(),
kind: z
.string()
.optional()
.describe(
'Filter by Kubernetes resource kind (e.g., "ConfigMap", "Secret", "Deployment")'
),
namespace: z.string().optional().describe('Filter by Kubernetes namespace'),
name: z.string().optional().describe('Filter by resource name'),
version: z.string().optional().describe('Filter by resource API version'),
group: z.string().optional().describe('Filter by API group'),
appNamespace: z.string().optional().describe('Filter by Argo CD application namespace'),
project: z.string().optional().describe('Filter by Argo CD project')
},
async ({ applicationName, kind, namespace, name, version, group, appNamespace, project }) => {
const filters = {
...(kind && { kind }),
...(namespace && { namespace }),
...(name && { name }),
...(version && { version }),
...(group && { group }),
...(appNamespace && { appNamespace }),
...(project && { project })
};
return await this.argocdClient.getApplicationManagedResources(
applicationName,
Object.keys(filters).length > 0 ? filters : undefined
);
}
);
this.addJsonOutputTool(
'get_application_workload_logs',
Expand Down