Skip to content

Commit aa9c57f

Browse files
chore: suggest only enabled tools
1 parent e75d553 commit aa9c57f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/common/connectionErrorHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type ConnectionErrorHandled = { errorHandled: true; result: CallToolResul
1414

1515
export const connectionErrorHandler: ConnectionErrorHandler = (error, { availableTools, connectionState }) => {
1616
const connectTools = availableTools
17-
.filter((t) => t.operationType === "connect")
17+
.filter((t) => t.operationType === "connect" && t.isEnabled())
1818
.sort((a, b) => a.category.localeCompare(b.category)); // Sort Atlas tools before MongoDB tools
1919

2020
// Find what Atlas connect tools are available and suggest when the LLM should to use each. If no Atlas tools are found, return a suggestion for the MongoDB connect tool.

src/tools/tool.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ export abstract class ToolBase {
181181
return true;
182182
}
183183

184+
public isEnabled(): boolean {
185+
return this.registeredTool?.enabled ?? false;
186+
}
187+
184188
protected disable(): void {
185189
if (!this.registeredTool) {
186190
this.session.logger.warning({

0 commit comments

Comments
 (0)