Skip to main content

Documentation Index

Fetch the complete documentation index at: https://sunpeak.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

sunpeak API

Overview

Returns a function to notify the host that the app’s available tools have changed. Call this after registering, removing, enabling, or disabling tools via useRegisterTool.

Import

import { useSendToolListChanged } from 'sunpeak';

Signature

function useSendToolListChanged(): () => Promise<void>

Returns

sendToolListChanged
() => Promise<void>
Function that sends a tools/list_changed notification to the host.

Usage

import { useRegisterTool, useSendToolListChanged } from 'sunpeak';

function DynamicTools() {
  const registerTool = useRegisterTool();
  const sendToolListChanged = useSendToolListChanged();

  const addTool = () => {
    registerTool("ping", { description: "Ping" }, () => ({
      content: [{ type: "text", text: "pong" }],
    }));
    sendToolListChanged();
  };

  return <button onClick={addTool}>Add Tool</button>;
}