Skip to content

Commit cff4f5f

Browse files
authored
Added includeWorkItemRefs param to the repo_get_pull_request_by_id tool (#351)
Added the `includeWorkItemRefs` param to include work items references linked to the PR. how it looks in output json: ```json "workItemRefs": [ { "id": "1", "url": "https://dev.azure.com/localconst-org/_apis/wit/workItems/1" }, { "id": "2", "url": "https://dev.azure.com/localconst-org/_apis/wit/workItems/2" } ], ``` ## GitHub issue number #274 ## **Associated Risks** Not actually a risk, but a note that to get full info about WIs agent will need to use another tools. ## ✅ **PR Checklist** - [x] **I have read the [contribution guidelines](https://github.com/microsoft/azure-devops-mcp/blob/main/CONTRIBUTING.md)** - [x] **I have read the [code of conduct guidelines](https://github.com/microsoft/azure-devops-mcp/blob/main/CODE_OF_CONDUCT.md)** - [x] Title of the pull request is clear and informative. - [x] 👌 Code hygiene - [x] 🔭 Telemetry added, updated, or N/A - [x] 📄 Documentation added, updated, or N/A - [x] 🛡️ Automated tests added, or N/A ## 🧪 **How did you test it?** Tested on: GH Copilot in VSCode with gpt-4.1 1. Built server with changes 2. Configured it for VSCode 3. Created several test work items 4. Created test PR 5. Linked WIs to PR 6. Made call: "get all PR's attached work items: <PR url>" 7. Observed tool call. Verified params included new `includeWorkItemRefs` 8. Observed tool call result. Verified work items are included in output json 9. Verified GH copilot understand how to use WI refs in future calls, specifically in `wit_get_work_item`
1 parent 382f4d0 commit cff4f5f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tools/repos.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,11 +535,12 @@ function configureRepoTools(server: McpServer, tokenProvider: () => Promise<Acce
535535
{
536536
repositoryId: z.string().describe("The ID of the repository where the pull request is located."),
537537
pullRequestId: z.number().describe("The ID of the pull request to retrieve."),
538+
includeWorkItemRefs: z.boolean().optional().default(false).describe("Whether to reference work items associated with the pull request."),
538539
},
539-
async ({ repositoryId, pullRequestId }) => {
540+
async ({ repositoryId, pullRequestId, includeWorkItemRefs }) => {
540541
const connection = await connectionProvider();
541542
const gitApi = await connection.getGitApi();
542-
const pullRequest = await gitApi.getPullRequest(repositoryId, pullRequestId);
543+
const pullRequest = await gitApi.getPullRequest(repositoryId, pullRequestId, undefined, undefined, undefined, undefined, undefined, includeWorkItemRefs);
543544
return {
544545
content: [{ type: "text", text: JSON.stringify(pullRequest, null, 2) }],
545546
};

0 commit comments

Comments
 (0)