Add title field to Prompt for MCP spec compliance (#278)

The MCP 2025-11-25 specification defines an optional `title` property on
Prompt for human-readable display in UI contexts, distinct from the
programmatic `name` identifier. This was missing from the SDK.

BC Break: Builder::addPrompt() signature changed — $title parameter added
between $name and $description. Callers using positional arguments for
$description must switch to named arguments.

Closes #276
This commit is contained in:
Christopher Hertel 2026-04-14 10:04:35 +02:00 • committed by GitHub
commit 7af5a345c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -473,11 +473,12 @@ final class Builder
public function addPrompt(
\Closure|array|string $handler,
?string $name = null,
?string $title = null,
?string $description = null,
?array $icons = null,
?array $meta = null,
): self {
$this->prompts[] = compact('handler', 'name', 'description', 'icons', 'meta');
$this->prompts[] = compact('handler', 'name', 'title', 'description', 'icons', 'meta');
return $this;
}