Overview
sendLog sends log messages from the View to the host for debugging purposes. These logs are not added to the conversation and are not visible to the end user. They are intended for developers to diagnose issues during development or in production.
Use sendLog when you need structured logging that the host can capture, filter, or display in its developer tools. This is particularly useful because MCP App Views run in sandboxed iframes where console.log output may not be easily accessible.
Signature
Parameters
Returns
ReturnsPromise<void>. The method resolves when the log has been sent to the host.
Usage
Basic logging
Logging at different levels
Wrapping in a helper
Related
useSendLog— React hook that wraps this method.- Requests — Overview of all View-to-host request methods.