diff --git a/packages/mcp-provider-devops/src/getCommitStatus.ts b/packages/mcp-provider-devops/src/getStatus.ts similarity index 77% rename from packages/mcp-provider-devops/src/getCommitStatus.ts rename to packages/mcp-provider-devops/src/getStatus.ts index 85466754..06278579 100644 --- a/packages/mcp-provider-devops/src/getCommitStatus.ts +++ b/packages/mcp-provider-devops/src/getStatus.ts @@ -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 { +export async function fetchStatus(username: string, requestId: string): Promise { if (!username || username.trim().length === 0) { throw new Error('Username is required. Please provide the DevOps Center org username.'); } @@ -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}'`; @@ -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}` }; } @@ -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}`); } } \ No newline at end of file diff --git a/packages/mcp-provider-devops/src/provider.ts b/packages/mcp-provider-devops/src/provider.ts index eff75463..ea96efee 100644 --- a/packages/mcp-provider-devops/src/provider.ts +++ b/packages/mcp-provider-devops/src/provider.ts @@ -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"; @@ -29,7 +29,7 @@ export class DevOpsMcpProvider extends McpProvider { new SfDevopsCheckoutWorkItem(telemetryService), new SfDevopsCommitWorkItem(telemetryService), - new CheckCommitStatus(telemetryService), + new CheckStatus(telemetryService), new CreatePullRequest(telemetryService), ]); } diff --git a/packages/mcp-provider-devops/src/tools/checkCommitStatus.ts b/packages/mcp-provider-devops/src/tools/checkStatus.ts similarity index 64% rename from packages/mcp-provider-devops/src/tools/checkCommitStatus.ts rename to packages/mcp-provider-devops/src/tools/checkStatus.ts index 8b939b95..a4648bb6 100644 --- a/packages/mcp-provider-devops/src/tools/checkCommitStatus.ts +++ b/packages/mcp-provider-devops/src/tools/checkStatus.ts @@ -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; type InputArgsShape = typeof inputSchema.shape; type OutputArgsShape = z.ZodRawShape; -export class CheckCommitStatus extends McpTool { +export class CheckStatus extends McpTool { private readonly telemetryService: TelemetryService; constructor(telemetryService: TelemetryService) { @@ -28,18 +28,23 @@ export class CheckCommitStatus extends McpTool } public getName(): string { - return "check_devops_center_commit_status"; + return "check_devops_center_status"; } public getConfig(): McpToolConfig { 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 @@ -55,7 +60,7 @@ export class CheckCommitStatus extends McpTool public async exec(input: InputArgs): Promise { try { - const status = await fetchCommitStatus(input.username, input.requestId); + const status = await fetchStatus(input.username, input.requestId); return { content: [{ type: "text", @@ -66,7 +71,7 @@ export class CheckCommitStatus extends McpTool return { content: [{ type: "text", - text: `Failed to check commit status: ${error.message}` + text: `Failed to check status: ${error.message}` }], isError: true }; diff --git a/packages/mcp-provider-devops/src/tools/createPullRequest.ts b/packages/mcp-provider-devops/src/tools/createPullRequest.ts index 3768c1b9..25b6f9e2 100644 --- a/packages/mcp-provider-devops/src/tools/createPullRequest.ts +++ b/packages/mcp-provider-devops/src/tools/createPullRequest.ts @@ -50,8 +50,8 @@ export class CreatePullRequest extends McpTool 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 diff --git a/packages/mcp-provider-devops/src/tools/sfDevopsCommitWorkItem.ts b/packages/mcp-provider-devops/src/tools/sfDevopsCommitWorkItem.ts index df8a1e7d..561d86cb 100644 --- a/packages/mcp-provider-devops/src/tools/sfDevopsCommitWorkItem.ts +++ b/packages/mcp-provider-devops/src/tools/sfDevopsCommitWorkItem.ts @@ -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. diff --git a/packages/mcp-provider-devops/src/tools/sfDevopsPromoteWorkItem.ts b/packages/mcp-provider-devops/src/tools/sfDevopsPromoteWorkItem.ts index 77faf13a..290ebbd1 100644 --- a/packages/mcp-provider-devops/src/tools/sfDevopsPromoteWorkItem.ts +++ b/packages/mcp-provider-devops/src/tools/sfDevopsPromoteWorkItem.ts @@ -64,9 +64,9 @@ export class SfDevopsPromoteWorkItem extends McpTool