From d9e509da6fd1e5c7f26da4c794dce4852d79d4d2 Mon Sep 17 00:00:00 2001 From: Sampson Date: Wed, 10 Sep 2025 14:21:57 -0500 Subject: [PATCH] fix(config): Defer retrieval of tool names No longer attempts to calculate tool names as module-load time, but instead defers it until the values are needed. Additionally, this change updates the schema to support optional tool exposure when using smithery.ai. --- src/config.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/config.ts b/src/config.ts index 007d8f8..4cd627b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -9,6 +9,14 @@ dotenv.config({ debug: false, quiet: true }); // Config schema for Smithery.ai export const configSchema = z.object({ braveApiKey: z.string().describe('Your API key'), + enabledTools: z + .array(z.string()) + .describe('Enforces a tool whitelist (cannot be used with disabledTools)') + .optional(), + disabledTools: z + .array(z.string()) + .describe('Enforces a tool blacklist (cannot be used with enabledTools)') + .optional(), loggingLevel: z .enum(LoggingLevelSchema.options) .default('info') @@ -39,8 +47,6 @@ const state: Configuration & { ready: boolean } = { disabledTools: [], }; -const toolNames = Object.values(tools).map((tool) => tool.name); - export function isToolPermittedByUser(toolName: string): boolean { return state.enabledTools.length > 0 ? state.enabledTools.includes(toolName) @@ -80,6 +86,7 @@ export function getOptions(): Configuration | false { .parse(process.argv); const options = program.opts(); + const toolNames = Object.values(tools).map((tool) => tool.name); // Validate tool inclusion configuration const { enabledTools, disabledTools } = options;