Skip to content

Commit 8d7fb4a

Browse files
krid-583Krishna Prasath Ddanhellem
authored
Allowing search_code tool's project parameter to accept single string as input (#1126)
The change makes the project parameter accept either a single string or an array of strings. When a single string is provided, it's automatically transformed into a one-element array. ## GitHub issue number 1038 ## **Associated Risks** None ## ✅ **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 - [N/A] 🔭 Telemetry added, updated, or N/A - [N/A] 📄 Documentation added, updated, or N/A - [X] 🛡️ Automated tests added, or N/A ## 🧪 **How did you test it?** Added unit tests for testing Performed Manual Testing on the modified tools: Ex: <img width="1757" height="1198" alt="image" src="https://github.com/user-attachments/assets/665ed735-b3dc-4864-a05c-ade214ad6df9" /> --------- Co-authored-by: Krishna Prasath D <krid@microsoft.com> Co-authored-by: Dan Hellem <dahellem@microsoft.com>
1 parent 7e62f08 commit 8d7fb4a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/tools/search.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ function configureSearchTools(server: McpServer, tokenProvider: () => Promise<st
2222
"Search Azure DevOps Repositories for a given search text",
2323
{
2424
searchText: z.string().describe("Keywords to search for in code repositories"),
25-
project: z.array(z.string()).optional().describe("Filter by projects"),
25+
project: z
26+
.union([z.string().transform((value) => [value]), z.array(z.string())])
27+
.optional()
28+
.describe("Filter by projects"),
2629
repository: z.array(z.string()).optional().describe("Filter by repositories"),
2730
path: z.array(z.string()).optional().describe("Filter by paths"),
2831
branch: z.array(z.string()).optional().describe("Filter by branches"),

0 commit comments

Comments
 (0)