import { RequestContext } from '@mastra/core/request-context'; import type { MCPToolExecutionContext } from '@mastra/core/tools'; import type { ServerContext } from '@modelcontextprotocol/server'; import type { MCPAuthInfoToUserMapper } from './types.js'; /** * The `context.mcp` a 2026-07-28 request hands to tools: the 1.x shape, with the * per-request facilities (cancellation, metadata, auth, log, progress) live and the * removed server-initiated requests throwing at the call site. */ export declare function toToolExecutionContext(ctx: ServerContext, loggerName: string): MCPToolExecutionContext; /** * Builds the trusted application context for one request. Auth is re-derived from * the transport every time; nothing is carried between continuation rounds. The W3C * trace fields sent by the client are exposed under `traceContext` as opaque * strings for observability only; they are never consulted for authorization. */ export declare function toRequestContext(ctx: ServerContext, mapAuthInfoToUser: MCPAuthInfoToUserMapper | undefined): Promise; /** * The identity a continuation is bound to; a different caller cannot resume it. * Prefers the token subject, then the id of the user `mapAuthInfoToUser` produced, * and otherwise the bearer token itself, so two users sharing one OAuth client * never share a principal. A token refreshed mid-round therefore starts over. */ export declare function principalOf(ctx: ServerContext, requestContext: RequestContext): string; export declare function hashArguments(value: unknown): string; /** * What the server signs into `requestState` when a handler suspends. It names the * exact operation and caller so a continuation can only answer the round it was * issued for; `suspendPayload` is what the handler asked to be handed back. */ export interface ContinuationEnvelope { method: 'tools/call' | 'resources/read' | 'prompts/get'; name: string; argsHash: string; principal: string; round: number; suspendPayload: unknown; iat: number; } /** The key every suspended round asks the client to answer under. */ export declare const INPUT_KEY = "input"; export interface ContinuationRound { round: number; suspendPayload: unknown; /** Present when the client accepted; a decline or cancel ends the request instead. */ resumeData?: unknown; outcome: 'accept' | 'decline' | 'cancel'; } /** * Reads the continuation the SDK already integrity-checked and pairs it with this * round's answer. Returns `undefined` for a fresh request. */ export declare function readContinuation(ctx: ServerContext, requestContext: RequestContext, expected: Pick): ContinuationRound | undefined; //# sourceMappingURL=request.d.ts.map