Skip to content

Function: resolveUserKey()

resolveUserKey(requestContext?): string

Identity every per-user cache entry is namespaced under, so an OBO result cannot be read back by another caller.

Prefers the User that MastraServer stamps on the request context, whose id already follows attributedUserId. The MCP transport routes do not thread that context into tool execution, so those fall back to the ambient execution context (the active OBO scope, or the service principal). A caller holding an express request should build its key from attributedUserId instead, so the forwarded user is not lost.

RequestContext<unknown>

string