> ## 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.

# useSendMessage

> Send follow-up messages to the conversation.

<Badge color="yellow">sunpeak API</Badge>

## Overview

Returns a function to send messages to the conversation on behalf of the user. The message appears as a user message and triggers the AI to respond.

<Card horizontal title="Wraps sendMessage" icon="cube" href="/mcp-apps/app/requests/send-message">
  MCP Apps SDK reference
</Card>

## Import

```tsx theme={null}
import { useSendMessage } from 'sunpeak';
```

## Signature

```tsx theme={null}
function useSendMessage(): (params: SendMessageParams) => Promise<void>
```

### SendMessageParams

<ResponseField name="role" type="'user'" required>
  Message role.
</ResponseField>

<ResponseField name="content" type="MessageContent[]" required>
  Array of message content parts.
</ResponseField>

### MessageContent

<ResponseField name="type" type="'text'" required>
  Content type.
</ResponseField>

<ResponseField name="text" type="string" required>
  Message text content.
</ResponseField>

## Returns

<ResponseField name="sendMessage" type="(params: SendMessageParams) => Promise<void>">
  Function to send a message to the conversation.
</ResponseField>

## Usage

```tsx theme={null}
import { useSendMessage } from 'sunpeak';

function MyResource() {
  const sendMessage = useSendMessage();

  const handleFollowUp = async () => {
    await sendMessage({
      role: 'user',
      content: [{ type: 'text', text: 'Show me more details' }],
    });
  };

  return <button onClick={handleFollowUp}>Ask for Details</button>;
}
```
