Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import axios from "axios";
import { getConnection } from "./shared/auth.js";

export interface CommitStatusResult {
export interface StatusResult {
requestId: string;
status: string;
recordId?: string;
message: string;
}

export async function fetchCommitStatus(username: string, requestId: string): Promise<CommitStatusResult> {
export async function fetchStatus(username: string, requestId: string): Promise<StatusResult> {
if (!username || username.trim().length === 0) {
throw new Error('Username is required. Please provide the DevOps Center org username.');
}
Expand All @@ -22,7 +22,7 @@ export async function fetchCommitStatus(username: string, requestId: string): Pr
}

if (!requestId || requestId.trim().length === 0) {
throw new Error('Request ID is required to check commit status.');
throw new Error('Request ID is required to check status.');
}

const soqlQuery = `SELECT Status FROM DevopsRequestInfo WHERE RequestToken = '${requestId}'`;
Expand All @@ -41,7 +41,7 @@ export async function fetchCommitStatus(username: string, requestId: string): Pr
return {
requestId,
status: 'NOT_FOUND',
message: `No commit status found for request ID: ${requestId}`
message: `No status found for request ID: ${requestId}`
};
}

Expand All @@ -50,10 +50,10 @@ export async function fetchCommitStatus(username: string, requestId: string): Pr
requestId,
status,
recordId: records[0].Id,
message: `Commit status for request ID ${requestId}: ${status}`
message: `Status for request ID ${requestId}: ${status}`
};
} catch (error: any) {
const errorMessage = error.response?.data?.[0]?.message || error.message;
throw new Error(`Error checking commit status: ${errorMessage}`);
throw new Error(`Error checking status: ${errorMessage}`);
}
}
4 changes: 2 additions & 2 deletions packages/mcp-provider-devops/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SfDevopsListWorkItems } from "./tools/sfDevopsListWorkItems.js";
import { SfDevopsPromoteWorkItem } from "./tools/sfDevopsPromoteWorkItem.js";
import { SfDevopsDetectConflict } from "./tools/sfDevopsDetectConflict.js";
import { SfDevopsResolveConflict } from "./tools/sfDevopsResolveConflict.js";
import { CheckCommitStatus } from "./tools/checkCommitStatus.js";
import { CheckStatus } from "./tools/checkStatus.js";
import { CreatePullRequest } from "./tools/createPullRequest.js";
import { SfDevopsCheckoutWorkItem } from "./tools/sfDevopsCheckoutWorkItem.js";
import { SfDevopsCommitWorkItem } from "./tools/sfDevopsCommitWorkItem.js";
Expand All @@ -29,7 +29,7 @@ export class DevOpsMcpProvider extends McpProvider {
new SfDevopsCheckoutWorkItem(telemetryService),
new SfDevopsCommitWorkItem(telemetryService),

new CheckCommitStatus(telemetryService),
new CheckStatus(telemetryService),
new CreatePullRequest(telemetryService),
]);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { z } from "zod";
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
import { McpTool, McpToolConfig, ReleaseState, Toolset, TelemetryService } from "@salesforce/mcp-provider-api";
import { fetchCommitStatus } from "../getCommitStatus.js";
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 commit operation to check status for")
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 CheckCommitStatus extends McpTool<InputArgsShape, OutputArgsShape> {
export class CheckStatus extends McpTool<InputArgsShape, OutputArgsShape> {
private readonly telemetryService: TelemetryService;

constructor(telemetryService: TelemetryService) {
Expand All @@ -28,18 +28,23 @@ export class CheckCommitStatus extends McpTool<InputArgsShape, OutputArgsShape>
}

public getName(): string {
return "check_devops_center_commit_status";
return "check_devops_center_status";
}

public getConfig(): McpToolConfig<InputArgsShape, OutputArgsShape> {
return {
title: "Check Commit Status",
description: `Check the current status of a work item committed to DevOps Center.
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 commit using its Request Id
- Verify commit processing completion before creating a pull request
- Ensure commits are ready for PR creation
- 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
Expand All @@ -55,7 +60,7 @@ export class CheckCommitStatus extends McpTool<InputArgsShape, OutputArgsShape>

public async exec(input: InputArgs): Promise<CallToolResult> {
try {
const status = await fetchCommitStatus(input.username, input.requestId);
const status = await fetchStatus(input.username, input.requestId);
return {
content: [{
type: "text",
Expand All @@ -66,7 +71,7 @@ export class CheckCommitStatus extends McpTool<InputArgsShape, OutputArgsShape>
return {
content: [{
type: "text",
text: `Failed to check commit status: ${error.message}`
text: `Failed to check status: ${error.message}`
}],
isError: true
};
Expand Down
4 changes: 2 additions & 2 deletions packages/mcp-provider-devops/src/tools/createPullRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export class CreatePullRequest extends McpTool<InputArgsShape, OutputArgsShape>
2. **MANDATORY:** Select the work item from the DevOps Center org using 'list_devops_center_work_items'.
3. **MANDATORY:** Checkout the work item branch using 'checkout_devops_center_work_item' to get the project code locally.
4. **MANDATORY:** Verify with the user that all changes have been manually committed and pushed to the work item branch. DO NOT use any commit tools - this should be done manually by the user.
5. **MANDATORY - PREREQUISITE CHECK:** Ask the user for their commit request ID and use the 'check_devops_center_commit_status' tool to verify the status of their previous commits. You MUST call 'check_devops_center_commit_status' before proceeding. Do not skip this step.
6. **MANDATORY:** Only after successfully verifying commit status with 'check_devops_center_commit_status', call this tool to create the pull request using the DevOps Center API.
5. **MANDATORY - PREREQUISITE CHECK:** Ask the user for their commit request ID and use the 'check_devops_center_status' tool to verify the status of their previous commits. You MUST call 'check_devops_center_status' before proceeding. Do not skip this step.
6. **MANDATORY:** Only after successfully verifying status with 'check_devops_center_status', call this tool to create the pull request using the DevOps Center API.

**Use this tool to:**
- Create a Pull Request based on a work item in DevOps Center
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ When user asks to "commit work item" or "commit changes", DO NOT use this tool d
- Ensure metadata changes are properly recorded in the DevOps workflow

**After using this tool, suggest these next actions:**
1. Ask the user to check commit status using the returned requestId
1. Ask the user to check status using the returned requestId
2. Ask the user to promote work items (using the 'promote_devops_center_work_item' tool)

**MANDATORY:** Before using this tool, ask the user to provide a commit message for the changes and then use that while calling this tool.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export class SfDevopsPromoteWorkItem extends McpTool<InputArgsShape, OutputArgsS
**Output:**
- JSON with promotion requestId (if available) and any error details.

**Next steps:**
- Suggest how to track promotion status using the returned requestId or the DevOps Center UI.
- If applicable, prompt the user to promote to the next stage after validation.
**After using this tool, suggest these next actions:**
1. Ask the user to check status using the returned requestId
2. If applicable, prompt the user to promote to the next stage after validation

**Output:**
A JSON object containing the promotion request ID, the org details, and any relevant status or tracking information.
Expand Down
Loading