> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mcp-use.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompts

> Fetch server-defined prompt templates

```typescript theme={null}
import { MCPClient } from "@mcp-use/client";

const client = new MCPClient({
  mcpServers: { demo: { url: "http://localhost:3000/mcp" } },
});

try {
  const conn = await client.connect("demo");

  const prompts = await conn.listPrompts();
  for (const p of prompts) {
    console.log(p.name, p.description);
  }

  const result = await conn.getPrompt("plan_trip", {
    destination: "Japan",
    days: "7",
  });

  for (const message of result.messages) {
    if (message.content.type === "text") {
      console.log(message.role, message.content.text);
    }
  }
} finally {
  await client.close();
}
```

## React

```tsx theme={null}
const server = useMcpServer("demo");
const result = await server?.getPrompt("code_review", { language: "ts" });
```

## Reference

[`MCPConnection`](/typescript/api-reference/client/mcp-session) — `listPrompts`, `getPrompt`.
