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.
This commit is contained in:
Sampson committed 2025-09-10 14:21:57 -05:00
1 parent 69eb8c9354
commit d9e509da6f
1 file changed
+9 -2
+9 -2
View File
@@ -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;