You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve golang type documentation and examples (#631)
Enhanced Go struct tags throughout `pkg/api/v0/types.go` and
`pkg/model/types.go` to better align with the OpenAPI specification.
## Changes
- Added comprehensive `doc` tags with detailed field descriptions
matching OpenAPI
- Added `example` tags showing valid values for fields (e.g.,
`"io.github.user/weather"`, `"npx"`)
- Added `format` tags (`uri`, `date-time`) for better type specification
- Added `pattern` and `enum` tags for validation constraints
- Added `placeholder` field to `Input` struct matching OpenAPI spec
- Removed redundant comments in favor of inline struct tags
These changes improve code clarity and make the types more
self-documenting, while maintaining compatibility with the OpenAPI
schema definitions in `docs/reference/api/openapi.yaml`.
---------
Signed-off-by: Radoslav Dimitrov <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: Radoslav Dimitrov <[email protected]>
Schemastring`json:"$schema" required:"true" minLength:"1" format:"uri" doc:"JSON Schema URI for this server.json format" example:"https://static.modelcontextprotocol.io/schemas/2025-09-29/server.schema.json"`
36
+
Namestring`json:"name" minLength:"3" maxLength:"200" pattern:"^[a-zA-Z0-9.-]+/[a-zA-Z0-9._-]+$" doc:"Server name in reverse-DNS format. Must contain exactly one forward slash separating namespace from server name." example:"io.github.user/weather"`
37
+
Descriptionstring`json:"description" minLength:"1" maxLength:"100" doc:"Clear human-readable explanation of server functionality." example:"MCP server providing weather data and forecasts via OpenWeatherMap API"`
38
+
Titlestring`json:"title,omitempty" minLength:"1" maxLength:"100" doc:"Optional human-readable title or display name for the MCP server." example:"Weather API"`
39
+
Repository model.Repository`json:"repository,omitempty" doc:"Optional repository metadata for the MCP server source code."`
40
+
Versionstring`json:"version" doc:"Version string for this server. SHOULD follow semantic versioning." example:"1.0.2"`
41
+
WebsiteURLstring`json:"websiteUrl,omitempty" format:"uri" doc:"Optional URL to the server's homepage, documentation, or project website." example:"https://modelcontextprotocol.io/examples"`
42
+
Icons []model.Icon`json:"icons,omitempty" doc:"Optional set of sized icons that the client can display in a user interface."`
43
+
Packages []model.Package`json:"packages,omitempty" doc:"Array of package configurations"`
44
+
Remotes []model.Transport`json:"remotes,omitempty" doc:"Array of remote configurations"`
45
+
Meta*ServerMeta`json:"_meta,omitempty" doc:"Extension metadata using reverse DNS namespacing for vendor-specific data"`
52
46
}
53
47
54
-
// Metadata represents pagination metadata
55
48
typeMetadatastruct {
56
-
NextCursorstring`json:"nextCursor,omitempty"`
57
-
Countint`json:"count"`
49
+
NextCursorstring`json:"nextCursor,omitempty" doc:"Pagination cursor for retrieving the next page of results. Use this exact value in the cursor query parameter of your next request."`
50
+
Countint`json:"count" doc:"Number of items in current page"`
0 commit comments