Skip to content

Commit 122f062

Browse files
chore: move isToolCategoryAvailable to Server
1 parent 2add1f8 commit 122f062

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/server.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,8 @@ export class Server {
174174
this.mcpServer.sendResourceListChanged();
175175
}
176176

177-
public areLocalAtlasToolsAvailable(): boolean {
178-
// TODO: remove hacky casts once we merge the local dev tools
179-
const atlasLocalCategory = "atlas-local" as unknown as ToolCategory;
180-
return !!this.tools.filter((tool) => tool.category === atlasLocalCategory).length;
177+
public isToolCategoryAvailable(name: ToolCategory): boolean {
178+
return !!this.tools.filter((t) => t.category === name).length;
181179
}
182180

183181
public sendResourceUpdated(uri: string): void {

src/tools/mongodb/mongodbTool.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export abstract class MongoDBToolBase extends ToolBase {
8787
isError: true,
8888
};
8989
case ErrorCodes.AtlasSearchNotSupported: {
90-
const CTA = this.isToolCategoryAvailable("atlas-local" as unknown as ToolCategory)
90+
const CTA = this.server?.isToolCategoryAvailable("atlas-local" as unknown as ToolCategory)
9191
? "`atlas-local` tools"
9292
: "Atlas CLI";
9393
return {
@@ -123,8 +123,4 @@ export abstract class MongoDBToolBase extends ToolBase {
123123

124124
return metadata;
125125
}
126-
127-
protected isToolCategoryAvailable(name: ToolCategory): boolean {
128-
return (this.server?.tools.filter((t) => t.category === name).length ?? 0) > 0;
129-
}
130126
}

0 commit comments

Comments
 (0)