equip-toolset
Apply a predefined toolset configuration to filter and access tools efficiently within the Hypertool-MCP server.
Instructions
Equip a saved toolset configuration to filter available tools
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the toolset to equip |
Implementation Reference
- Core implementation of equipToolset method in ToolsetManager that loads the specified toolset from persistent storage, validates it, sets it as the active toolset, updates preferences, generates info, and returns structured response. This is the actual logic executed when the tool is called.async equipToolset(toolsetName: string): Promise<EquipToolsetResponse> { try { // Import the function here to avoid circular imports const preferences = await import("../../../config/preferenceStore.js"); const loadToolsetsFromPreferences = preferences.loadStoredToolsets; const saveLastEquippedToolset = preferences.saveLastEquippedToolset; const stored = await loadToolsetsFromPreferences(); const toolsetConfig = stored[toolsetName]; if (!toolsetConfig) { return { success: false, error: `Toolset "${toolsetName}" not found` }; } const validation = this.setCurrentToolset(toolsetConfig); if (!validation.valid) { return { success: false, error: `Invalid toolset: ${validation.errors.join(", ")}`, }; } // Save this as the last equipped toolset await saveLastEquippedToolset(toolsetName); // Generate toolset info with current status const toolsetInfo = await this.generateToolsetInfo(toolsetConfig); // Event is already emitted by setConfig() return { success: true, toolset: toolsetInfo, }; } catch (error) { return { success: false, error: `Failed to load toolset: ${error instanceof Error ? error.message : String(error)}`, }; } }
- MCP Tool definition for 'equip-toolset' including name, description, and input schema requiring a 'name' parameter.export const equipToolsetDefinition: Tool = { name: "equip-toolset", description: "Equip a saved toolset configuration to filter available tools", inputSchema: { type: "object" as const, properties: { name: { type: "string", description: "Name of the toolset to equip", }, }, required: ["name"], additionalProperties: false, }, };
- src/server/tools/config-tools/registry.ts:11-34 (registration)Registry where createEquipToolsetModule factory is imported and added to CONFIG_TOOL_FACTORIES array for configuration tools.import { createListSavedToolsetsModule } from "./tools/list-saved-toolsets.js"; import { createEquipToolsetModule } from "./tools/equip-toolset.js"; import { createDeleteToolsetModule } from "./tools/delete-toolset.js"; import { createUnequipToolsetModule } from "./tools/unequip-toolset.js"; import { createGetActiveToolsetModule } from "./tools/get-active-toolset.js"; import { createAddToolAnnotationModule } from "./tools/add-tool-annotation.js"; import { createExitConfigurationModeModule } from "../common/exit-configuration-mode.js"; import { createListPersonasModule } from "./persona/list-personas.js"; /** * Registry of all configuration tool factories */ export const CONFIG_TOOL_FACTORIES: ToolModuleFactory[] = [ createListAvailableToolsModule, createBuildToolsetModule, createListSavedToolsetsModule, createEquipToolsetModule, createDeleteToolsetModule, createUnequipToolsetModule, createGetActiveToolsetModule, createAddToolAnnotationModule, createListPersonasModule, // Persona management tool createExitConfigurationModeModule, ];
- Routing logic in ConfigToolsManager.handleToolCall that intercepts 'equip-toolset' calls and delegates to the active IToolsetDelegate (ToolsetManager or PersonaManager).equipToolset, wrapping the result in MCP response format.case "equip-toolset": { const result = await delegate.equipToolset(args?.name); return { content: [ { type: "text", text: JSON.stringify(result), }, ], structuredContent: result, }; }
- src/server/tools/config-tools/manager.ts:47-50 (registration)Instantiation of all configuration tool modules from factories in ConfigToolsManager constructor's registerTools method, including equip-toolset module.for (const factory of CONFIG_TOOL_FACTORIES) { const module = factory(this.dependencies, this.onModeChangeRequest); this.toolModules.set(module.toolName, module); }