Adding a Feature Flag-Controlled Tool
このコンテンツはまだ日本語訳がありません。
How to let server admins turn a built-in tool on and off. Build the tool first with Adding a Built-In Tool.
-
Map the config field to a flag in
configToFeatureFlags(src/utils/tools/featureFlagMapper.ts):my_config_field: [FeatureFlag.MY_TOOL], -
Map the tool to the flag in
BUILTIN_TOOL_FEATURE_FLAGS, orMCP_TOOL_FEATURE_FLAGSfor an MCP tool:[ToolName.MY_TOOL]: FeatureFlag.MY_TOOL, -
Set the flag on the tool class:
override requiresFeatureFlag = FeatureFlag.MY_TOOL; -
Make sure a config command can change the field.
Run bun run check and bun run lint. With the setting off, the tool must be missing from the
model’s tool list; with it on, the tool must appear and run.