Description
The repo_search_commits tool's searchText parameter never returns expected results because it is not passed to the Azure DevOps API as searchCriteria.messageContains. Instead, it only performs client-side filtering on the already-limited result set (default top: 10).
Steps to Reproduce
- Have a repository with a commit message containing "BSC" (e.g., "Merged PR 22210: BSC: Provide the role code dropdown...")
- Call
repo_search_commits with searchText: "BSC", fromDate: "2026-04-01", top: 10
- Returns
[]
- Calling the ADO REST API directly with
searchCriteria.messageContains=BSC returns the expected commits
Root Cause
In dist/tools/repositories.js (~line 1481), the searchCriteria object is built without including messageContains:
js
const searchCriteria = {
fromCommitId: fromCommit,
toCommitId: toCommit,
includeLinks: includeLinks,
includeWorkItems: includeWorkItems,
};
// searchText is NOT added here
Then at line 1515, client-side filtering is applied to the already-fetched (and limited) results:
js
if (searchText && filteredCommits) {
filteredCommits = filteredCommits.filter((commit) =>
commit.comment?.toLowerCase().includes(searchText.toLowerCase()));
}
Since the API call respects the top parameter, only the N most recent commits are returned, and the client-side filter searches within those N commits only.
Expected Fix
Add searchText to the API search criteria:
js
if (searchText) {
searchCriteria.messageContains = searchText;
}
Environment
- Package version: 2.7.0
- OS: Windows 11
- Node.js: v20.5.1
Description
The
repo_search_commitstool'ssearchTextparameter never returns expected results because it is not passed to the Azure DevOps API assearchCriteria.messageContains. Instead, it only performs client-side filtering on the already-limited result set (defaulttop: 10).Steps to Reproduce
repo_search_commitswithsearchText: "BSC",fromDate: "2026-04-01",top: 10[]searchCriteria.messageContains=BSCreturns the expected commitsRoot Cause
In
dist/tools/repositories.js(~line 1481), thesearchCriteriaobject is built without includingmessageContains:js
const searchCriteria = {
fromCommitId: fromCommit,
toCommitId: toCommit,
includeLinks: includeLinks,
includeWorkItems: includeWorkItems,
};
// searchText is NOT added here
Then at line 1515, client-side filtering is applied to the already-fetched (and limited) results:
js
if (searchText && filteredCommits) {
filteredCommits = filteredCommits.filter((commit) =>
commit.comment?.toLowerCase().includes(searchText.toLowerCase()));
}
Since the API call respects the
topparameter, only the N most recent commits are returned, and the client-side filter searches within those N commits only.Expected Fix
Add
searchTextto the API search criteria:js
if (searchText) {
searchCriteria.messageContains = searchText;
}
Environment