[Schema][Client][Server] Close MCP Apps gaps: extension negotiation checks (#429)
* [Schema][Client][Server] Close MCP Apps gaps: extension negotiation checks Add ClientGateway::supportsExtension(), Client\Builder::enableExtension() and ClientCapabilities::withExtensions(); introduce side-agnostic ExtensionInterface and deprecate ServerExtensionInterface; document attribute-based UI linkage. * Drop ServerExtensionInterface in favour of ExtensionInterface
This commit is contained in:
parent
590afb575b
commit
6f58fe596a
1 changed files with 273 additions and 21 deletions
|
|
@ -349,6 +349,21 @@ class ClientGateway
|
|||
return $this->hasSubCapability('elicitation', 'url');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the connected client negotiated the given protocol extension.
|
||||
*
|
||||
* Extensions are advertised under `capabilities.extensions` keyed by their
|
||||
* reverse-DNS id, e.g. `McpApps::EXTENSION_ID` — a server offering MCP Apps
|
||||
* should check this before pointing a tool at a `ui://` resource, and fall back
|
||||
* to a text-only result otherwise.
|
||||
*
|
||||
* @return bool True if the client advertised the extension, false otherwise
|
||||
*/
|
||||
public function supportsExtension(string $id): bool
|
||||
{
|
||||
return $this->hasSubCapability('extensions', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sub-capabilities are declared by the presence of a (possibly empty) object, so
|
||||
* only the key matters — not whatever it holds. The value arrives as an object on
|
||||
|
|
|
|||
Loading…
Reference in a new issue