MCP Apps Kit - v0.5.0
    Preparing search index...

    Interface MiddlewareContext

    Context object passed through middleware chain

    Immutable properties provide request info, mutable state Map allows middleware to share data with downstream middleware and tool handlers.

    interface MiddlewareContext {
        input: unknown;
        metadata: ToolContext;
        state: Map<string, unknown>;
        toolName: string;
    }
    Index

    Properties

    input: unknown

    Validated tool input

    Already validated against tool's input schema. Immutable - middleware should not modify.

    metadata: ToolContext

    Client-provided metadata

    Includes locale, userAgent, userLocation, subject, etc. Immutable - set by client, middleware should not modify.

    state: Map<string, unknown>

    Request-scoped shared state

    Mutable Map for sharing data between middleware and tool handler. Isolated per request - not shared across requests.

    toolName: string

    Name of the tool being invoked

    Immutable - set by framework before middleware chain.