Skip to main content
sunpeak API

Overview

The useUserAgent hook returns the host application identifier string from McpUiHostContext.userAgent. This is an opaque string set by the host — not the browser’s navigator.userAgent. It is a convenience wrapper around useHostContext.
The format and content of this string is host-defined. Not all hosts report a user agent, so the value may be undefined.
Known host values:

Wraps onhostcontextchanged

MCP Apps SDK reference

Import

Signature

Returns

return
string | undefined
The host application identifier string, or undefined if the host does not report one.

Usage