-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathcheckStatus.ts
More file actions
80 lines (68 loc) · 2.52 KB
/
checkStatus.ts
File metadata and controls
80 lines (68 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { z } from "zod";
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
import { McpTool, McpToolConfig, ReleaseState, Toolset, TelemetryService } from "@salesforce/mcp-provider-api";
import { fetchStatus } from "../getStatus.js";
const inputSchema = z.object({
username: z.string().describe("Username of the DevOps Center org"),
requestId: z.string().describe("Request ID from the DevOps Center operation to check status for")
});
type InputArgs = z.infer<typeof inputSchema>;
type InputArgsShape = typeof inputSchema.shape;
type OutputArgsShape = z.ZodRawShape;
export class CheckStatus extends McpTool<InputArgsShape, OutputArgsShape> {
private readonly telemetryService: TelemetryService;
constructor(telemetryService: TelemetryService) {
super();
this.telemetryService = telemetryService;
}
public getReleaseState(): ReleaseState {
return ReleaseState.NON_GA;
}
public getToolsets(): Toolset[] {
return [Toolset.DEVOPS];
}
public getName(): string {
return "check_devops_center_status";
}
public getConfig(): McpToolConfig<InputArgsShape, OutputArgsShape> {
return {
title: "Check Status",
description: `Check the current status of a DevOps Center operation.
**Use when user asks (examples):**
- "Check the status of this request id"
- "Check the status of the commit with request id"
- "Check the status of the promote with the request id"
**Use this tool to:**
- Check the status of a specific operation using its Request Id
- Verify operation processing completion (commits, promotions, etc.)
- Track the progress of DevOps Center operations
**Input Parameters:**
- username: The username of the DevOps Center org to authenticate with
- requestId: The specific request Id to check status for (REQUIRED)
**Output:**
- Status field value for the specified request Id
- Request Id and associated status information`,
inputSchema: inputSchema.shape,
outputSchema: undefined,
};
}
public async exec(input: InputArgs): Promise<CallToolResult> {
try {
const status = await fetchStatus(input.username, input.requestId);
return {
content: [{
type: "text",
text: JSON.stringify(status, null, 2)
}]
};
} catch (error: any) {
return {
content: [{
type: "text",
text: `Failed to check status: ${error.message}`
}],
isError: true
};
}
}
}