Skip to main content

Function: getIdentity()

getIdentity<T>(): T | undefined

Defined in: context.ts:21

Returns the verified JWT payload for the current MCP request. Only available inside a tool handler when auth is configured on the router.

Accepts an optional type parameter to avoid casting at call sites: getIdentity<{ sub: string; email: string }>() returns T | undefined. Omitting the type parameter keeps the return type as unknown | undefined.

Type Parameters​

Type ParameterDefault type
Tunknown

Returns​

T | undefined