import type { RequestOptions, ServerInstanceInfo, ValidServer } from './types.js'; /** * Gets the description for a server, using the server name as default if none is provided. * * @param serverConfig - Server configuration object (may contain description in template) * @param serverName - Name of the server * @returns The server description or the server name with usage note if no description is configured */ export declare function getServerDescription(serverConfig: { template?: { description?: string; }; } | undefined, serverName: string): string; /** * Type guard to validate that a server object has valid name and configuration. * * This function checks if the provided object is a valid server with both a non-empty * name string and a configuration object, ensuring type safety for server operations. * * @param {unknown} server - Object to validate as a server * @returns {boolean} True if the object is a valid server with name and config * * @example * ```typescript * const server = { name: 'my-server', config: { type: 'stdio' } }; * if (hasValidId(server)) { * // TypeScript knows server is properly typed * console.log(server.name); * } * ``` */ export declare function hasValidId(server: unknown): server is ValidServer; /** * Selects the best server instance based on server name and request options. * * This function resolves a server name to its configuration and instance details, * handling both single and multiple instance scenarios using configurable instance * selection strategies (random, round-robin, tag-match-unique). * * The function performs the following steps: * 1. Retrieves all instances of the specified server name * 2. Returns undefined if no instances are found * 3. Gets the server configuration from the hub manager * 4. Uses InstanceSelector to choose the best instance based on configured strategy * 5. Handles errors based on the strictMode parameter * * Supported instance selection strategies: * - random: Randomly selects from enabled instances * - round-robin: Cycles through enabled instances in order * - tag-match-unique: Selects instance that uniquely matches request tags * * @param {string} serverName - Name of the server to select an instance for * @param {RequestOptions} [requestOptions] - Optional request options for instance selection * @param {boolean} [strictMode=true] - Whether to throw errors for tag-match-unique failures (default: true) * @returns {{ name: string; config: ServerConfig; instance: ServerInstanceConfig & Record } | undefined} * Server information with configuration and instance details, or undefined if not found * * @example * ```typescript * const serverInfo = selectBestInstance('my-mcp-server'); * if (serverInfo) { * console.log(`Selected instance: ${serverInfo.instance.id}`); * } * * // With request options for tag matching * const serverInfoWithOptions = selectBestInstance('my-mcp-server', { * sessionId: 'session-123', * tags: { environment: 'production' } * }); * * // Non-strict mode for management operations * const serverInfoNonStrict = selectBestInstance('my-mcp-server', undefined, false); * ``` */ export declare function selectBestInstance(serverName: string, requestOptions?: RequestOptions): ServerInstanceInfo | undefined; //# sourceMappingURL=server-selector.d.ts.map