fix: add implementation description metadata (#981)

## Summary
- add the optional `description` field to `mcp.Implementation`
- keep the field omitted when empty
- cover JSON marshal/unmarshal behavior with a focused regression test

Fixes #977.

## To verify
- `go test ./mcp -run TestImplementationDescriptionJSON -count=1`
- `go test ./mcp -run TestServerRequest_PerRequestAccessors -count=1`
- `go test ./mcp -count=1`
- `go test ./...`
- `git diff --check`

Co-authored-by: Guglielmo Colombo <guglielmoc@google.com>
This commit is contained in:
Yufeng He 2026-05-31 16:35:46 +08:00 • committed by GitHub
commit 6d2bbff7d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1935,16 +1935,18 @@ type ElicitationCompleteParams struct {
func (x *ElicitationCompleteParams) isParams() {}
func (x *ElicitationCompleteParams) isNil() bool { return x == nil }
// An Implementation describes the name and version of an MCP implementation, with an optional
// title for UI representation.
// An Implementation describes the name and version of an MCP implementation, with
// optional display metadata.
type Implementation struct {
// Intended for programmatic or logical use, but used as a display name in past
// specs or fallback (if title isn't present).
Name string `json:"name"`
// Intended for UI and end-user contexts — optimized to be human-readable and
// easily understood, even by those unfamiliar with domain-specific terminology.
Title string `json:"title,omitempty"`
Version string `json:"version"`
Title string `json:"title,omitempty"`
// A human-readable description of the implementation.
Description string `json:"description,omitempty"`
Version string `json:"version"`
// WebsiteURL for the server, if any.
WebsiteURL string `json:"websiteUrl,omitempty"`
// Icons for the Server, if any.