/** * Cluster-arg resolver for native Kafka handlers. Asymmetric by connection * type: * * - Direct: returns `{ clusterId: undefined, envId: undefined }`. The * `DirectClientManager` ignores cluster args and uses its eagerly-built * single-instance client(s); the handler passes the undefineds through. * - OAuth: requires the args; throws with a discovery hint if missing. * Handlers catch the throw at entry and convert to a `CallToolResult` * with `isError: true` so the agent receives a normal tool-call error * rather than an RPC failure. */ import { ServerRuntime } from "../../server-runtime.js"; export declare function resolveKafkaClusterArgs(args: { cluster_id?: string; environment_id?: string; }, runtime: ServerRuntime, connId: string): { clusterId: string | undefined; envId: string | undefined; }; /** * REST-tool variant of {@link resolveKafkaClusterArgs}. The Kafka REST API * places `cluster_id` directly in the URL path * (e.g. `/kafka/v3/clusters/{id}/topics`), so the handler always needs a * concrete cluster id — even on direct connections that omit the arg and * rely on the configured fallback. * * Direct: `args.clusterId ?? conn.kafka?.cluster_id`; throws if neither. * `envId` is unused (direct's `kafka.rest_endpoint` already targets the * per-cluster hostname). * OAuth: both `clusterId` and `environmentId` required. Argument names are * camelCase to match the existing input-schema convention of these tools * and `list-clusters`; the native-Kafka tools' snake_case `cluster_id` is * a separate convention. */ export declare function resolveKafkaRestArgs(args: { clusterId?: string; environmentId?: string; }, runtime: ServerRuntime, connId: string): { clusterId: string; envId: string | undefined; }; /** * Env-only resolver for tools that scope a request to a single CCloud * environment without a cluster identifier (e.g., `list-clusters`). * * Direct: arg wins; falls back to `conn.kafka?.env_id`; throws if neither * source supplies a value. * OAuth: arg required (no service block to fall back to); throws with a * discovery hint pointing at `list-environments`. * * Argument name is camelCase (`environmentId`) to match the existing * input-schema convention of cluster-management tools. */ export declare function resolveEnvArg(args: { environmentId?: string; }, runtime: ServerRuntime, connId: string): string; /** * Disposes a Kafka client (admin or producer) iff the connection is OAuth-typed. * On direct connections this is a no-op — direct's `AsyncLazy` admin/producer * are manager-owned singletons and must not be disconnected by handlers. On * OAuth, calls `client.disconnect()` and swallows + logs any error so disposal * failure never masks the handler's own error. */ export declare function disposeIfOAuth(runtime: ServerRuntime, connId: string, client: { disconnect: () => Promise; }): Promise; /** * Renders any error thrown from a Kafka admin/producer/consumer call into a * single agent-readable string. Preserves per-topic-cause unwrapping for * `KafkaJSAggregateError`, surfaces `KafkaJSError.code` when present, and * falls back gracefully for unknown shapes. */ export declare function formatKafkaError(err: unknown): string; //# sourceMappingURL=cluster-arg-resolvers.d.ts.map