Skip to main content
sunpeak API

Overview

The usePlatform hook returns the platform type reported by the host. It is a convenience wrapper around useHostContext.
This returns the host-reported platform from McpUiHostContext.platform, not a runtime detection. For runtime host detection (ChatGPT vs Claude), see detectHost.

Wraps onhostcontextchanged

MCP Apps SDK reference

Import

Signature

Returns

return
'web' | 'desktop' | 'mobile' | undefined
The platform type reported by the host. undefined if the host does not report a platform.

Usage

The platform value comes from McpUiHostContext.platform.