Ask the client’s LLM (sampling)
sample_llmSends a sampling request so the client's own LLM generates a reply, returning the text, chosen model and stop reason. Use it to test client sampling support.
Instructions
Send a sampling/createMessage request: the client runs its own LLM for this server (it should let the user review the request first) and returns the reply. Reports the reply, the model the client chose and the stop reason. Options: system prompt, model hint, maxTokens, temperature, includeContext, an image input, and useTools (the 2025-11-25 tool loop with a count_letters tool).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "sample_llm"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | No | User message sent to the client’s LLM (default depends on withImage/useTools) | |
| useTools | No | Offer a count_letters tool to the model (needs the sampling.tools capability) | |
| maxTokens | No | ||
| modelHint | No | modelPreferences.hints[0].name (substring of the model the client should prefer); empty = no hint | claude |
| withImage | No | Send a 32×32 gradient PNG as an image message before the prompt | |
| temperature | No | ||
| systemPrompt | No | System prompt; empty string = none | You are a concise assistant. Answer in at most three lines. |
| includeContext | No | Ask the client to add conversation context (needs the sampling.context capability) | none |