@@ -422,6 +422,14 @@ type clientSessionState struct {
422422
423423func (cs * ClientSession ) InitializeResult () * InitializeResult { return cs .state .InitializeResult }
424424
425+ // usesNewProtocol reports whether this session has negotiated a protocol
426+ // version >= 2026-06-30, which requires the SEP-2575 per-request `_meta`
427+ // triple on every outgoing request.
428+ func (cs * ClientSession ) usesNewProtocol () bool {
429+ res := cs .state .InitializeResult
430+ return res != nil && res .ProtocolVersion >= protocolVersion20260630
431+ }
432+
425433func (cs * ClientSession ) ID () string {
426434 if c , ok := cs .mcpConn .(hasSessionID ); ok {
427435 return c .SessionID ()
@@ -1076,23 +1084,32 @@ func newClientRequest[P Params](cs *ClientSession, params P) *ClientRequest[P] {
10761084
10771085// Ping makes an MCP "ping" request to the server.
10781086func (cs * ClientSession ) Ping (ctx context.Context , params * PingParams ) error {
1079- _ , err := handleSend [* emptyResult ](ctx , methodPing , newClientRequest (cs , orZero [* PingParams ](params )))
1087+ _ , err := handleSend [* emptyResult ](ctx , methodPing , newClientRequest (cs , orZero [Params ](params )))
10801088 return err
10811089}
10821090
10831091// ListPrompts lists prompts that are currently available on the server.
10841092func (cs * ClientSession ) ListPrompts (ctx context.Context , params * ListPromptsParams ) (* ListPromptsResult , error ) {
1085- return handleSend [* ListPromptsResult ](ctx , methodListPrompts , newClientRequest (cs , orZero [* ListPromptsParams ](params )))
1093+ if params == nil && cs .usesNewProtocol () {
1094+ params = & ListPromptsParams {}
1095+ }
1096+ return handleSend [* ListPromptsResult ](ctx , methodListPrompts , newClientRequest (cs , orZero [Params ](params )))
10861097}
10871098
10881099// GetPrompt gets a prompt from the server.
10891100func (cs * ClientSession ) GetPrompt (ctx context.Context , params * GetPromptParams ) (* GetPromptResult , error ) {
1090- return handleSend [* GetPromptResult ](ctx , methodGetPrompt , newClientRequest (cs , orZero [* GetPromptParams ](params )))
1101+ if params == nil && cs .usesNewProtocol () {
1102+ params = & GetPromptParams {}
1103+ }
1104+ return handleSend [* GetPromptResult ](ctx , methodGetPrompt , newClientRequest (cs , orZero [Params ](params )))
10911105}
10921106
10931107// ListTools lists tools that are currently available on the server.
10941108func (cs * ClientSession ) ListTools (ctx context.Context , params * ListToolsParams ) (* ListToolsResult , error ) {
1095- result , err := handleSend [* ListToolsResult ](ctx , methodListTools , newClientRequest (cs , orZero [* ListToolsParams ](params )))
1109+ if params == nil && cs .usesNewProtocol () {
1110+ params = & ListToolsParams {}
1111+ }
1112+ result , err := handleSend [* ListToolsResult ](ctx , methodListTools , newClientRequest (cs , orZero [Params ](params )))
10961113 if err != nil {
10971114 return nil , err
10981115 }
@@ -1115,44 +1132,56 @@ func (cs *ClientSession) CallTool(ctx context.Context, params *CallToolParams) (
11151132 if tool := cs .getCachedTool (params .Name ); tool != nil {
11161133 ctx = context .WithValue (ctx , toolContextKey , tool )
11171134 }
1118- return handleSend [* CallToolResult ](ctx , methodCallTool , newClientRequest (cs , orZero [* CallToolParams ](params )))
1135+ return handleSend [* CallToolResult ](ctx , methodCallTool , newClientRequest (cs , orZero [Params ](params )))
11191136}
11201137
11211138func (cs * ClientSession ) SetLoggingLevel (ctx context.Context , params * SetLoggingLevelParams ) error {
1122- _ , err := handleSend [* emptyResult ](ctx , methodSetLevel , newClientRequest (cs , orZero [* SetLoggingLevelParams ](params )))
1139+ _ , err := handleSend [* emptyResult ](ctx , methodSetLevel , newClientRequest (cs , orZero [Params ](params )))
11231140 return err
11241141}
11251142
11261143// ListResources lists the resources that are currently available on the server.
11271144func (cs * ClientSession ) ListResources (ctx context.Context , params * ListResourcesParams ) (* ListResourcesResult , error ) {
1128- return handleSend [* ListResourcesResult ](ctx , methodListResources , newClientRequest (cs , orZero [* ListResourcesParams ](params )))
1145+ if params == nil && cs .usesNewProtocol () {
1146+ params = & ListResourcesParams {}
1147+ }
1148+ return handleSend [* ListResourcesResult ](ctx , methodListResources , newClientRequest (cs , orZero [Params ](params )))
11291149}
11301150
11311151// ListResourceTemplates lists the resource templates that are currently available on the server.
11321152func (cs * ClientSession ) ListResourceTemplates (ctx context.Context , params * ListResourceTemplatesParams ) (* ListResourceTemplatesResult , error ) {
1133- return handleSend [* ListResourceTemplatesResult ](ctx , methodListResourceTemplates , newClientRequest (cs , orZero [* ListResourceTemplatesParams ](params )))
1153+ if params == nil && cs .usesNewProtocol () {
1154+ params = & ListResourceTemplatesParams {}
1155+ }
1156+ return handleSend [* ListResourceTemplatesResult ](ctx , methodListResourceTemplates , newClientRequest (cs , orZero [Params ](params )))
11341157}
11351158
11361159// ReadResource asks the server to read a resource and return its contents.
11371160func (cs * ClientSession ) ReadResource (ctx context.Context , params * ReadResourceParams ) (* ReadResourceResult , error ) {
1138- return handleSend [* ReadResourceResult ](ctx , methodReadResource , newClientRequest (cs , orZero [* ReadResourceParams ](params )))
1161+ if params == nil && cs .usesNewProtocol () {
1162+ params = & ReadResourceParams {}
1163+ }
1164+ return handleSend [* ReadResourceResult ](ctx , methodReadResource , newClientRequest (cs , orZero [Params ](params )))
11391165}
11401166
11411167func (cs * ClientSession ) Complete (ctx context.Context , params * CompleteParams ) (* CompleteResult , error ) {
1142- return handleSend [* CompleteResult ](ctx , methodComplete , newClientRequest (cs , orZero [* CompleteParams ](params )))
1168+ if params == nil && cs .usesNewProtocol () {
1169+ params = & CompleteParams {}
1170+ }
1171+ return handleSend [* CompleteResult ](ctx , methodComplete , newClientRequest (cs , orZero [Params ](params )))
11431172}
11441173
11451174// Subscribe sends a "resources/subscribe" request to the server, asking for
11461175// notifications when the specified resource changes.
11471176func (cs * ClientSession ) Subscribe (ctx context.Context , params * SubscribeParams ) error {
1148- _ , err := handleSend [* emptyResult ](ctx , methodSubscribe , newClientRequest (cs , orZero [* SubscribeParams ](params )))
1177+ _ , err := handleSend [* emptyResult ](ctx , methodSubscribe , newClientRequest (cs , orZero [Params ](params )))
11491178 return err
11501179}
11511180
11521181// Unsubscribe sends a "resources/unsubscribe" request to the server, cancelling
11531182// a previous subscription.
11541183func (cs * ClientSession ) Unsubscribe (ctx context.Context , params * UnsubscribeParams ) error {
1155- _ , err := handleSend [* emptyResult ](ctx , methodUnsubscribe , newClientRequest (cs , orZero [* UnsubscribeParams ](params )))
1184+ _ , err := handleSend [* emptyResult ](ctx , methodUnsubscribe , newClientRequest (cs , orZero [Params ](params )))
11561185 return err
11571186}
11581187
@@ -1224,7 +1253,10 @@ func (c *Client) callElicitationCompleteHandler(ctx context.Context, req *Elicit
12241253// This can be used if the client is performing a long-running task that was
12251254// initiated by the server.
12261255func (cs * ClientSession ) NotifyProgress (ctx context.Context , params * ProgressNotificationParams ) error {
1227- return handleNotify (ctx , notificationProgress , newClientRequest (cs , orZero [* ProgressNotificationParams ](params )))
1256+ if params == nil && cs .usesNewProtocol () {
1257+ params = & ProgressNotificationParams {}
1258+ }
1259+ return handleNotify (ctx , notificationProgress , newClientRequest (cs , orZero [Params ](params )))
12281260}
12291261
12301262// Tools provides an iterator for all tools available on the server,
0 commit comments