/**
 * @fileoverview Handler factory for resource definitions.
 * Constructs Context (with `uri`), checks inline auth, validates params, formats response.
 * @module src/mcp-server/resources/utils/resourceHandlerFactory
 */
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
import type { Variables } from '@modelcontextprotocol/sdk/shared/uriTemplate.js';
import type { ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult, ReadResourceResult, ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
import type { AnyResourceDefinition } from '../../../mcp-server/resources/utils/resourceDefinition.js';
import type { StorageService } from '../../../storage/core/StorageService.js';
import type { Logger } from '../../../utils/internal/logger.js';
type SdkExtra = RequestHandlerExtra<ServerRequest, ServerNotification>;
/** Services required by the handler factory to construct Context. */
export interface ResourceHandlerFactoryServices {
    /**
     * When true, surface `ctx.sessionId` even in stateless HTTP mode (per-request
     * generated token). Wired from `createApp({ context: { exposeStatelessSessionId } })`.
     * Default false — `ctx.sessionId` is only set when the session has
     * request-spanning lifetime (HTTP `stateful` / `auto` mode).
     */
    exposeStatelessSessionId?: boolean;
    logger: Logger;
    storage: StorageService;
}
/**
 * Per-server notifier closures bound at registration time, targeting
 * `server.send*ListChanged()` and `server.server.elicitInput(...)`.
 *
 * Split from {@link ResourceHandlerFactoryServices} so each per-request
 * McpServer gets its own notifier closures — preventing a concurrent
 * registerAll() from overwriting an in-flight handler's notifier target.
 *
 * The resource handler factory prefers request-scoped notifiers
 * ({@link buildRequestScopedNotifiers}, #135) and uses these only as a fallback
 * when the SDK extra exposes no sender (e.g. a non-request test scope).
 *
 * `elicitInput` and `getClientCapabilities` are bound at registration time to
 * the per-server `Server` instance so `wrapElicit` can gate `ctx.elicit` on
 * the client's advertised capability and forward elicitation requests on the
 * wire.
 */
export interface ResourceHandlerNotifiers {
    /** Bound to `server.server.elicitInput.bind(server.server)`. */
    elicitInput?: (params: ElicitRequestFormParams | ElicitRequestURLParams) => Promise<ElicitResult>;
    /** Bound to `server.server.getClientCapabilities.bind(server.server)`. */
    getClientCapabilities?: () => {
        elicitation?: unknown;
    } | undefined;
    notifyPromptListChanged?: () => void;
    notifyResourceListChanged?: () => void;
    notifyResourceUpdated?: (uri: string) => void;
    notifyToolListChanged?: () => void;
}
/**
 * Creates an MCP resource read handler from a resource definition.
 * The returned function is compatible with the MCP SDK's resource callback type.
 *
 * Responsibilities:
 * - Creates RequestContext from SDK context (for tracing)
 * - Creates unified Context with `ctx.uri` set
 * - Checks inline `auth` scopes if defined
 * - Validates params via Zod schema
 * - Formats response via `format` or JSON default
 * - Catches errors and re-throws for the SDK
 */
export declare function createResourceHandler(def: AnyResourceDefinition, services: ResourceHandlerFactoryServices, notifiers: ResourceHandlerNotifiers): (uri: URL, variables: Variables, extra: SdkExtra) => Promise<ReadResourceResult>;
export {};
//# sourceMappingURL=resourceHandlerFactory.d.ts.map