@@ -28,6 +28,24 @@ const (
2828 resultTypeInputRequired resultType = "input_required"
2929)
3030
31+ type completeResultWithType struct {
32+ ResultType resultType `json:"resultType,omitempty"`
33+ }
34+
35+ func (r * completeResultWithType ) setResultType (rt resultType ) { r .ResultType = rt }
36+ func (* completeResultWithType ) isCompleteResult () {}
37+
38+ type completeResultResponse interface {
39+ setResultType (resultType )
40+ isCompleteResult ()
41+ }
42+
43+ func setCompleteResultType (res Result ) {
44+ if r , ok := res .(completeResultResponse ); ok {
45+ r .setResultType (resultTypeComplete )
46+ }
47+ }
48+
3149// InputRequest is a type for parameters that a server can include in the response
3250// to request input from client (SEP-2322). Implementations are [*ElicitParams],
3351// [*CreateMessageParams], and [*ListRootsParams].
@@ -637,6 +655,7 @@ type CompletionResultDetails struct {
637655
638656// The server's response to a completion/complete request
639657type CompleteResult struct {
658+ completeResultWithType
640659 // This property is reserved by the protocol to allow clients and servers to
641660 // attach additional metadata to their responses.
642661 Meta `json:"_meta,omitempty"`
@@ -1114,6 +1133,7 @@ func (x *DiscoverParams) GetProgressToken() any { return getProgressToken(x) }
11141133func (x * DiscoverParams ) SetProgressToken (t any ) { setProgressToken (x , t ) }
11151134
11161135type DiscoverResult struct {
1136+ completeResultWithType
11171137 Meta `json:"_meta,omitempty"`
11181138 Cacheable
11191139 // The versions of the Model Context Protocol that the server supports.
@@ -1177,6 +1197,7 @@ func (c *Cacheable) setDefaultCacheableValues() {
11771197
11781198// The server's response to a prompts/list request from the client.
11791199type ListPromptsResult struct {
1200+ completeResultWithType
11801201 // This property is reserved by the protocol to allow clients and servers to
11811202 // attach additional metadata to their responses.
11821203 Meta `json:"_meta,omitempty"`
@@ -1207,6 +1228,7 @@ func (x *ListResourceTemplatesParams) cursorPtr() *string { return &x.Cursor
12071228
12081229// The server's response to a resources/templates/list request from the client.
12091230type ListResourceTemplatesResult struct {
1231+ completeResultWithType
12101232 // This property is reserved by the protocol to allow clients and servers to
12111233 // attach additional metadata to their responses.
12121234 Meta `json:"_meta,omitempty"`
@@ -1237,6 +1259,7 @@ func (x *ListResourcesParams) cursorPtr() *string { return &x.Cursor }
12371259
12381260// The server's response to a resources/list request from the client.
12391261type ListResourcesResult struct {
1262+ completeResultWithType
12401263 // This property is reserved by the protocol to allow clients and servers to
12411264 // attach additional metadata to their responses.
12421265 Meta `json:"_meta,omitempty"`
@@ -1303,6 +1326,7 @@ func (x *ListToolsParams) cursorPtr() *string { return &x.Cursor }
13031326
13041327// The server's response to a tools/list request from the client.
13051328type ListToolsResult struct {
1329+ completeResultWithType
13061330 // This property is reserved by the protocol to allow clients and servers to
13071331 // attach additional metadata to their responses.
13081332 Meta `json:"_meta,omitempty"`
0 commit comments