Function: getIdentity()
getIdentity<
T>():T|undefined
Defined in: context.ts:19
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 Parameter | Default type |
|---|---|
T | unknown |
Returns
T | undefined