Skip to content

Commit a03724e

Browse files
authored
feat: support retrieving logs from pods with multiple containers (#64)
Signed-off-by: Alexander Matyushentsev <[email protected]>
1 parent a1971c7 commit a03724e

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

images/akuity.png

-16.5 KB
Binary file not shown.

src/argocd/client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ export class ArgoCDClient {
145145
public async getWorkloadLogs(
146146
applicationName: string,
147147
applicationNamespace: string,
148-
resourceRef: V1alpha1ResourceResult
148+
resourceRef: V1alpha1ResourceResult,
149+
container: string
149150
) {
150151
const logs: ApplicationLogEntry[] = [];
151152
await this.client.getStream<ApplicationLogEntry>(
@@ -158,7 +159,8 @@ export class ArgoCDClient {
158159
kind: resourceRef.kind,
159160
version: resourceRef.version,
160161
follow: false,
161-
tailLines: 100
162+
tailLines: 100,
163+
container: container
162164
},
163165
(chunk) => logs.push(chunk)
164166
);

src/server/server.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,19 @@ export class Server extends McpServer {
114114
);
115115
this.addJsonOutputTool(
116116
'get_application_workload_logs',
117-
'get_application_workload_logs returns logs for application workload (Deployment, StatefulSet, Pod, etc.) by application name and resource ref',
117+
'get_application_workload_logs returns logs for application workload (Deployment, StatefulSet, Pod, etc.) by application name and resource ref and optionally container name',
118118
{
119119
applicationName: z.string(),
120120
applicationNamespace: ApplicationNamespaceSchema,
121-
resourceRef: ResourceRefSchema
121+
resourceRef: ResourceRefSchema,
122+
container: z.string()
122123
},
123-
async ({ applicationName, applicationNamespace, resourceRef }) =>
124+
async ({ applicationName, applicationNamespace, resourceRef, container }) =>
124125
await this.argocdClient.getWorkloadLogs(
125126
applicationName,
126127
applicationNamespace,
127-
resourceRef as V1alpha1ResourceResult
128+
resourceRef as V1alpha1ResourceResult,
129+
container
128130
)
129131
);
130132
this.addJsonOutputTool(

0 commit comments

Comments
 (0)