@@ -25,6 +25,7 @@ import {
2525 type BaseServerTool ,
2626 type ServerToolContext ,
2727} from '@/lib/copilot/tools/server/base-tool'
28+ import { isMothershipBetaFeaturesEnabled } from '@/lib/core/config/feature-flags'
2829import { getBlocksMetadataServerTool } from '@/lib/copilot/tools/server/blocks/get-blocks-metadata-tool'
2930import { getTriggerBlocksServerTool } from '@/lib/copilot/tools/server/blocks/get-trigger-blocks'
3031import { searchDocumentationServerTool } from '@/lib/copilot/tools/server/docs/search-documentation'
@@ -130,7 +131,7 @@ function isWriteAction(toolName: string, action: string | undefined): boolean {
130131}
131132
132133/** Registry of all server tools. Tools self-declare their validation schemas. */
133- const serverToolRegistry : Record < string , BaseServerTool > = {
134+ const baseServerToolRegistry : Record < string , BaseServerTool > = {
134135 [ getBlocksMetadataServerTool . name ] : getBlocksMetadataServerTool ,
135136 [ getTriggerBlocksServerTool . name ] : getTriggerBlocksServerTool ,
136137 [ editWorkflowServerTool . name ] : editWorkflowServerTool ,
@@ -159,16 +160,25 @@ const serverToolRegistry: Record<string, BaseServerTool> = {
159160 [ generateImageServerTool . name ] : generateImageServerTool ,
160161}
161162
163+ function getServerToolRegistry ( ) : Record < string , BaseServerTool > {
164+ if ( isMothershipBetaFeaturesEnabled ) {
165+ return baseServerToolRegistry
166+ }
167+ const registry = { ...baseServerToolRegistry }
168+ delete registry [ touchPlanServerTool . name ]
169+ return registry
170+ }
171+
162172export function getRegisteredServerToolNames ( ) : string [ ] {
163- return Object . keys ( serverToolRegistry )
173+ return Object . keys ( getServerToolRegistry ( ) )
164174}
165175
166176export async function routeExecution (
167177 toolName : string ,
168178 payload : unknown ,
169179 context ?: ServerToolContext
170180) : Promise < unknown > {
171- const tool = serverToolRegistry [ toolName ]
181+ const tool = getServerToolRegistry ( ) [ toolName ]
172182 if ( ! tool ) {
173183 throw new Error ( `Unknown server tool: ${ toolName } ` )
174184 }
0 commit comments