@toolplex/client
Version:
The official ToolPlex client for AI agent tool discovery and execution
40 lines (39 loc) • 1.5 kB
TypeScript
import { ClientContext } from "../clientContext.js";
export declare class ServerPolicy {
private clientContext;
private blockedMcpServersSet;
constructor(clientContext: ClientContext);
/**
* Validates that a server is not blocked.
*
* @throws Error if attempting to use a blocked server
*/
enforceBlockedServerPolicy(serverId: string): void;
/**
* Validates that a server is allowed.
*
* @throws Error if attempting to use a server not in the allowed list
*/
enforceAllowedServerPolicy(serverId: string): void;
/**
* Validates that a server is not blocked before calling a tool on it.
* Also checks if desktop commander is enabled when calling tools on the desktop commander server.
*
* @throws Error if attempting to call a tool on a blocked server or if desktop commander is disabled
*/
enforceCallToolPolicy(serverId: string): void;
/**
* Validates that a server can be used.
*
* @throws Error if attempting to use a blocked or disallowed server
*/
enforceUseServerPolicy(serverId: string): void;
/**
* Filters out blocked servers from a list of objects.
*
* @param servers List of objects containing server IDs
* @param getServerId Function that extracts the server ID from an object
* @returns Filtered list with blocked servers removed
*/
filterBlockedMcpServers<T>(servers: T[], getServerId: (item: T) => string): T[];
}