import type { ExtensionAPI } from "../../types.ts";
import type { ResolvedMcpConfig } from "./config-schema.ts";
import type { McpConnectionEntry } from "./service-types.ts";
import type { McpAsyncErrorSink } from "./wrap.ts";
type McpToolRegistrar = Pick<ExtensionAPI, "getActiveTools" | "setActiveTools" | "registerTool">;
/** One session's registration of a server's catalog: a refresh re-registers it there when stale. */
export interface McpToolsRefreshTarget {
    readonly pi: McpToolRegistrar;
    readonly registeredIdentity: () => string | undefined;
    readonly register: () => Promise<void>;
}
/** Coalesce a server's tools-changed signals into one refresh. `connectOnly` is true when
 * every merged signal came from a connect rather than from a reported change. */
export declare function subscribeMcpToolsChanged(entry: McpConnectionEntry, refresh: (connectOnly: boolean) => Promise<void>, sink: McpAsyncErrorSink): () => void;
/**
 * Re-list a server on a coalesced tools-changed signal and re-register: added
 * tools enter INACTIVE (registerToolsPreservingActiveSet keeps the active set),
 * and removed tools are tombstoned so a stale call fails cleanly. Every connect
 * raises the signal too; a connect-only refresh leaves an unchanged catalog
 * registered, so the catalog lands once per session (#2177). Every live session sharing the
 * connection is a target, resolved when registration starts and again until no session that
 * attached mid-refresh is left out; each re-registers in its own tool set, and one session's
 * failure is reported without starving the others (#2514).
 */
export declare function refreshMcpToolsOnListChanged(entry: McpConnectionEntry, targets: () => readonly McpToolsRefreshTarget[], config: ResolvedMcpConfig, connectOnly: boolean): Promise<void>;
export {};
//# sourceMappingURL=service-tools-changed.d.ts.map