feat(tool): sort tool list alphabetically for deterministic output (#3095)

Co-authored-by: Pascal Birchler <pascalb@google.com>
This commit is contained in:
Sambhav Khanna
2025-07-15 14:35:35 -04:00
committed by GitHub
parent d3ee9de3c3
commit 40c4070846
2 changed files with 69 additions and 12 deletions

View File

@@ -308,7 +308,9 @@ export class ToolRegistry {
* Returns an array of all registered and discovered tool instances.
*/
getAllTools(): Tool[] {
return Array.from(this.tools.values());
return Array.from(this.tools.values()).sort((a, b) =>
a.displayName.localeCompare(b.displayName),
);
}
/**
@@ -321,7 +323,7 @@ export class ToolRegistry {
serverTools.push(tool);
}
}
return serverTools;
return serverTools.sort((a, b) => a.name.localeCompare(b.name));
}
/**