UNPKG

@toolprint/hypertool-mcp

Version:

HyperTool MCP proxy server for routing requests between clients and multiple underlying MCP servers

114 lines • 4.21 kB
/** * PersonaToolsetBridge - Bridge between persona toolsets and existing ToolsetManager * * This bridge converts persona toolset definitions to the existing toolset system format, * enabling seamless integration between the persona content pack system and the * established toolset infrastructure without breaking existing functionality. * * @fileoverview Bridge implementation for persona-toolset integration */ import type { IToolDiscoveryEngine } from "../discovery/types.js"; import type { ToolsetConfig } from "../server/tools/toolset/types.js"; import type { PersonaToolset } from "./types.js"; /** * Result of persona toolset conversion */ export interface ToolsetConversionResult { /** Whether the conversion was successful */ success: boolean; /** Converted toolset configuration if successful */ toolsetConfig?: ToolsetConfig; /** Error message if conversion failed */ error?: string; /** Validation warnings (non-blocking) */ warnings?: string[]; /** Tool resolution statistics */ stats?: { /** Total tools in persona toolset */ totalTools: number; /** Successfully resolved tools */ resolvedTools: number; /** Failed tool resolutions */ failedTools: number; /** Tools that couldn't be resolved */ unresolvableTools: string[]; }; } /** * Bridge configuration options */ export interface BridgeOptions { /** Whether to validate tool resolution during conversion */ validateTools?: boolean; /** Whether to allow partial toolset creation even if some tools fail */ allowPartialToolsets?: boolean; /** Custom toolset name prefix for converted persona toolsets */ namePrefix?: string; /** Whether to include detailed metadata in the converted toolset */ includeMetadata?: boolean; } /** * PersonaToolsetBridge - Converts persona toolsets to ToolsetConfig format * * This bridge enables the persona system to work seamlessly with the existing * toolset infrastructure by converting PersonaToolset definitions into the * ToolsetConfig format expected by the ToolsetManager. */ export declare class PersonaToolsetBridge { private readonly getToolDiscoveryEngine?; private readonly options; constructor(getToolDiscoveryEngine?: () => IToolDiscoveryEngine | undefined, options?: BridgeOptions); /** * Convert a PersonaToolset to ToolsetConfig format */ convertPersonaToolset(personaToolset: PersonaToolset, personaName: string): Promise<ToolsetConversionResult>; /** * Convert multiple persona toolsets to ToolsetConfig format */ convertMultiplePersonaToolsets(personaToolsets: PersonaToolset[], personaName: string): Promise<{ success: boolean; toolsetConfigs: ToolsetConfig[]; errors: Array<{ toolsetName: string; error: string; }>; warnings: string[]; }>; /** * Generate a unique toolset name from persona and toolset names */ private generateToolsetName; /** * Generate a descriptive toolset description */ private generateToolsetDescription; /** * Validate tool references against the discovery engine */ private validateToolReferences; /** * Get bridge statistics and configuration */ getConfiguration(): { hasDiscoveryEngine: boolean; options: Required<BridgeOptions>; version: string; }; /** * Test tool resolution capabilities */ testToolResolution(): Promise<{ discoveryEngineAvailable: boolean; totalTools: number; connectedServers: number; }>; } /** * Create a PersonaToolsetBridge instance with default configuration */ export declare function createPersonaToolsetBridge(toolDiscoveryEngine?: IToolDiscoveryEngine, options?: BridgeOptions): PersonaToolsetBridge; /** * Utility function to convert a single persona toolset */ export declare function convertPersonaToolset(personaToolset: PersonaToolset, personaName: string, toolDiscoveryEngine?: IToolDiscoveryEngine, options?: BridgeOptions): Promise<ToolsetConversionResult>; //# sourceMappingURL=toolset-bridge.d.ts.map