MCP Apps SDKDocumentation Index
Fetch the complete documentation index at: https://sunpeak.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Theontoolresult notification handler is called when the host sends the result of a tool execution. The result includes text content for model context, optional structured data optimized for UI rendering, and an error flag.
Like all notification handlers, ontoolresult should be registered before calling connect().
Signature
Parameters
Standard MCP tool execution result containing the following fields:
Text content blocks intended for model context.
Structured data optimized for UI rendering. Use this for displaying rich results in your app.
Whether the tool returned an error. When
true, content contains error details.Optional metadata attached to the result (for example a
progressToken or a related-task reference). Fields here are protocol-level and host-defined; do not assume application fields unless your server sets them.Usage
Handling success and error states
Rendering structured content
Using with the sunpeak framework
The sunpeak framework provides theuseToolData hook, which wraps ontoolresult (along with related handlers) into a reactive value for React components.
Related
- Event Handlers overview — all notification and request handlers
- ontoolinput — receive complete tool arguments before the result