feat(errors): Make errors more informative (#7133)

This commit is contained in:
Lee James
2025-08-26 19:22:05 -04:00
committed by GitHub
parent 6fb01ddcc4
commit 3e74ff71b7
8 changed files with 133 additions and 11 deletions

View File

@@ -174,6 +174,24 @@ describe('ToolRegistry', () => {
});
});
describe('getAllToolNames', () => {
it('should return all registered tool names', () => {
// Register tools with displayNames in non-alphabetical order
const toolC = new MockTool('c-tool', 'Tool C');
const toolA = new MockTool('a-tool', 'Tool A');
const toolB = new MockTool('b-tool', 'Tool B');
toolRegistry.registerTool(toolC);
toolRegistry.registerTool(toolA);
toolRegistry.registerTool(toolB);
const toolNames = toolRegistry.getAllToolNames();
// Assert that the returned array contains all tool names
expect(toolNames).toEqual(['c-tool', 'a-tool', 'b-tool']);
});
});
describe('getToolsByServer', () => {
it('should return an empty array if no tools match the server name', () => {
toolRegistry.registerTool(new MockTool());

View File

@@ -437,6 +437,13 @@ export class ToolRegistry {
return declarations;
}
/**
* Returns an array of all registered and discovered tool names.
*/
getAllToolNames(): string[] {
return Array.from(this.tools.keys());
}
/**
* Returns an array of all registered and discovered tool instances.
*/