broods 0.44.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/account.d.ts +160 -22
- package/dist/account.js +1 -1
- package/dist/{chunk-dmax7s31.js → chunk-7e3meadv.js} +2 -2
- package/dist/{chunk-ee92fs0x.js → chunk-b3q14j68.js} +1 -1
- package/dist/{chunk-a3f2xzbr.js → chunk-bb3jfhv3.js} +1 -1
- package/dist/{chunk-t0fvmbkd.js → chunk-hdcy74kj.js} +3 -3
- package/dist/{chunk-qyq5kyz9.js → chunk-hxky9s3f.js} +1 -1
- package/dist/{chunk-g9yebag8.js → chunk-kjccsy1h.js} +1 -1
- package/dist/{chunk-naxtmb6t.js → chunk-n890pdvc.js} +6 -6
- package/dist/{chunk-dcjq5a2g.js → chunk-r86n05ec.js} +1 -1
- package/dist/chunk-sqt7qff6.js +1 -0
- package/dist/cli/index.js +64 -61
- package/dist/index.d.ts +226 -30
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-7ddy2nyy.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ce,Ee,me,q,he,ne,e,ze,re,oe,o,a,x,Te,l,n,t,d,c,C,k,s,p,r,u,H,A}from"./chunk-naxtmb6t.js";var{create:ul,defineProperty:fo,getOwnPropertyDescriptor:dl,getOwnPropertyNames:ml,getPrototypeOf:hl}=Object,pl=Object.prototype.hasOwnProperty,je=(m,h)=>()=>(h||m((h={exports:{}}).exports,h),h.exports),Ni=(m,h)=>{let f={};for(var g in m)fo(f,g,{get:m[g],enumerable:!0});if(h)fo(f,Symbol.toStringTag,{value:"Module"});return f},fl=(m,h,f,g)=>{if(h&&typeof h==="object"||typeof h==="function"){for(var S=ml(h),_=0,y=S.length,R;_<y;_++)if(R=S[_],!pl.call(m,R)&&R!==f)fo(m,R,{get:((v)=>h[v]).bind(null,R),enumerable:!(g=dl(h,R))||g.enumerable})}return m},go=(m,h,f)=>(f=m!=null?ul(hl(m)):{},fl(h||!m||!m.__esModule?fo(f,"default",{value:m,enumerable:!0}):f,m));var gl=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Ii=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Sl=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),_l=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Oi(m){return typeof m==="string"&&Ii.has(m.replace(/#$/,""))}function ki(m,h){if(!("$schema"in m)||typeof m.$schema!=="string")return"2020-12";let f=m.$schema.replace(/#$/,"");if(gl.has(f))return"2020-12";if(Ii.has(f))return"2019-09";if(Sl.has(f)||_l.has(f))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${m.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${h}`)}var Ai={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var Mi;(function(m){})(Mi||(Mi={}));function yl(m){return Ee(oe,m)}var za="2025-11-25";var Rn=[za,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],zn="io.modelcontextprotocol/related-task",Vt="io.modelcontextprotocol/protocolVersion",gr="io.modelcontextprotocol/clientInfo",jt="io.modelcontextprotocol/serverInfo",Dt="io.modelcontextprotocol/clientCapabilities",$a="io.modelcontextprotocol/subscriptionId",ca="io.modelcontextprotocol/logLevel";var Pa="2.0";var Lt=H(()=>c([e(),o(),a(),x(),s(e(),Lt),n(Lt)])),tt=s(e(),Lt),$n=n(Lt),Sr=c([e(),o().int()]),_r=e(),So=t({ttl:o().optional()}),_o=t({taskId:e()}),yr=d({progressToken:Sr.optional(),[zn]:_o.optional()}),dt=t({_meta:yr.optional()}),la=dt.extend({task:So.optional()}),at=t({method:e(),params:dt.loose().optional()}),ft=t({_meta:yr.optional()}),gt=t({method:e(),params:ft.loose().optional()}),vr=d({get[jt](){return Ta.optional().catch(void 0)}}),rt=d({_meta:vr.optional()}),Ut=c([e(),o().int()]),br=t({jsonrpc:r(Pa),id:Ut,...at.shape}).strict(),Rr=t({jsonrpc:r(Pa),...gt.shape}).strict(),Ea=t({jsonrpc:r(Pa),id:Ut,result:rt}).strict(),wa=t({jsonrpc:r(Pa),id:Ut.optional(),error:t({code:o().int(),message:e(),data:l().optional()})}).strict(),yo=c([br,Rr,Ea,wa]),Pn=c([Ea,wa]),zr=rt.strict(),vo=ft.extend({requestId:Ut.optional(),reason:e().optional()}),$r=gt.extend({method:r("notifications/cancelled"),params:vo}),bo=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:p(["light","dark"]).optional()}),Ht=t({icons:n(bo).optional()}),qt=t({name:e(),title:e().optional()}),Ta=qt.extend({...qt.shape,...Ht.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),zl=k(t({applyDefaults:a().optional()}),tt),$l=A((m)=>{if(m&&typeof m==="object"&&!Array.isArray(m)&&Object.keys(m).length===0)return{form:{}};return m},k(t({form:zl.optional(),url:tt.optional()}),tt.optional())),Ro=d({list:tt.optional(),cancel:tt.optional(),requests:d({sampling:d({createMessage:tt.optional()}).optional(),elicitation:d({create:tt.optional()}).optional()}).optional()}),zo=d({list:tt.optional(),cancel:tt.optional(),requests:d({tools:d({call:tt.optional()}).optional()}).optional()}),$o=t({experimental:s(e(),tt).optional(),sampling:t({context:tt.optional(),tools:tt.optional()}).optional(),elicitation:$l.optional(),roots:t({listChanged:a().optional()}).optional(),tasks:Ro.optional(),extensions:s(e(),tt).optional()}),Po=dt.extend({protocolVersion:e(),capabilities:$o,clientInfo:Ta}),Eo=at.extend({method:r("initialize"),params:Po}),Pr=t({experimental:s(e(),tt).optional(),logging:tt.optional(),completions:tt.optional(),prompts:t({listChanged:a().optional()}).optional(),resources:t({subscribe:a().optional(),listChanged:a().optional()}).optional(),tools:t({listChanged:a().optional()}).optional(),tasks:zo.optional(),extensions:s(e(),tt).optional()}),wo=rt.extend({protocolVersion:e(),capabilities:Pr,serverInfo:Ta,instructions:e().optional()}),To=gt.extend({method:r("notifications/initialized"),params:ft.optional()}),Co=at.extend({method:r("server/discover"),params:dt.optional()}),qo=rt.extend({supportedVersions:n(e()),capabilities:Pr,instructions:e().optional()}),Er=at.extend({method:r("ping"),params:dt.optional()}),jo=t({progress:o(),total:u(o()),message:u(e())}),No=t({...ft.shape,...jo.shape,progressToken:Sr}),wr=gt.extend({method:r("notifications/progress"),params:No}),Io=dt.extend({cursor:_r.optional()}),Ft=at.extend({params:Io.optional()}),xt=rt.extend({nextCursor:_r.optional()}),Tr=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),Cr=Tr.extend({text:e()}),En=e().refine((m)=>{try{return atob(m),!0}catch{return!1}},{message:"Invalid Base64 string"}),qr=Tr.extend({blob:En}),Kt=p(["user","assistant"]),Nt=t({audience:n(Kt).optional(),priority:o().min(0).max(1).optional(),lastModified:q({offset:!0}).optional()}),jr=t({...qt.shape,...Ht.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:Nt.optional(),_meta:u(d({}))}),Oo=t({...qt.shape,...Ht.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:Nt.optional(),_meta:u(d({}))}),ko=Ft.extend({method:r("resources/list")}),Mo=xt.extend({resources:n(jr)}),Ao=Ft.extend({method:r("resources/templates/list")}),Lo=xt.extend({resourceTemplates:n(Oo)}),Ca=dt.extend({uri:e()}),Vo=Ca,Do=at.extend({method:r("resources/read"),params:Vo}),Uo=rt.extend({contents:n(c([Cr,qr]))}),Ho=gt.extend({method:r("notifications/resources/list_changed"),params:ft.optional()}),Fo=Ca,xo=at.extend({method:r("resources/subscribe"),params:Fo}),Ko=Ca,Jo=at.extend({method:r("resources/unsubscribe"),params:Ko}),Nr=t({toolsListChanged:a().optional(),promptsListChanged:a().optional(),resourcesListChanged:a().optional(),resourceSubscriptions:n(e()).optional()}),Go=dt.extend({notifications:Nr}),Bo=at.extend({method:r("subscriptions/listen"),params:Go}),Yo=ft.extend({notifications:Nr}),Wo=gt.extend({method:r("notifications/subscriptions/acknowledged"),params:Yo}),Zo=vr.extend({[$a]:Ut}),Xo=rt.extend({_meta:Zo}),Qo=ft.extend({uri:e()}),es=gt.extend({method:r("notifications/resources/updated"),params:Qo}),ts=t({name:e(),description:u(e()),required:u(a())}),as=t({...qt.shape,...Ht.shape,description:u(e()),arguments:u(n(ts)),_meta:u(d({}))}),rs=Ft.extend({method:r("prompts/list")}),os=xt.extend({prompts:n(as)}),ss=dt.extend({name:e(),arguments:s(e(),e()).optional()}),ns=at.extend({method:r("prompts/get"),params:ss}),qa=t({type:r("text"),text:e(),annotations:Nt.optional(),_meta:s(e(),l()).optional()}),ja=t({type:r("image"),data:En,mimeType:e(),annotations:Nt.optional(),_meta:s(e(),l()).optional()}),Na=t({type:r("audio"),data:En,mimeType:e(),annotations:Nt.optional(),_meta:s(e(),l()).optional()}),is=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),cs=t({type:r("resource"),resource:c([Cr,qr]),annotations:Nt.optional(),_meta:s(e(),l()).optional()}),ls=jr.extend({type:r("resource_link")}),Ia=c([qa,ja,Na,ls,cs]),us=t({role:Kt,content:Ia}),ds=rt.extend({description:e().optional(),messages:n(us)}),ms=gt.extend({method:r("notifications/prompts/list_changed"),params:ft.optional()}),hs=t({title:e().optional(),readOnlyHint:a().optional(),destructiveHint:a().optional(),idempotentHint:a().optional(),openWorldHint:a().optional()}),ps=t({taskSupport:p(["required","optional","forbidden"]).optional()}),Ir=t({...qt.shape,...Ht.shape,description:e().optional(),inputSchema:t({type:r("object"),properties:s(e(),Lt).optional(),required:n(e()).optional()}).catchall(l()),outputSchema:d({$schema:e().optional()}).optional(),annotations:hs.optional(),execution:ps.optional(),_meta:s(e(),l()).optional()}),fs=Ft.extend({method:r("tools/list")}),gs=xt.extend({tools:n(Ir)}),Or=rt.extend({content:n(Ia).default([]),structuredContent:l().optional(),isError:a().optional()}),wn=Or.or(rt.extend({toolResult:l()})),Ss=la.extend({name:e(),arguments:s(e(),l()).optional()}),_s=at.extend({method:r("tools/call"),params:Ss}),ys=gt.extend({method:r("notifications/tools/list_changed"),params:ft.optional()}),Tn=t({autoRefresh:a().default(!0),debounceMs:o().int().nonnegative().default(300)}),Jt=p(["debug","info","notice","warning","error","critical","alert","emergency"]),vs=dt.extend({level:Jt}),bs=at.extend({method:r("logging/setLevel"),params:vs}),Rs=ft.extend({level:Jt,logger:e().optional(),data:l()}),zs=gt.extend({method:r("notifications/message"),params:Rs}),$s=t({name:e().optional()}),Ps=t({hints:n($s).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),Es=t({mode:p(["auto","required","none"]).optional()}),ws=t({type:r("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:n(Ia),structuredContent:l().optional(),isError:a().optional(),_meta:s(e(),l()).optional()}),Ts=C("type",[qa,ja,Na]),ia=C("type",[qa,ja,Na,is,ws]),Cs=t({role:Kt,content:c([ia,n(ia)]),_meta:s(e(),l()).optional()}),qs=la.extend({messages:n(Cs),modelPreferences:Ps.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:tt.optional(),tools:n(Ir).optional(),toolChoice:Es.optional()}),js=at.extend({method:r("sampling/createMessage"),params:qs}),Ns=rt.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens"]).or(e())),role:Kt,content:Ts}),Is=rt.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:Kt,content:c([ia,n(ia)])}),kr=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:a().optional()}),Oa=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),ka=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),Mr=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),Ar=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),Lr=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),Os=c([Mr,Ar]),Vr=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),Dr=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),ks=c([Vr,Dr]),Ms=c([Lr,Os,ks]),Ur=c([Ms,kr,Oa,ka]),Ma=la.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),Ur),required:n(e()).optional()}).catchall(l())}),As=la.extend({mode:r("url"),message:e(),elicitationId:e(),url:e().url()}),Ls=c([Ma,As]),Vs=at.extend({method:r("elicitation/create"),params:Ls}),Ds=ft.extend({elicitationId:e()}),Us=gt.extend({method:r("notifications/elicitation/complete"),params:Ds}),Hs=rt.extend({action:p(["accept","decline","cancel"]),content:A((m)=>m===null?void 0:m,s(e(),c([e(),o(),a(),n(e())])).optional())}),Fs=t({type:r("ref/resource"),uri:e()}),xs=t({type:r("ref/prompt"),name:e()}),Ks=dt.extend({ref:c([xs,Fs]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),Js=at.extend({method:r("completion/complete"),params:Ks}),Gs=rt.extend({completion:d({values:n(e()).max(100),total:u(o().int()),hasMore:u(a())})}),Bs=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),Ys=at.extend({method:r("roots/list"),params:dt.optional()}),Ws=rt.extend({roots:n(Bs)}),Zs=gt.extend({method:r("notifications/roots/list_changed"),params:ft.optional()}),Cn=d({ttl:o().optional(),pollInterval:o().optional()}),Xs=p(["working","input_required","completed","failed","cancelled"]),Gt=t({taskId:e(),status:Xs,ttl:c([o(),x()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:u(o()),statusMessage:u(e())}),qn=rt.extend({task:Gt}),Qs=ft.merge(Gt),jn=gt.extend({method:r("notifications/tasks/status"),params:Qs}),Nn=at.extend({method:r("tasks/get"),params:dt.extend({taskId:e()})}),In=rt.merge(Gt),On=at.extend({method:r("tasks/result"),params:dt.extend({taskId:e()})}),kn=rt.loose(),Mn=Ft.extend({method:r("tasks/list")}),An=xt.extend({tasks:n(Gt)}),Ln=at.extend({method:r("tasks/cancel"),params:dt.extend({taskId:e()})}),Vn=rt.merge(Gt),Dn=c([Er,Eo,Co,Js,bs,ns,rs,ko,Ao,Do,xo,Jo,Bo,_s,fs]),Un=c([$r,wr,To,Zs]),Hn=c([zr,Ns,Is,Hs,Ws]),Fn=c([Er,js,Vs,Ys]),xn=c([$r,wr,zs,es,Ho,ys,ms,Wo,Us]),Kn=c([zr,wo,qo,Gs,ds,os,Mo,Lo,Uo,Or,gs,Xo]),ut=re().superRefine((m,h)=>{if(!URL.canParse(m))return h.addIssue({code:Ai.custom,message:"URL must be parseable",fatal:!0}),Ce}).refine((m)=>{let h=new URL(m);return h.protocol!=="javascript:"&&h.protocol!=="data:"&&h.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Jn=d({resource:e().url(),authorization_servers:n(ut).optional(),jwks_uri:e().url().optional(),scopes_supported:n(e()).optional(),bearer_methods_supported:n(e()).optional(),resource_signing_alg_values_supported:n(e()).optional(),resource_name:e().optional(),resource_documentation:e().optional(),resource_policy_uri:e().url().optional(),resource_tos_uri:e().url().optional(),tls_client_certificate_bound_access_tokens:a().optional(),authorization_details_types_supported:n(e()).optional(),dpop_signing_alg_values_supported:n(e()).optional(),dpop_bound_access_tokens_required:a().optional()}),en=d({issuer:e(),authorization_endpoint:ut,token_endpoint:ut,registration_endpoint:ut.optional(),scopes_supported:n(e()).optional(),response_types_supported:n(e()),response_modes_supported:n(e()).optional(),grant_types_supported:n(e()).optional(),token_endpoint_auth_methods_supported:n(e()).optional(),token_endpoint_auth_signing_alg_values_supported:n(e()).optional(),service_documentation:ut.optional(),revocation_endpoint:ut.optional(),revocation_endpoint_auth_methods_supported:n(e()).optional(),revocation_endpoint_auth_signing_alg_values_supported:n(e()).optional(),introspection_endpoint:e().optional(),introspection_endpoint_auth_methods_supported:n(e()).optional(),introspection_endpoint_auth_signing_alg_values_supported:n(e()).optional(),code_challenge_methods_supported:n(e()).optional(),client_id_metadata_document_supported:a().optional(),authorization_response_iss_parameter_supported:a().optional().catch(void 0)}),tn=d({issuer:e(),authorization_endpoint:ut,token_endpoint:ut,userinfo_endpoint:ut.optional(),jwks_uri:ut,registration_endpoint:ut.optional(),scopes_supported:n(e()).optional(),response_types_supported:n(e()),response_modes_supported:n(e()).optional(),grant_types_supported:n(e()).optional(),acr_values_supported:n(e()).optional(),subject_types_supported:n(e()),id_token_signing_alg_values_supported:n(e()),id_token_encryption_alg_values_supported:n(e()).optional(),id_token_encryption_enc_values_supported:n(e()).optional(),userinfo_signing_alg_values_supported:n(e()).optional(),userinfo_encryption_alg_values_supported:n(e()).optional(),userinfo_encryption_enc_values_supported:n(e()).optional(),request_object_signing_alg_values_supported:n(e()).optional(),request_object_encryption_alg_values_supported:n(e()).optional(),request_object_encryption_enc_values_supported:n(e()).optional(),token_endpoint_auth_methods_supported:n(e()).optional(),token_endpoint_auth_signing_alg_values_supported:n(e()).optional(),display_values_supported:n(e()).optional(),claim_types_supported:n(e()).optional(),claims_supported:n(e()).optional(),service_documentation:e().optional(),claims_locales_supported:n(e()).optional(),ui_locales_supported:n(e()).optional(),claims_parameter_supported:a().optional(),request_parameter_supported:a().optional(),request_uri_parameter_supported:a().optional(),require_request_uri_registration:a().optional(),op_policy_uri:ut.optional(),op_tos_uri:ut.optional(),client_id_metadata_document_supported:a().optional(),authorization_response_iss_parameter_supported:a().optional().catch(void 0)}),Gn=t({...tn.shape,...en.pick({code_challenge_methods_supported:!0}).shape}),Bn=t({access_token:e(),id_token:e().optional(),token_type:e(),expires_in:yl().optional(),scope:e().optional(),refresh_token:e().optional()}).strip(),Yn=t({issued_token_type:r("urn:ietf:params:oauth:token-type:id-jag"),access_token:e(),token_type:e().optional(),expires_in:o().optional(),scope:e().optional()}).strip(),Wn=t({error:e(),error_description:e().optional(),error_uri:e().optional()}),bn=ut.optional().or(r("").transform(()=>{return})),an=t({redirect_uris:n(ut),token_endpoint_auth_method:e().optional(),grant_types:n(e()).optional(),response_types:n(e()).optional(),application_type:e().optional(),client_name:e().optional(),client_uri:ut.optional(),logo_uri:bn,scope:e().optional(),contacts:n(e()).optional(),tos_uri:bn,policy_uri:e().optional(),jwks_uri:ut.optional(),jwks:Te().optional(),software_id:e().optional(),software_version:e().optional(),software_statement:e().optional()}).strip(),rn=t({client_id:e(),client_secret:e().optional(),client_id_issued_at:o().optional(),client_secret_expires_at:o().optional()}).strip(),Zn=an.merge(rn),Xn=t({error:e(),error_description:e().optional()}).strip(),Qn=t({token:e(),token_type_hint:e().optional()}).strip();var ri=Symbol.for("mcp.sdk.errorBrands");function ii(m,h){let f=new Set,g=h;while(typeof g==="function"){let S=g.mcpBrand;if(Object.prototype.hasOwnProperty.call(g,"mcpBrand")&&typeof S==="string")f.add(S);g=Object.getPrototypeOf(g)}if(f.size===0)return;Object.defineProperty(m,ri,{value:f,enumerable:!1,configurable:!0})}function La(m,h){try{if(typeof h==="object"&&h!==null&&Object.prototype.hasOwnProperty.call(m,"mcpBrand")&&typeof m.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(h,ri)){let f=h[ri];if(f&&typeof f.has==="function"&&f.has(m.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(m,h)}var Xm=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](h){return La(this,h)}static isInstance(h){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return La(this,h)}constructor(h,f,g){super(f);this.code=h,this.errorUri=g,this.name="OAuthError",ii(this,new.target)}toResponseObject(){let h={error:this.code,error_description:this.message};if(this.errorUri)h.error_uri=this.errorUri;return h}static fromResponse(h){return new m(h.error,h.error_description??h.error,h.error_uri)}},Be=function(m){return m.NotConnected="NOT_CONNECTED",m.AlreadyConnected="ALREADY_CONNECTED",m.NotInitialized="NOT_INITIALIZED",m.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",m.RequestTimeout="REQUEST_TIMEOUT",m.ConnectionClosed="CONNECTION_CLOSED",m.SendFailed="SEND_FAILED",m.InvalidResult="INVALID_RESULT",m.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",m.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",m.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",m.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",m.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",m.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",m.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",m.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",m.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",m.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",m.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",m}({}),Ke=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](m){return La(this,m)}static isInstance(m){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return La(this,m)}constructor(m,h,f){super(h);this.code=m,this.data=f,this.name="SdkError",ii(this,new.target)}},Qm=class extends Ke{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(m,h,f){super(m,h,f);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function Li(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Ol(m,h,f){return m==="elicitation"&&h==="form"&&f.form===void 0&&f.url===void 0}function Zi(m){switch(m.method){case"elicitation/create":if(m.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let h=m.params;if(h!==void 0&&(h.tools!==void 0||h.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function ci(m,h){let f={};for(let[g,S]of Object.entries(m)){if(S===void 0)continue;let _=h===void 0?void 0:h[g];if(_===void 0){f[g]=S;continue}if(Li(S)&&Li(_)){let y={};for(let[R,v]of Object.entries(S))if(v!==void 0&&_[R]===void 0&&!Ol(g,R,_))y[R]=v;if(Object.keys(y).length>0)f[g]=y}}return Object.keys(f).length>0?f:void 0}var Xi="2026-07-28",P=[Xi];function Da(m){return m>=Xi}function Qi(m){return m.filter((h)=>!Da(h))}function li(m){return m.filter((h)=>Da(h))}function ec(m){let h=m.structuredContent;if(h===void 0)return m;if(!(typeof h!=="object"||h===null||Array.isArray(h)))return m;if(m.content?.some((f)=>f.type==="text")??!1)return m;return{...m,content:[...m.content??[],{type:"text",text:JSON.stringify(h)}]}}var tc=["task","inputRequests","requestState"];function ui(m){if(m===null||typeof m!=="object"||Array.isArray(m)||m.content!==void 0||tc.some((h)=>(h in m)))return m;return{...m,content:[]}}function kl(){let m=H(()=>c([e(),o(),a(),x(),s(e(),m),n(m)])),h=s(e(),m),f=c([e(),o().int()]),g=e(),S=t({ttl:o().optional()}),_=t({taskId:e()}),y=d({progressToken:f.optional(),"io.modelcontextprotocol/related-task":_.optional()}),R=t({_meta:y.optional()}),v=R.extend({task:S.optional()}),E=t({method:e(),params:R.loose().optional()}),O=t({_meta:y.optional()}),L=t({method:e(),params:O.loose().optional()}),G=d({_meta:y.optional()}),Y=c([e(),o().int()]),U=G.strict(),F=O.extend({requestId:Y.optional(),reason:e().optional()}),M=L.extend({method:r("notifications/cancelled"),params:F}),z=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:p(["light","dark"]).optional()}),D=t({icons:n(z).optional()}),w=t({name:e(),title:e().optional()}),K=w.extend({...w.shape,...D.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),W=k(t({applyDefaults:a().optional()}),h),V=A((pt)=>{if(pt&&typeof pt==="object"&&!Array.isArray(pt)&&Object.keys(pt).length===0)return{form:{}};return pt},k(t({form:W.optional(),url:h.optional()}),h.optional())),T=d({list:h.optional(),cancel:h.optional(),requests:d({sampling:d({createMessage:h.optional()}).optional(),elicitation:d({create:h.optional()}).optional()}).optional()}),Z=d({list:h.optional(),cancel:h.optional(),requests:d({tools:d({call:h.optional()}).optional()}).optional()}),ye=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:V.optional(),roots:t({listChanged:a().optional()}).optional(),tasks:T.optional(),extensions:s(e(),h).optional()}),Oe=R.extend({protocolVersion:e(),capabilities:ye,clientInfo:K}),Pe=E.extend({method:r("initialize"),params:Oe}),Ne=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:a().optional()}).optional(),resources:t({subscribe:a().optional(),listChanged:a().optional()}).optional(),tools:t({listChanged:a().optional()}).optional(),tasks:Z.optional(),extensions:s(e(),h).optional()}),Ae=G.extend({protocolVersion:e(),capabilities:Ne,serverInfo:K,instructions:e().optional()}),Me=L.extend({method:r("notifications/initialized"),params:O.optional()}),Ge=E.extend({method:r("ping"),params:R.optional()}),Qe=t({progress:o(),total:u(o()),message:u(e())}),Ze=t({...O.shape,...Qe.shape,progressToken:f}),nt=L.extend({method:r("notifications/progress"),params:Ze}),Ye=R.extend({cursor:g.optional()}),de=E.extend({params:Ye.optional()}),fe=G.extend({nextCursor:g.optional()}),Ie=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),J=Ie.extend({text:e()}),ie=e().refine((pt)=>{try{return atob(pt),!0}catch{return!1}},{message:"Invalid Base64 string"}),pe=Ie.extend({blob:ie}),ke=p(["user","assistant"]),Le=t({audience:n(ke).optional(),priority:o().min(0).max(1).optional(),lastModified:q({offset:!0}).optional()}),Je=t({...w.shape,...D.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:Le.optional(),_meta:u(d({}))}),He=t({...w.shape,...D.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:Le.optional(),_meta:u(d({}))}),Xe=de.extend({method:r("resources/list")}),St=fe.extend({resources:n(Je)}),se=de.extend({method:r("resources/templates/list")}),ge=fe.extend({resourceTemplates:n(He)}),qe=R.extend({uri:e()}),De=qe,Ue=E.extend({method:r("resources/read"),params:De}),xe=G.extend({contents:n(c([J,pe]))}),ot=L.extend({method:r("notifications/resources/list_changed"),params:O.optional()}),ct=qe,mt=E.extend({method:r("resources/subscribe"),params:ct}),it=qe,et=E.extend({method:r("resources/unsubscribe"),params:it}),Rt=O.extend({uri:e()}),lt=L.extend({method:r("notifications/resources/updated"),params:Rt}),Tt=t({name:e(),description:u(e()),required:u(a())}),$t=t({...w.shape,...D.shape,description:u(e()),arguments:u(n(Tt)),_meta:u(d({}))}),Ct=de.extend({method:r("prompts/list")}),It=fe.extend({prompts:n($t)}),Ot=R.extend({name:e(),arguments:s(e(),e()).optional()}),Zt=E.extend({method:r("prompts/get"),params:Ot}),Xt=t({type:r("text"),text:e(),annotations:Le.optional(),_meta:s(e(),l()).optional()}),Qt=t({type:r("image"),data:ie,mimeType:e(),annotations:Le.optional(),_meta:s(e(),l()).optional()}),ea=t({type:r("audio"),data:ie,mimeType:e(),annotations:Le.optional(),_meta:s(e(),l()).optional()}),Fa=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),kt=t({type:r("resource"),resource:c([J,pe]),annotations:Le.optional(),_meta:s(e(),l()).optional()}),xa=Je.extend({type:r("resource_link")}),zt=c([Xt,Qt,ea,xa,kt]),ma=t({role:ke,content:zt}),ha=G.extend({description:e().optional(),messages:n(ma)}),ta=L.extend({method:r("notifications/prompts/list_changed"),params:O.optional()}),Ka=t({title:e().optional(),readOnlyHint:a().optional(),destructiveHint:a().optional(),idempotentHint:a().optional(),openWorldHint:a().optional()}),pa=t({taskSupport:p(["required","optional","forbidden"]).optional()}),aa=t({...w.shape,...D.shape,description:e().optional(),inputSchema:t({type:r("object"),properties:s(e(),m).optional(),required:n(e()).optional()}).catchall(l()),outputSchema:t({type:r("object"),properties:s(e(),m).optional(),required:n(e()).optional()}).catchall(l()).optional(),annotations:Ka.optional(),execution:pa.optional(),_meta:s(e(),l()).optional()}),fa=de.extend({method:r("tools/list")}),ga=fe.extend({tools:n(aa)}),Sa=G.extend({content:n(zt),structuredContent:s(e(),l()).optional(),isError:a().optional()}),ht=v.extend({name:e(),arguments:s(e(),l()).optional()}),Ja=E.extend({method:r("tools/call"),params:ht}),Zr=L.extend({method:r("notifications/tools/list_changed"),params:O.optional()}),_a=p(["debug","info","notice","warning","error","critical","alert","emergency"]),Ga=R.extend({level:_a}),Ba=E.extend({method:r("logging/setLevel"),params:Ga}),Ya=O.extend({level:_a,logger:e().optional(),data:l()}),Wa=L.extend({method:r("notifications/message"),params:Ya}),Za=t({name:e().optional()}),Xa=t({hints:n(Za).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),Qa=t({mode:p(["auto","required","none"]).optional()}),Xr=t({type:r("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:n(zt),structuredContent:t({}).loose().optional(),isError:a().optional(),_meta:s(e(),l()).optional()}),er=C("type",[Xt,Qt,ea]),Mt=C("type",[Xt,Qt,ea,Fa,Xr]),tr=t({role:ke,content:c([Mt,n(Mt)]),_meta:s(e(),l()).optional()}),ar=v.extend({messages:n(tr),modelPreferences:Xa.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:h.optional(),tools:n(aa).optional(),toolChoice:Qa.optional()}),rr=E.extend({method:r("sampling/createMessage"),params:ar}),or=G.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens"]).or(e())),role:ke,content:er}),sr=G.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:ke,content:c([Mt,n(Mt)])}),nr=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:a().optional()}),ir=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),cr=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),lr=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),ur=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),dr=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),mr=c([lr,ur]),ra=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),oa=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),Qr=c([ra,oa]),eo=c([dr,mr,Qr]),vt=c([eo,nr,ir,cr]),bt=v.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),vt),required:n(e()).optional()}).catchall(l())}),hr=v.extend({mode:r("url"),message:e(),elicitationId:e(),url:e().url()}),Pt=c([bt,hr]),to=E.extend({method:r("elicitation/create"),params:Pt}),ao=O.extend({elicitationId:e()}),ro=L.extend({method:r("notifications/elicitation/complete"),params:ao}),oo=G.extend({action:p(["accept","decline","cancel"]),content:A((pt)=>pt===null?void 0:pt,s(e(),c([e(),o(),a(),n(e())])).optional())}),so=t({type:r("ref/resource"),uri:e()}),no=t({type:r("ref/prompt"),name:e()}),io=R.extend({ref:c([no,so]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),pr=E.extend({method:r("completion/complete"),params:io}),co=G.extend({completion:d({values:n(e()).max(100),total:u(o().int()),hasMore:u(a())})}),lo=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),ya=E.extend({method:r("roots/list"),params:R.optional()}),fr=G.extend({roots:n(lo)}),uo=L.extend({method:r("notifications/roots/list_changed"),params:O.optional()}),mo=d({ttl:o().optional(),pollInterval:o().optional()}),ho=p(["working","input_required","completed","failed","cancelled"]),At=t({taskId:e(),status:ho,ttl:c([o(),x()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:u(o()),statusMessage:u(e())}),_t=G.extend({task:At}),po=O.merge(At),sa=L.extend({method:r("notifications/tasks/status"),params:po}),va=E.extend({method:r("tasks/get"),params:R.extend({taskId:e()})}),ba=G.merge(At),Ra=E.extend({method:r("tasks/result"),params:R.extend({taskId:e()})}),vn=G.loose(),yt=de.extend({method:r("tasks/list")}),st=fe.extend({tasks:n(At)}),na=E.extend({method:r("tasks/cancel"),params:R.extend({taskId:e()})});return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:f,CursorSchema:g,TaskMetadataSchema:S,RelatedTaskMetadataSchema:_,RequestMetaSchema:y,BaseRequestParamsSchema:R,TaskAugmentedRequestParamsSchema:v,RequestSchema:E,NotificationsParamsSchema:O,NotificationSchema:L,ResultSchema:G,RequestIdSchema:Y,EmptyResultSchema:U,CancelledNotificationParamsSchema:F,CancelledNotificationSchema:M,IconSchema:z,IconsSchema:D,BaseMetadataSchema:w,ImplementationSchema:K,ClientTasksCapabilitySchema:T,ServerTasksCapabilitySchema:Z,ClientCapabilitiesSchema:ye,InitializeRequestParamsSchema:Oe,InitializeRequestSchema:Pe,ServerCapabilitiesSchema:Ne,InitializeResultSchema:Ae,InitializedNotificationSchema:Me,PingRequestSchema:Ge,ProgressSchema:Qe,ProgressNotificationParamsSchema:Ze,ProgressNotificationSchema:nt,PaginatedRequestParamsSchema:Ye,PaginatedRequestSchema:de,PaginatedResultSchema:fe,ResourceContentsSchema:Ie,TextResourceContentsSchema:J,BlobResourceContentsSchema:pe,RoleSchema:ke,AnnotationsSchema:Le,ResourceSchema:Je,ResourceTemplateSchema:He,ListResourcesRequestSchema:Xe,ListResourcesResultSchema:St,ListResourceTemplatesRequestSchema:se,ListResourceTemplatesResultSchema:ge,ResourceRequestParamsSchema:qe,ReadResourceRequestParamsSchema:De,ReadResourceRequestSchema:Ue,ReadResourceResultSchema:xe,ResourceListChangedNotificationSchema:ot,SubscribeRequestParamsSchema:ct,SubscribeRequestSchema:mt,UnsubscribeRequestParamsSchema:it,UnsubscribeRequestSchema:et,ResourceUpdatedNotificationParamsSchema:Rt,ResourceUpdatedNotificationSchema:lt,PromptArgumentSchema:Tt,PromptSchema:$t,ListPromptsRequestSchema:Ct,ListPromptsResultSchema:It,GetPromptRequestParamsSchema:Ot,GetPromptRequestSchema:Zt,TextContentSchema:Xt,ImageContentSchema:Qt,AudioContentSchema:ea,ToolUseContentSchema:Fa,EmbeddedResourceSchema:kt,ResourceLinkSchema:xa,ContentBlockSchema:zt,PromptMessageSchema:ma,GetPromptResultSchema:ha,PromptListChangedNotificationSchema:ta,ToolAnnotationsSchema:Ka,ToolExecutionSchema:pa,ToolSchema:aa,ListToolsRequestSchema:fa,ListToolsResultSchema:ga,CallToolResultSchema:Sa,CallToolRequestParamsSchema:ht,CallToolRequestSchema:Ja,ToolListChangedNotificationSchema:Zr,LoggingLevelSchema:_a,SetLevelRequestParamsSchema:Ga,SetLevelRequestSchema:Ba,LoggingMessageNotificationParamsSchema:Ya,LoggingMessageNotificationSchema:Wa,ModelHintSchema:Za,ModelPreferencesSchema:Xa,ToolChoiceSchema:Qa,ToolResultContentSchema:Xr,SamplingContentSchema:er,SamplingMessageContentBlockSchema:Mt,SamplingMessageSchema:tr,CreateMessageRequestParamsSchema:ar,CreateMessageRequestSchema:rr,CreateMessageResultSchema:or,CreateMessageResultWithToolsSchema:sr,BooleanSchemaSchema:nr,StringSchemaSchema:ir,NumberSchemaSchema:cr,UntitledSingleSelectEnumSchemaSchema:lr,TitledSingleSelectEnumSchemaSchema:ur,LegacyTitledEnumSchemaSchema:dr,SingleSelectEnumSchemaSchema:mr,UntitledMultiSelectEnumSchemaSchema:ra,TitledMultiSelectEnumSchemaSchema:oa,MultiSelectEnumSchemaSchema:Qr,EnumSchemaSchema:eo,PrimitiveSchemaDefinitionSchema:vt,ElicitRequestFormParamsSchema:bt,ElicitRequestURLParamsSchema:hr,ElicitRequestParamsSchema:Pt,ElicitRequestSchema:to,ElicitationCompleteNotificationParamsSchema:ao,ElicitationCompleteNotificationSchema:ro,ElicitResultSchema:oo,ResourceTemplateReferenceSchema:so,PromptReferenceSchema:no,CompleteRequestParamsSchema:io,CompleteRequestSchema:pr,CompleteResultSchema:co,RootSchema:lo,ListRootsRequestSchema:ya,ListRootsResultSchema:fr,RootsListChangedNotificationSchema:uo,TaskCreationParamsSchema:mo,TaskStatusSchema:ho,TaskSchema:At,CreateTaskResultSchema:_t,TaskStatusNotificationParamsSchema:po,TaskStatusNotificationSchema:sa,GetTaskRequestSchema:va,GetTaskResultSchema:ba,GetTaskPayloadRequestSchema:Ra,GetTaskPayloadResultSchema:vn,ListTasksRequestSchema:yt,ListTasksResultSchema:st,CancelTaskRequestSchema:na,CancelTaskResultSchema:G.merge(At),ClientRequestSchema:c([Ge,Pe,pr,Ba,Zt,Ct,Xe,se,Ue,mt,et,Ja,fa,va,Ra,yt,na]),ClientNotificationSchema:c([M,nt,Me,uo,sa]),ClientResultSchema:c([U,or,sr,oo,fr,ba,st,_t]),ServerRequestSchema:c([Ge,rr,to,ya,va,Ra,yt,na]),ServerNotificationSchema:c([M,nt,Wa,lt,ot,Zr,ta,sa,ro]),ServerResultSchema:c([U,Ae,co,ha,It,St,ge,xe,Sa,ga,ba,st,_t]),CallToolResultWireSchema:l().superRefine((pt,ll)=>{if(typeof pt!=="object"||pt===null||Array.isArray(pt)||pt.content!==void 0)return;for(let ji of tc)if(ji in pt){ll.addIssue({code:"custom",message:`content is required when the body carries '${ji}' — another result family cannot default into an empty tools/call success`});return}}).transform(ui).pipe(Sa)}}var Ml;function ac(){return Ml??=kl()}function rc(m){return m.type!=="object"}var Al=new Set(["const","enum","default","examples"]),Ll=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Vi(m){return m!==void 0&&!(typeof m==="string"&&m.startsWith("#"))}function Vl(m){let h=typeof m.$schema==="string"?m.$schema:void 0;if(Vi(m.$id))return{...h!==void 0&&{$schema:h},type:"object",properties:{result:m},required:["result"]};let f=Oi(m.$schema)&&m.$recursiveAnchor!==!0,g=(S,_)=>{if(Array.isArray(S))return S.map((v)=>g(v,!1));if(S===null||typeof S!=="object")return S;if(!_&&Vi(S.$id))return S;let y={},R=!1;for(let[v,E]of Object.entries(S))if(_)y[v]=g(E,!1);else if((v==="$ref"||v==="$dynamicRef")&&typeof E==="string")y[v]=E==="#"?"#/properties/result":E.startsWith("#/")?`#/properties/result${E.slice(1)}`:E;else if(v==="$recursiveRef"&&E==="#"&&f)R=!0;else if(Al.has(v))y[v]=E;else if(Ll.has(v))y[v]=g(E,!0);else y[v]=g(E,!1);if(R)if("$ref"in y)y.allOf=[...Array.isArray(y.allOf)?y.allOf:[],{$ref:"#/properties/result"}];else y.$ref="#/properties/result";return y};return{...h!==void 0&&{$schema:h},type:"object",properties:{result:g(m,!1)},required:["result"]}}var oc={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},sc={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Dl={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},on;function di(){if(on)return on;let m=ac();return on={requestSchemas:{ping:m.PingRequestSchema,initialize:m.InitializeRequestSchema,"completion/complete":m.CompleteRequestSchema,"logging/setLevel":m.SetLevelRequestSchema,"prompts/get":m.GetPromptRequestSchema,"prompts/list":m.ListPromptsRequestSchema,"resources/list":m.ListResourcesRequestSchema,"resources/templates/list":m.ListResourceTemplatesRequestSchema,"resources/read":m.ReadResourceRequestSchema,"resources/subscribe":m.SubscribeRequestSchema,"resources/unsubscribe":m.UnsubscribeRequestSchema,"tools/call":m.CallToolRequestSchema,"tools/list":m.ListToolsRequestSchema,"tasks/get":m.GetTaskRequestSchema,"tasks/result":m.GetTaskPayloadRequestSchema,"tasks/list":m.ListTasksRequestSchema,"tasks/cancel":m.CancelTaskRequestSchema,"sampling/createMessage":m.CreateMessageRequestSchema,"elicitation/create":m.ElicitRequestSchema,"roots/list":m.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":m.CancelledNotificationSchema,"notifications/progress":m.ProgressNotificationSchema,"notifications/initialized":m.InitializedNotificationSchema,"notifications/roots/list_changed":m.RootsListChangedNotificationSchema,"notifications/tasks/status":m.TaskStatusNotificationSchema,"notifications/message":m.LoggingMessageNotificationSchema,"notifications/resources/updated":m.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":m.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":m.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":m.PromptListChangedNotificationSchema,"notifications/elicitation/complete":m.ElicitationCompleteNotificationSchema},resultSchemas:{ping:m.EmptyResultSchema,initialize:m.InitializeResultSchema,"completion/complete":m.CompleteResultSchema,"logging/setLevel":m.EmptyResultSchema,"prompts/get":m.GetPromptResultSchema,"prompts/list":m.ListPromptsResultSchema,"resources/list":m.ListResourcesResultSchema,"resources/templates/list":m.ListResourceTemplatesResultSchema,"resources/read":m.ReadResourceResultSchema,"resources/subscribe":m.EmptyResultSchema,"resources/unsubscribe":m.EmptyResultSchema,"tools/call":m.CallToolResultWireSchema,"tools/list":m.ListToolsResultSchema,"sampling/createMessage":m.CreateMessageResultWithToolsSchema,"elicitation/create":m.ElicitResultSchema,"roots/list":m.ListRootsResultSchema}},on}function nc(m){return Object.prototype.hasOwnProperty.call(oc,m)}function ic(m){return Object.prototype.hasOwnProperty.call(sc,m)}function Ul(m){return Object.prototype.hasOwnProperty.call(Dl,m)}function Hl(m){return Ul(m)?di().resultSchemas[m]:void 0}function Fl(m){return nc(m)?di().requestSchemas[m]:void 0}function xl(m){return ic(m)?di().notificationSchemas[m]:void 0}var eh=Object.keys(oc),th=Object.keys(sc);function oi(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function sn(m,h){if(m===void 0)return{ok:!1,reason:"not-in-era"};let f=m.safeParse(h);return f.success?{ok:!0,value:f.data}:{ok:!1,reason:"invalid",message:String(f.error)}}var Di={ok:!1,reason:"not-in-era"};function Ui(m){return oi(m)&&oi(m.outputSchema)&&rc(m.outputSchema)}function Hi(m){return m}var mi={era:"2025-11-25",hasRequestMethod:nc,hasNotificationMethod:ic,validateRequest:(m,h)=>sn(Fl(m),h),validateResult:(m,h)=>sn(Hl(m),h),validateNotification:(m,h)=>sn(xl(m),h),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Di,validateInputResponse:()=>Di,samplingResultVariant:(m,h)=>{let f=ac();return sn(m?f.CreateMessageResultWithToolsSchema:f.CreateMessageResultSchema,h)},outboundEnvelope:(m)=>{return},validateEnvelopeMeta:(m)=>[],projectCallToolResult(m,h){let f=ec(m),g=f.structuredContent;if(g===void 0)return f;let S=typeof g!=="object"||g===null||Array.isArray(g),_=h!==void 0&&rc(h);if(!S&&!_)return f;return{...f,structuredContent:{result:g}}},decodeResult(m,h){if(oi(h)&&"resultType"in h){let f={...h};return delete f.resultType,{kind:"complete",result:Hi(f)}}return{kind:"complete",result:Hi(h)}},encodeResult(m,h){if(m!=="tools/list")return h;let f=h.tools;if(!Array.isArray(f)||!f.some((g)=>Ui(g)))return h;return{...h,tools:f.map((g)=>Ui(g)?{...g,outputSchema:Vl(g.outputSchema)}:g)}},encodeErrorCode:(m)=>m===-32002?-32602:m,checkInboundEnvelope:(m)=>{return}};function Kl(){let m=H(()=>c([e(),o(),a(),x(),s(e(),m),n(m)])),h=s(e(),m),f=c([e(),o().int()]),g=e(),S=c([e(),o().int()]),_=p(["user","assistant"]),y=p(["debug","info","notice","warning","error","critical","alert","emergency"]),R=e().refine((st)=>{try{return atob(st),!0}catch{return!1}},{message:"Invalid Base64 string"}),v=t({ttl:o().optional()}),E=t({taskId:e()}),O=d({progressToken:f.optional(),"io.modelcontextprotocol/related-task":E.optional()}),L=t({_meta:O.optional()}),G=L.extend({task:v.optional()}),Y=t({_meta:O.optional()}),U=t({method:e(),params:Y.loose().optional()}),F=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:p(["light","dark"]).optional()}),M=t({icons:n(F).optional()}),z=t({name:e(),title:e().optional()}),D=z.extend({...z.shape,...M.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),w=k(t({applyDefaults:a().optional()}),h),K=A((st)=>{if(st&&typeof st==="object"&&!Array.isArray(st)&&Object.keys(st).length===0)return{form:{}};return st},k(t({form:w.optional(),url:h.optional()}),h.optional())),W=d({list:h.optional(),cancel:h.optional(),requests:d({sampling:d({createMessage:h.optional()}).optional(),elicitation:d({create:h.optional()}).optional()}).optional()}),V=d({list:h.optional(),cancel:h.optional(),requests:d({tools:d({call:h.optional()}).optional()}).optional()}),T=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:K.optional(),roots:t({listChanged:a().optional()}).optional(),tasks:W.optional(),extensions:s(e(),h).optional()}),Z=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:a().optional()}).optional(),resources:t({subscribe:a().optional(),listChanged:a().optional()}).optional(),tools:t({listChanged:a().optional()}).optional(),tasks:V.optional(),extensions:s(e(),h).optional()}),ye=t({progress:o(),total:u(o()),message:u(e())}),Oe=t({...Y.shape,...ye.shape,progressToken:f}),Pe=U.extend({method:r("notifications/progress"),params:Oe}),Ne=Y.extend({level:y,logger:e().optional(),data:l()}),Ae=U.extend({method:r("notifications/message"),params:Ne}),Me=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),Ge=Me.extend({text:e()}),Qe=Me.extend({blob:R}),Ze=t({audience:n(_).optional(),priority:o().min(0).max(1).optional(),lastModified:q({offset:!0}).optional()}),nt=t({...z.shape,...M.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:Ze.optional(),_meta:u(d({}))}),Ye=t({...z.shape,...M.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:Ze.optional(),_meta:u(d({}))}),de=U.extend({method:r("notifications/resources/list_changed"),params:Y.optional()}),fe=Y.extend({uri:e()}),Ie=U.extend({method:r("notifications/resources/updated"),params:fe}),J=t({name:e(),description:u(e()),required:u(a())}),ie=t({...z.shape,...M.shape,description:u(e()),arguments:u(n(J)),_meta:u(d({}))}),pe=U.extend({method:r("notifications/prompts/list_changed"),params:Y.optional()}),ke=t({type:r("text"),text:e(),annotations:Ze.optional(),_meta:s(e(),l()).optional()}),Le=t({type:r("image"),data:R,mimeType:e(),annotations:Ze.optional(),_meta:s(e(),l()).optional()}),Je=t({type:r("audio"),data:R,mimeType:e(),annotations:Ze.optional(),_meta:s(e(),l()).optional()}),He=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),Xe=t({type:r("resource"),resource:c([Ge,Qe]),annotations:Ze.optional(),_meta:s(e(),l()).optional()}),St=nt.extend({type:r("resource_link")}),se=c([ke,Le,Je,St,Xe]),ge=t({role:_,content:se}),qe=t({title:e().optional(),readOnlyHint:a().optional(),destructiveHint:a().optional(),idempotentHint:a().optional(),openWorldHint:a().optional()}),De=U.extend({method:r("notifications/tools/list_changed"),params:Y.optional()}),Ue=t({name:e().optional()}),xe=t({hints:n(Ue).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),ot=t({mode:p(["auto","required","none"]).optional()}),ct=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:a().optional()}),mt=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),it=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),et=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),Rt=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),lt=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),Tt=c([et,Rt]),$t=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),Ct=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),It=c([$t,Ct]),Ot=c([lt,Tt,It]),Zt=c([Ot,ct,mt,it]),Xt=G.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),Zt),required:n(e()).optional()}).catchall(l())}),Qt=t({type:r("ref/resource"),uri:e()}),ea=t({type:r("ref/prompt"),name:e()}),Fa=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),kt=T.shape,xa=t({experimental:kt.experimental,sampling:kt.sampling,elicitation:kt.elicitation,roots:kt.roots,extensions:kt.extensions}),zt=Z.shape,ma=t({experimental:zt.experimental,logging:zt.logging,completions:zt.completions,prompts:zt.prompts,resources:zt.resources,tools:zt.tools,extensions:zt.extensions}),ha=d({progressToken:f.optional(),[Vt]:e(),[gr]:D.optional(),[Dt]:xa,[ca]:y.optional()}),ta=t({...z.shape,...M.shape,description:e().optional(),inputSchema:d({$schema:e().optional(),type:r("object")}),outputSchema:d({$schema:e().optional()}).optional(),annotations:qe.optional(),_meta:s(e(),l()).optional()}),Ka=t({type:r("tool_result"),toolUseId:e(),content:n(se),structuredContent:l().optional(),isError:a().optional(),_meta:s(e(),l()).optional()}),pa=c([ke,Le,Je,He,Ka]),aa=t({role:_,content:c([pa,n(pa)]),_meta:s(e(),l()).optional()}),fa=e(),ga=d({[jt]:D.optional().catch(void 0)}),Sa=ga.optional();function ht(st){return d({_meta:Sa,resultType:fa.default("complete"),...st})}let Ja=ht({}),Zr=ht({nextCursor:g.optional()}),_a=ht({content:n(se),structuredContent:l().optional(),isError:a().optional()}),Ga=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),tools:n(ta),nextCursor:g.optional()}),Ba=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),prompts:n(ie),nextCursor:g.optional()}),Ya=ht({description:e().optional(),messages:n(ge)}),Wa=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resources:n(nt),nextCursor:g.optional()}),Za=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resourceTemplates:n(Ye),nextCursor:g.optional()}),Xa=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),contents:n(c([Ge,Qe]))}),Qa=ht({completion:t({values:n(e()).max(100),total:o().int().optional(),hasMore:a().optional()}).loose()}),Xr=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"])}),er=ht({ttlMs:o().int().min(0).catch(0),cacheScope:p(["public","private"]).catch("private"),supportedVersions:n(e()),capabilities:ma,instructions:e().optional()}),Mt=t({messages:n(aa),modelPreferences:xe.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:h.optional(),tools:n(ta).optional(),toolChoice:ot.optional()}),tr=t({method:r("sampling/createMessage"),params:Mt}),ar=t({method:r("roots/list"),params:t({_meta:s(e(),l()).optional()}).optional()}),rr=t({...aa.shape,model:e(),stopReason:e().optional()}),or=t({roots:n(Fa)}),sr=t({action:p(["accept","decline","cancel"]),content:s(e(),c([e(),o(),a(),n(e())])).optional()}),nr=t({mode:r("url"),message:e(),url:e().url()}),ir=c([Xt,nr]),cr=t({method:r("elicitation/create"),params:ir}),lr=c([tr,ar,cr]),ur=c([rr,or,sr]),dr=s(e(),lr),mr=s(e(),ur),ra=ht({inputRequests:dr.optional(),requestState:e().optional()}),oa={inputResponses:mr.optional(),requestState:e().optional()},Qr=t({_meta:ha,...oa}),eo=d({progressToken:f.optional()});function vt(st,na){return t({method:r(st),params:t({_meta:ha,...na})})}function bt(st,na){return t({method:r(st),params:t({_meta:eo.optional(),...na}).optional()})}let hr={name:e(),arguments:s(e(),l()).optional(),...oa},Pt={cursor:g.optional()},to=vt("tools/call",hr),ao=vt("tools/list",Pt),ro=vt("prompts/list",Pt),oo=vt("prompts/get",{name:e(),arguments:s(e(),e()).optional(),...oa}),so=vt("resources/list",Pt),no=vt("resources/templates/list",Pt),io=vt("resources/read",{uri:e(),...oa}),pr={ref:c([ea,Qt]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()},co=vt("completion/complete",pr),lo=vt("server/discover",{}),ya=t({toolsListChanged:a().optional(),promptsListChanged:a().optional(),resourcesListChanged:a().optional(),resourceSubscriptions:n(e()).optional()}),fr={notifications:ya},uo=vt("subscriptions/listen",fr),mo=ga.extend({"io.modelcontextprotocol/subscriptionId":S}),ho=d({_meta:mo,resultType:fa.default("complete")}),At={"tools/call":bt("tools/call",hr),"tools/list":bt("tools/list",Pt),"prompts/get":bt("prompts/get",{name:e(),arguments:s(e(),e()).optional()}),"prompts/list":bt("prompts/list",Pt),"resources/list":bt("resources/list",Pt),"resources/templates/list":bt("resources/templates/list",Pt),"resources/read":bt("resources/read",{uri:e()}),"completion/complete":bt("completion/complete",pr),"server/discover":bt("server/discover",{}),"subscriptions/listen":bt("subscriptions/listen",fr)};function _t(st){return d({_meta:Sa,...st})}let po={"tools/call":_t({content:n(se),structuredContent:l().optional(),isError:a().optional()}),"tools/list":_t({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),tools:n(ta),nextCursor:g.optional()}),"prompts/get":_t({description:e().optional(),messages:n(ge)}),"prompts/list":_t({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),prompts:n(ie),nextCursor:g.optional()}),"resources/list":_t({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resources:n(nt),nextCursor:g.optional()}),"resources/templates/list":_t({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resourceTemplates:n(Ye),nextCursor:g.optional()}),"resources/read":_t({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),contents:n(c([Ge,Qe]))}),"completion/complete":_t({completion:t({values:n(e()).max(100),total:o().int().optional(),hasMore:a().optional()}).loose()}),"server/discover":_t({ttlMs:o().int().min(0).catch(0),cacheScope:p(["public","private"]).catch("private"),supportedVersions:n(e()),capabilities:ma,instructions:e().optional()}),"subscriptions/listen":_t({})},sa=d({"io.modelcontextprotocol/subscriptionId":S.optional()}),va=t({method:r("notifications/subscriptions/acknowledged"),params:t({_meta:sa.optional(),notifications:ya})}),ba=t({_meta:sa.optional(),requestId:S,reason:e().optional()}),Ra=t({method:r("notifications/cancelled"),params:ba}),vn={"notifications/cancelled":Ra,"notifications/progress":Pe,"notifications/message":Ae,"notifications/resources/updated":Ie,"notifications/resources/list_changed":de,"notifications/tools/list_changed":De,"notifications/prompts/list_changed":pe,"notifications/subscriptions/acknowledged":va},yt=(st)=>t({jsonrpc:r("2.0"),id:c([e(),o().int()]),result:st}).strict();return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:f,CursorSchema:g,RequestIdSchema:S,RoleSchema:_,LoggingLevelSchema:y,TaskMetadataSchema:v,RelatedTaskMetadataSchema:E,RequestMetaSchema:O,BaseRequestParamsSchema:L,TaskAugmentedRequestParamsSchema:G,NotificationsParamsSchema:Y,NotificationSchema:U,IconSchema:F,IconsSchema:M,BaseMetadataSchema:z,ImplementationSchema:D,ClientTasksCapabilitySchema:W,ServerTasksCapabilitySchema:V,ClientCapabilitiesSchema:T,ServerCapabilitiesSchema:Z,ProgressSchema:ye,ProgressNotificationParamsSchema:Oe,ProgressNotificationSchema:Pe,LoggingMessageNotificationParamsSchema:Ne,LoggingMessageNotificationSchema:Ae,ResourceContentsSchema:Me,TextResourceContentsSchema:Ge,BlobResourceContentsSchema:Qe,AnnotationsSchema:Ze,ResourceSchema:nt,ResourceTemplateSchema:Ye,ResourceListChangedNotificationSchema:de,ResourceUpdatedNotificationParamsSchema:fe,ResourceUpdatedNotificationSchema:Ie,PromptArgumentSchema:J,PromptSchema:ie,PromptListChangedNotificationSchema:pe,TextContentSchema:ke,ImageContentSchema:Le,AudioContentSchema:Je,ToolUseContentSchema:He,EmbeddedResourceSchema:Xe,ResourceLinkSchema:St,ContentBlockSchema:se,PromptMessageSchema:ge,ToolAnnotationsSchema:qe,ToolListChangedNotificationSchema:De,ModelHintSchema:Ue,ModelPreferencesSchema:xe,ToolChoiceSchema:ot,BooleanSchemaSchema:ct,StringSchemaSchema:mt,NumberSchemaSchema:it,UntitledSingleSelectEnumSchemaSchema:et,TitledSingleSelectEnumSchemaSchema:Rt,LegacyTitledEnumSchemaSchema:lt,SingleSelectEnumSchemaSchema:Tt,UntitledMultiSelectEnumSchemaSchema:$t,TitledMultiSelectEnumSchemaSchema:Ct,MultiSelectEnumSchemaSchema:It,EnumSchemaSchema:Ot,PrimitiveSchemaDefinitionSchema:Zt,ElicitRequestFormParamsSchema:Xt,ResourceTemplateReferenceSchema:Qt,PromptReferenceSchema:ea,RootSchema:Fa,ClientCapabilities2026Schema:xa,ServerCapabilities2026Schema:ma,RequestMetaEnvelopeSchema:ha,ToolSchema:ta,ToolResultContentSchema:Ka,SamplingMessageContentBlockSchema:pa,SamplingMessageSchema:aa,ResultTypeSchema:fa,ResultMetaSchema:ga,ResultSchema:Ja,PaginatedResultSchema:Zr,CallToolResultSchema:_a,ListToolsResultSchema:Ga,ListPromptsResultSchema:Ba,GetPromptResultSchema:Ya,ListResourcesResultSchema:Wa,ListResourceTemplatesResultSchema:Za,ReadResourceResultSchema:Xa,CompleteResultSchema:Qa,CacheableResultSchema:Xr,DiscoverResultSchema:er,CreateMessageRequestParamsSchema:Mt,CreateMessageRequestSchema:tr,ListRootsRequestSchema:ar,CreateMessageResultSchema:rr,ListRootsResultSchema:or,ElicitResultSchema:sr,ElicitRequestURLParamsSchema:nr,ElicitRequestParamsSchema:ir,ElicitRequestSchema:cr,InputRequestSchema:lr,InputResponseSchema:ur,InputRequestsSchema:dr,InputResponsesSchema:mr,InputRequiredResultSchema:ra,InputResponseRequestParamsSchema:Qr,CallToolRequestSchema:to,ListToolsRequestSchema:ao,ListPromptsRequestSchema:ro,GetPromptRequestSchema:oo,ListResourcesRequestSchema:so,ListResourceTemplatesRequestSchema:no,ReadResourceRequestSchema:io,CompleteRequestSchema:co,DiscoverRequestSchema:lo,SubscriptionFilterSchema:ya,SubscriptionsListenRequestSchema:uo,SubscriptionsListenResultMetaSchema:mo,SubscriptionsListenResultSchema:ho,dispatchRequestSchemas:At,dispatchResultSchemas:po,NotificationMetaSchema:sa,SubscriptionsAcknowledgedNotificationSchema:va,CancelledNotificationParamsSchema:ba,CancelledNotificationSchema:Ra,notificationSchemas2026:vn,JSONRPCResultResponseSchema:yt(Ja),CallToolResultResponseSchema:yt(c([_a,ra])),ListToolsResultResponseSchema:yt(Ga),ListPromptsResultResponseSchema:yt(Ba),GetPromptResultResponseSchema:yt(c([Ya,ra])),ListResourcesResultResponseSchema:yt(Wa),ListResourceTemplatesResultResponseSchema:yt(Za),ReadResourceResultResponseSchema:yt(c([Xa,ra])),CompleteResultResponseSchema:yt(Qa),DiscoverResultResponseSchema:yt(er)}}var Jl;function da(){return Jl??=Kl()}var Gl=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function Bl(m){return Gl.includes(m)}var Aa=Symbol("modelcontextprotocol.resultCacheHintFallback");function mn(m,h){if(h===void 0)return m;let f=m[Aa];if(f===void 0)return{...m,[Aa]:h};let g={},S=f.ttlMs??h.ttlMs;if(S!==void 0)g.ttlMs=S;let _=f.cacheScope??h.cacheScope;if(_!==void 0)g.cacheScope=_;return{...m,[Aa]:g}}function Yl(m){return m[Aa]}function hi(m){return typeof m==="number"&&Number.isSafeInteger(m)&&m>=0}function pi(m){return m==="public"||m==="private"}function fi(m,h){if(m.ttlMs!==void 0&&!hi(m.ttlMs))throw RangeError(`Invalid cache hint for ${h}: ttlMs must be a non-negative safe integer (got ${String(m.ttlMs)})`);if(m.cacheScope!==void 0&&!pi(m.cacheScope))throw RangeError(`Invalid cache hint for ${h}: cacheScope must be 'public' or 'private' (got ${String(m.cacheScope)})`)}var i=function(m){return m[m.ParseError=-32700]="ParseError",m[m.InvalidRequest=-32600]="InvalidRequest",m[m.MethodNotFound=-32601]="MethodNotFound",m[m.InvalidParams=-32602]="InvalidParams",m[m.InternalError=-32603]="InternalError",m[m.ResourceNotFound=-32002]="ResourceNotFound",m[m.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",m[m.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",m[m.UrlElicitationRequired=-32042]="UrlElicitationRequired",m}({}),Ve=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](h){return La(this,h)}static isInstance(h){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return La(this,h)}constructor(h,f,g){super(f);this.code=h,this.data=g,this.name="ProtocolError",ii(this,new.target)}static fromError(h,f,g){if(h===i.UrlElicitationRequired&&g){let S=g;if(S.elicitations)return new Wl(S.elicitations,f)}if(h===i.UnsupportedProtocolVersion&&g){let S=g;if(Array.isArray(S.supported)&&typeof S.requested==="string")return new B({supported:S.supported,requested:S.requested},f)}if(h===i.InvalidParams||h===i.ResourceNotFound){let S=g;if(typeof S?.uri==="string"&&(h===i.ResourceNotFound||Object.keys(S).length===1))return new gi(S.uri,f)}if(h===i.MissingRequiredClientCapability&&g){let S=g;if(S.requiredCapabilities!==null&&typeof S.requiredCapabilities==="object"&&!Array.isArray(S.requiredCapabilities))return new Si({requiredCapabilities:S.requiredCapabilities},f)}return new m(h,f,g)}},gi=class extends Ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(m,h=`Resource not found: ${m}`){super(i.InvalidParams,h,{uri:m})}get uri(){return this.data.uri}},Wl=class extends Ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(m,h=`URL elicitation${m.length>1?"s":""} required`){super(i.UrlElicitationRequired,h,{elicitations:m})}get elicitations(){return this.data?.elicitations??[]}},B=class extends Ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(m,h=`Unsupported protocol version: ${m.requested}`){super(i.UnsupportedProtocolVersion,h,m)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Si=class extends Ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(m,h=`Missing required client capabilities: ${Object.keys(m.requiredCapabilities).join(", ")}`){super(i.MissingRequiredClientCapability,h,m)}get requiredCapabilities(){return this.data.requiredCapabilities}},Zl=0,Xl="private",Ql=["tools/call","prompts/get","resources/read"];function eu(m,h){let f=h.resultType;if(f===void 0)return{...h,resultType:"complete"};if(f==="complete")return h;if(Ql.includes(m))return h;throw new Ve(i.InternalError,`Handler for ${m} returned resultType '${String(f)}', but results of ${m} only support 'complete' on protocol revision 2026-07-28`)}function tu(m,h){let f=Yl(h);if(h.resultType!=="complete"||!Bl(m))return f===void 0?h:nu(h);let g=h,S=hi(g.ttlMs)?g.ttlMs:ou(f),_=pi(g.cacheScope)?g.cacheScope:su(f),y={...g,ttlMs:S,cacheScope:_};return delete y[Aa],y}function au(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function ru(m,h){if(h===void 0)return m;let f=m._meta;if(f===void 0)return{...m,_meta:{[jt]:h}};if(!au(f))return m;if(f[jt]!==void 0)return m;return{...m,_meta:{...f,[jt]:h}}}function ou(m){return m!==void 0&&hi(m.ttlMs)?m.ttlMs:Zl}function su(m){return m!==void 0&&pi(m.cacheScope)?m.cacheScope:Xl}function nu(m){let h={...m};return delete h[Aa],h}var iu=["elicitation/create","sampling/createMessage","roots/list"],nn;function cc(){if(nn)return nn;let m=da();return nn={request:{"elicitation/create":t({method:r("elicitation/create"),params:m.ElicitRequestParamsSchema}),"sampling/createMessage":t({method:r("sampling/createMessage"),params:m.CreateMessageRequestParamsSchema}),"roots/list":t({method:r("roots/list"),params:d({}).optional()})},response:{"elicitation/create":m.ElicitResultSchema,"sampling/createMessage":m.CreateMessageResultSchema,"roots/list":m.ListRootsResultSchema}},nn}function lc(m){return iu.includes(m)}function ei(m){return lc(m)?cc().request[m]:void 0}function cu(m){return lc(m)?cc().response[m]:void 0}var _i={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},uc={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function dc(m){return Object.prototype.hasOwnProperty.call(_i,m)}function mc(m){return Object.prototype.hasOwnProperty.call(uc,m)}function lu(m){return Object.prototype.hasOwnProperty.call(_i,m)}function uu(m){return dc(m)?da().dispatchRequestSchemas[m]:void 0}function du(m){return lu(m)?da().dispatchResultSchemas[m]:void 0}function mu(m){return mc(m)?da().notificationSchemas2026[m]:void 0}var ah=Object.keys(_i),rh=Object.keys(uc);function xr(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Hr(m,h){if(m===void 0)return{ok:!1,reason:"not-in-era"};let f=m.safeParse(h);return f.success?{ok:!0,value:f.data}:{ok:!1,reason:"invalid",message:String(f.error)}}var hu={ok:!1,reason:"not-in-era"},pu=[Vt,Dt];function fu(m,h){let f=h,g=!1,S=()=>{if(!g)f={...f},g=!0;return f},_=h.tools;if(m==="tools/list"&&Array.isArray(_)&&_.some((R)=>xr(R)&&("execution"in R)))S().tools=_.map((R)=>{if(!xr(R)||!("execution"in R))return R;let v={...R};return delete v.execution,v});let y=h.capabilities;if(xr(y)&&"tasks"in y){let R={...y};delete R.tasks,S().capabilities=R}return f}var yi={era:"2026-07-28",hasRequestMethod:dc,hasNotificationMethod:mc,hasInputRequestMethod:(m)=>ei(m)!==void 0,validateRequest:(m,h)=>Hr(uu(m),h),validateResult:(m,h)=>Hr(du(m),h),validateNotification:(m,h)=>Hr(mu(m),h),validateInputRequest:(m,h)=>Hr(ei(m),h),validateInputResponse:(m,h)=>Hr(cu(m),h),samplingResultVariant:()=>hu,outboundEnvelope(m){return{[Vt]:m.protocolVersion,[gr]:m.clientInfo,[Dt]:m.clientCapabilities,...m.logLevel!==void 0&&{[ca]:m.logLevel}}},validateEnvelopeMeta(m){let h=[];for(let g of pu)if(!(g in m))h.push({key:g,problem:"missing"});let f=da().RequestMetaEnvelopeSchema.safeParse(m);if(!f.success)for(let g of f.error.issues){let S=g.path.map(String),_=S.length>0?S.join("."):"_meta";if(S.length===1&&h.some((y)=>y.key===_&&y.problem==="missing"))continue;h.push({key:_,problem:g.message})}return h},projectCallToolResult:(m)=>ec(m),inputRequestSchema:ei,decodeResult(m,h){if(!xr(h))return{kind:"invalid",error:new Ke(Be.InvalidResult,`Invalid result for ${m}: not an object`,{method:m})};let f=h.resultType;if(f===void 0)return{kind:"invalid",error:new Ke(Be.InvalidResult,`Invalid result for ${m}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:m,violation:"missing-resultType"})};if(typeof f!=="string")return{kind:"invalid",error:new Ke(Be.InvalidResult,`Invalid result for ${m}: non-string resultType`,{method:m,resultType:f})};if(f==="input_required"){let y=h.inputRequests,R=xr(y)?y:{},v=h.requestState;if(Object.keys(R).length===0&&typeof v!=="string")return{kind:"invalid",error:new Ke(Be.InvalidResult,`Invalid result for ${m}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:m,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:R,...typeof v==="string"&&{requestState:v}}}if(f!=="complete")return{kind:"invalid",error:new Ke(Be.UnsupportedResultType,`Unsupported result type '${f}' for ${m}`,{resultType:f,method:m})};let g=gu(),S=Object.hasOwn(g,m)?g[m]:void 0;if(S!==void 0){let y=S.safeParse(h);if(!y.success)return{kind:"invalid",error:new Ke(Be.InvalidResult,`Invalid result for ${m}: ${y.error}`,{method:m})}}let _={...h};return delete _.resultType,{kind:"complete",result:_}},encodeResult(m,h,f){return ru(tu(m,eu(m,fu(m,h))),f)},encodeErrorCode:(m)=>m===-32002?-32602:m,checkInboundEnvelope(m){if(m.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let h=da().RequestMetaEnvelopeSchema.safeParse(m.envelope);if(!h.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${h.error.issues.map((f)=>f.message).join("; ")}`}},cn;function gu(){if(cn)return cn;let m=da();return cn={"tools/call":m.CallToolResultSchema,"tools/list":m.ListToolsResultSchema,"prompts/get":m.GetPromptResultSchema,"prompts/list":m.ListPromptsResultSchema,"resources/list":m.ListResourcesResultSchema,"resources/templates/list":m.ListResourceTemplatesResultSchema,"resources/read":m.ReadResourceResultSchema,"completion/complete":m.CompleteResultSchema,"server/discover":m.DiscoverResultSchema},cn}var Gr="2026-07-28";function Bt(m){return m!==void 0&&Da(m)?yi:mi}function Fi(m){if(m.revision!==void 0)return Bt(m.revision).era;return m.era==="modern"?yi.era:mi.era}function ti(m){return hc.some((h)=>h.hasRequestMethod(m))}function ai(m){return hc.some((h)=>h.hasNotificationMethod(m))}var hc=[mi,yi];function xi(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function N(m){if(!xi(m))return;let h=m._meta;return xi(h)?h:void 0}function X(m){let h=N(m);return h!==void 0&&Vt in h}function Q(m){let h=N(m)?.[Vt];return typeof h==="string"?h:void 0}function ee(m){return Bt(Gr).validateEnvelopeMeta(m)}var Su=Ni({AnnotationsSchema:()=>Nt,AudioContentSchema:()=>Na,BaseMetadataSchema:()=>qt,BaseRequestParamsSchema:()=>dt,BlobResourceContentsSchema:()=>qr,BooleanSchemaSchema:()=>kr,CallToolRequestParamsSchema:()=>Ss,CallToolRequestSchema:()=>_s,CallToolResultSchema:()=>Or,CancelTaskRequestSchema:()=>Ln,CancelTaskResultSchema:()=>Vn,CancelledNotificationParamsSchema:()=>vo,CancelledNotificationSchema:()=>$r,ClientCapabilitiesSchema:()=>$o,ClientNotificationSchema:()=>Un,ClientRequestSchema:()=>Dn,ClientResultSchema:()=>Hn,ClientTasksCapabilitySchema:()=>Ro,CompatibilityCallToolResultSchema:()=>wn,CompleteRequestParamsSchema:()=>Ks,CompleteRequestSchema:()=>Js,CompleteResultSchema:()=>Gs,ContentBlockSchema:()=>Ia,CreateMessageRequestParamsSchema:()=>qs,CreateMessageRequestSchema:()=>js,CreateMessageResultSchema:()=>Ns,CreateMessageResultWithToolsSchema:()=>Is,CreateTaskResultSchema:()=>qn,CursorSchema:()=>_r,DiscoverRequestSchema:()=>Co,DiscoverResultSchema:()=>qo,ElicitRequestFormParamsSchema:()=>Ma,ElicitRequestParamsSchema:()=>Ls,ElicitRequestSchema:()=>Vs,ElicitRequestURLParamsSchema:()=>As,ElicitResultSchema:()=>Hs,ElicitationCompleteNotificationParamsSchema:()=>Ds,ElicitationCompleteNotificationSchema:()=>Us,EmbeddedResourceSchema:()=>cs,EmptyResultSchema:()=>zr,EnumSchemaSchema:()=>Ms,GetPromptRequestParamsSchema:()=>ss,GetPromptRequestSchema:()=>ns,GetPromptResultSchema:()=>ds,GetTaskPayloadRequestSchema:()=>On,GetTaskPayloadResultSchema:()=>kn,GetTaskRequestSchema:()=>Nn,GetTaskResultSchema:()=>In,IconSchema:()=>bo,IconsSchema:()=>Ht,ImageContentSchema:()=>ja,ImplementationSchema:()=>Ta,InitializeRequestParamsSchema:()=>Po,InitializeRequestSchema:()=>Eo,InitializeResultSchema:()=>wo,InitializedNotificationSchema:()=>To,JSONArraySchema:()=>$n,JSONObjectSchema:()=>tt,JSONRPCErrorResponseSchema:()=>wa,JSONRPCMessageSchema:()=>yo,JSONRPCNotificationSchema:()=>Rr,JSONRPCRequestSchema:()=>br,JSONRPCResponseSchema:()=>Pn,JSONRPCResultResponseSchema:()=>Ea,JSONValueSchema:()=>Lt,LegacyTitledEnumSchemaSchema:()=>Lr,ListChangedOptionsBaseSchema:()=>Tn,ListPromptsRequestSchema:()=>rs,ListPromptsResultSchema:()=>os,ListResourceTemplatesRequestSchema:()=>Ao,ListResourceTemplatesResultSchema:()=>Lo,ListResourcesRequestSchema:()=>ko,ListResourcesResultSchema:()=>Mo,ListRootsRequestSchema:()=>Ys,ListRootsResultSchema:()=>Ws,ListTasksRequestSchema:()=>Mn,ListTasksResultSchema:()=>An,ListToolsRequestSchema:()=>fs,ListToolsResultSchema:()=>gs,LoggingLevelSchema:()=>Jt,LoggingMessageNotificationParamsSchema:()=>Rs,LoggingMessageNotificationSchema:()=>zs,ModelHintSchema:()=>$s,ModelPreferencesSchema:()=>Ps,MultiSelectEnumSchemaSchema:()=>ks,NotificationSchema:()=>gt,NotificationsParamsSchema:()=>ft,NumberSchemaSchema:()=>ka,PaginatedRequestParamsSchema:()=>Io,PaginatedRequestSchema:()=>Ft,PaginatedResultSchema:()=>xt,PingRequestSchema:()=>Er,PrimitiveSchemaDefinitionSchema:()=>Ur,ProgressNotificationParamsSchema:()=>No,ProgressNotificationSchema:()=>wr,ProgressSchema:()=>jo,ProgressTokenSchema:()=>Sr,PromptArgumentSchema:()=>ts,PromptListChangedNotificationSchema:()=>ms,PromptMessageSchema:()=>us,PromptReferenceSchema:()=>xs,PromptSchema:()=>as,ReadResourceRequestParamsSchema:()=>Vo,ReadResourceRequestSchema:()=>Do,ReadResourceResultSchema:()=>Uo,RelatedTaskMetadataSchema:()=>_o,RequestIdSchema:()=>Ut,RequestMetaSchema:()=>yr,RequestSchema:()=>at,ResourceContentsSchema:()=>Tr,ResourceLinkSchema:()=>ls,ResourceListChangedNotificationSchema:()=>Ho,ResourceRequestParamsSchema:()=>Ca,ResourceSchema:()=>jr,ResourceTemplateReferenceSchema:()=>Fs,ResourceTemplateSchema:()=>Oo,ResourceUpdatedNotificationParamsSchema:()=>Qo,ResourceUpdatedNotificationSchema:()=>es,ResultMetaObjectSchema:()=>vr,ResultSchema:()=>rt,RoleSchema:()=>Kt,RootSchema:()=>Bs,RootsListChangedNotificationSchema:()=>Zs,SamplingContentSchema:()=>Ts,SamplingMessageContentBlockSchema:()=>ia,SamplingMessageSchema:()=>Cs,ServerCapabilitiesSchema:()=>Pr,ServerNotificationSchema:()=>xn,ServerRequestSchema:()=>Fn,ServerResultSchema:()=>Kn,ServerTasksCapabilitySchema:()=>zo,SetLevelRequestParamsSchema:()=>vs,SetLevelRequestSchema:()=>bs,SingleSelectEnumSchemaSchema:()=>Os,StringSchemaSchema:()=>Oa,SubscribeRequestParamsSchema:()=>Fo,SubscribeRequestSchema:()=>xo,SubscriptionFilterSchema:()=>Nr,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Yo,SubscriptionsAcknowledgedNotificationSchema:()=>Wo,SubscriptionsListenRequestParamsSchema:()=>Go,SubscriptionsListenRequestSchema:()=>Bo,SubscriptionsListenResultMetaSchema:()=>Zo,SubscriptionsListenResultSchema:()=>Xo,TaskAugmentedRequestParamsSchema:()=>la,TaskCreationParamsSchema:()=>Cn,TaskMetadataSchema:()=>So,TaskSchema:()=>Gt,TaskStatusNotificationParamsSchema:()=>Qs,TaskStatusNotificationSchema:()=>jn,TaskStatusSchema:()=>Xs,TextContentSchema:()=>qa,TextResourceContentsSchema:()=>Cr,TitledMultiSelectEnumSchemaSchema:()=>Dr,TitledSingleSelectEnumSchemaSchema:()=>Ar,ToolAnnotationsSchema:()=>hs,ToolChoiceSchema:()=>Es,ToolExecutionSchema:()=>ps,ToolListChangedNotificationSchema:()=>ys,ToolResultContentSchema:()=>ws,ToolSchema:()=>Ir,ToolUseContentSchema:()=>is,UnsubscribeRequestParamsSchema:()=>Ko,UnsubscribeRequestSchema:()=>Jo,UntitledMultiSelectEnumSchemaSchema:()=>Vr,UntitledSingleSelectEnumSchemaSchema:()=>Mr});var b=(m)=>br.safeParse(m).success,I=(m)=>Rr.safeParse(m).success,te=(m)=>Ea.safeParse(m).success,ae=(m)=>wa.safeParse(m).success;var Yt=(m)=>typeof m==="object"&&m!==null&&!Array.isArray(m)&&m.resultType==="input_required";function pc(m){if(m.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${m.params.ref.type}`)}function fc(m){if(m.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${m.params.ref.type}`)}var Ki="x-mcp-header",_u=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,yu=new Set(["string","integer","boolean","number"]);function gc(m){let h=[],f=new Map,g=(_,y,R)=>{if(_===null||typeof _!=="object")return;let v=_;if(Ki in v){if(!R||y.length===0)return`${ln(y)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let O=v[Ki];if(typeof O!=="string"||O.length===0)return`${ln(y)}: x-mcp-header MUST be a non-empty string`;if(!_u.test(O))return`${ln(y)}: x-mcp-header '${O}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let L=typeof v.type==="string"?v.type:void 0;if(L===void 0||!yu.has(L))return`${ln(y)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${L??"<none>"}`;let G=O.toLowerCase(),Y=f.get(G);if(Y!==void 0)return`x-mcp-header '${O}' is not case-insensitively unique (also declared as '${Y}')`;f.set(G,O),h.push({path:y,headerName:O,type:L})}let E=v.properties;if(E!==null&&typeof E==="object")for(let[O,L]of Object.entries(E)){let G=g(L,[...y,O],R);if(G!==void 0)return G}for(let O of vu){let L=v[O];if(L===void 0)continue;let G=Array.isArray(L)?L:L!==null&&typeof L==="object"&&bu.has(O)?Object.values(L):[L];for(let Y of G){let U=g(Y,[...y,`<${O}>`],!1);if(U!==void 0)return U}}},S=g(m,[],!0);return S===void 0?{valid:!0,declarations:h}:{valid:!1,reason:S}}var vu=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],bu=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function ln(m){return m.length===0?"<root>":m.join(".")}var dn=-32020,oh=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[i.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[dn,i.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[i.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[i.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[i.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[dn],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[i.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[dn],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],sh={[i.ParseError]:400,[i.InvalidRequest]:400,[i.MethodNotFound]:404,[i.UnsupportedProtocolVersion]:400,[i.MissingRequiredClientCapability]:400,[dn]:400};function un(m,h,f,g,S){return{kind:"reject",rung:m,cell:h,httpStatus:f,code:g.code,message:g.message,...g.data!==void 0&&{data:g.data},settled:S}}function ce(m){if(!X(m))return!1;let h=Q(m);if(h===void 0||!Da(h))return!1;let f=N(m);return f!==void 0&&ee(f).length===0}function Se(m,h){switch(m.reason){case"http-method":return un("http-method","modern-only-method-not-allowed",405,new Ve(-32000,"Method not allowed."),!0);case"batch":return un("jsonrpc-shape","modern-only-batch-not-supported",400,new Ve(i.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return un("jsonrpc-shape","modern-only-response-post",400,new Ve(i.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let f=m.requestedVersion;return un("era-classification","modern-only-missing-envelope",400,f===void 0?new Ve(i.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...h]}):new B({supported:[...h],requested:f}),!0)}}}function hn(m,h){return ne(m,h)}function Fr(m){return new Set(m.flatMap((h)=>Object.keys(h.shape)))}function Va(m){if(m==null)return!1;let h=typeof m;if(h!=="object"&&h!=="function")return!1;if(!("~standard"in m))return!1;return typeof m["~standard"]?.validate==="function"}var Ji=!1,si="draft-2020-12";function Wt(m,h="input"){let f=m["~standard"],g;if(f.jsonSchema)g=f.jsonSchema[h]({target:si});else if(f.vendor==="zod"){if(!("_zod"in m))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!Ji)Ji=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");g=me(m,{target:si,io:h})}else throw Error(`Schema library "${f.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(h==="output"){if(g.type!==void 0)return g;return Sc(g)?{type:"object",...g}:g}if(g.type!==void 0&&g.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(g.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...g}}function Sc(m){if("properties"in m||"patternProperties"in m||"additionalProperties"in m||"required"in m)return!0;for(let h of["oneOf","anyOf","allOf"]){let f=m[h];if(Array.isArray(f)&&f.length>0)return f.every((g)=>g!==null&&typeof g==="object"&&(g.type==="object"||Sc(g)))}return!1}function Ru(m){if(!m.path?.length)return m.message;return`${m.path.map((h)=>String(typeof h==="object"?h.key:h)).join(".")}: ${m.message}`}async function ua(m,h){let f=await m["~standard"].validate(h);if(f.issues&&f.issues.length>0)return{success:!1,error:f.issues.map((g)=>Ru(g)).join(", ")};return{success:!0,data:f.value}}function zu(m){let h=me(m,{target:si,io:"input"});return typeof h.pattern==="string"?h.pattern:void 0}var $u=/\\\.\\d\{(\d+)\}/;function Pu(m){let h=$u.exec(m),f=[void 0,-1,0];if(h)f.push(Number(h[1]));return[!1,!0].flatMap((g)=>[!1,!0].flatMap((S)=>f.map((_)=>q({local:g,offset:S,precision:_}))))}function Eu(m,h){let f;switch(m){case"email":f=[ze()];break;case"uri":f=[re()];break;case"date":f=[he()];break;case"date-time":f=Pu(h);break}return new Set(f.map((g)=>zu(g)).filter((g)=>g!==void 0))}function wu(m,h,f){if(f!=="zod")return!0;return Eu(m,h).has(h)}function _c(m){let h=Wt(m,"input"),f=h.properties||{},g=h.required||[];return Object.entries(f).map(([S,_])=>({name:S,description:_?.description,required:g.includes(S)}))}function Jr(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function Tu(m){try{return Wt(m,"input")}catch(h){let f=h instanceof Error?h.message:String(h);throw new Ve(i.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${f}`)}}var Cu=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function vi(m){return Cu.has(m)||m.startsWith("x-")}var qu=new Set(["$schema",...Object.keys(Ma.shape.requestedSchema.shape)]),Gi={string:Fr([Oa,Mr,Ar,Lr]),number:Fr([ka]),integer:Fr([ka]),boolean:Fr([kr]),array:Fr([Vr,Dr])},ju=new Set(Oa.shape.format.unwrap().options);function Nu(m,h,f,g){if(!Jr(m))return m;let S=typeof m.type==="string"&&Object.hasOwn(Gi,m.type)?Gi[m.type]:void 0;if(S===void 0)return m;let _={};for(let[y,R]of Object.entries(m))if(S.has(y)||vi(y))_[y]=R;else if(y==="pattern"&&m.type==="string"&&typeof m.format==="string"){if(!ju.has(m.format))_[y]=R;else if(typeof R!=="string"||!wu(m.format,R,f))g.push(`${h}.${y}`)}else g.push(`${h}.${y}`);return _}function Iu(m,h){let f={},g=[];for(let[S,_]of Object.entries(m))if(S==="properties"&&Jr(_))f[S]=Object.fromEntries(Object.entries(_).map(([y,R])=>[y,Nu(R,`properties.${y}`,h,g)]));else if(qu.has(S))f[S]=_;else if(!vi(S))g.push(S);if(g.length>0)throw new Ve(i.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${g.join(", ")}`);return f}function Ou(m,h){if(!Jr(m.properties))return h;let f=Object.entries(m.properties).filter(([,g])=>!hn(Ur,g).success).map(([g])=>`properties.${g}`);return f.length>0?f.join(", "):h}function ni(m,h,f=""){if(Array.isArray(m)&&Array.isArray(h))return m.flatMap((g,S)=>ni(g,h[S],`${f}[${S}]`));if(!Jr(m)||!Jr(h))return[];return Object.entries(m).flatMap(([g,S])=>{let _=f?`${f}.${g}`:g;if(!Object.prototype.hasOwnProperty.call(h,g))return vi(g)?[]:[_];return ni(S,h[g],_)})}function ku(m){if(!Va(m.requestedSchema))return{...m,mode:"form",requestedSchema:m.requestedSchema};let h=m.requestedSchema["~standard"].vendor,f=Iu(Tu(m.requestedSchema),h),g=hn(Ma.shape.requestedSchema,f);if(!g.success)throw new Ve(i.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Ou(f,g.error.message)}`);let S=ni(f,g.data);if(S.length>0)throw new Ve(i.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${S.join(", ")}`);let _=(g.data.required??[]).filter((y)=>!Object.prototype.hasOwnProperty.call(g.data.properties,y));if(_.length>0)throw new Ve(i.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${_.join(", ")}`);return{...m,mode:"form",requestedSchema:g.data}}function Mu(m){let h=m.inputRequests!==void 0&&Object.keys(m.inputRequests).length>0,f=typeof m.requestState==="string";if(!h&&!f)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...m.inputRequests!==void 0&&{inputRequests:m.inputRequests},...m.requestState!==void 0&&{requestState:m.requestState}}}var nh=Object.assign(Mu,{elicit(m){try{return{method:"elicitation/create",params:ku(m)}}catch(h){throw h instanceof Ve?TypeError(h.message,{cause:h}):h}},elicitUrl(m){return{method:"elicitation/create",params:{...m,mode:"url"}}},createMessage(m){return{method:"sampling/createMessage",params:m}},listRoots(){return{method:"roots/list"}}});var yc=250;function vc(m,h){return`Multi-round-trip request '${m}' still required input after ${h} rounds (inputRequired.maxRounds)`}function bc(m,h){return new Promise((f,g)=>{if(h?.aborted){g(h.reason instanceof Ke?h.reason:new Ke(Be.RequestTimeout,String(h.reason)));return}let S=setTimeout(()=>{h?.removeEventListener("abort",_),f()},m),_=()=>{clearTimeout(S),g(h?.reason instanceof Ke?h.reason:new Ke(Be.RequestTimeout,String(h?.reason)))};h?.addEventListener("abort",_,{once:!0})})}function Rc(m){let h=new AbortController,f=()=>h.abort(m?.reason);if(m?.addEventListener("abort",f,{once:!0}),m?.aborted)h.abort(m.reason);return{signal:h.signal,abort:(g)=>h.abort(g),dispose:()=>m?.removeEventListener("abort",f)}}var Au=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],Lu={IdJagTokenExchangeResponseSchema:Yn,OAuthClientInformationFullSchema:Zn,OAuthClientInformationSchema:rn,OAuthClientMetadataSchema:an,OAuthClientRegistrationErrorSchema:Xn,OAuthErrorResponseSchema:Wn,OAuthMetadataSchema:en,OAuthProtectedResourceMetadataSchema:Jn,OAuthTokenRevocationRequestSchema:Qn,OAuthTokensSchema:Bn,OpenIdProviderDiscoveryMetadataSchema:Gn,OpenIdProviderMetadataSchema:tn},zc={},$c={};function Pc(m,h){let f=m.slice(0,-6);zc[f]=h,$c[f]=(g)=>h.safeParse(g).success}for(let m of Au)Pc(m,Su[m]);for(let[m,h]of Object.entries(Lu))Pc(m,h);var ih=Object.freeze(zc),ch=Object.freeze($c);function Vu(m){switch(m){case"initialize":case"notifications/initialized":return Bt(void 0);case"server/discover":return Bt(Gr);default:return}}var Du=60000,Uu=[Vt,gr,Dt,ca],Hu=["inputResponses","requestState"];function Bi(m,h){let f=m.params;if(!Kr(f))return{message:m,lifted:{}};let g=f._meta,S=Kr(g)?Uu.filter((v)=>(v in g)):[],_=h==="request"?Hu.filter((v)=>(v in f)):[];if(S.length===0&&_.length===0)return{message:m,lifted:{}};let y={},R={...f};if(S.length>0&&Kr(g)){let v={},E={...g};for(let O of S)v[O]=g[O],delete E[O];if(y.envelope=v,Object.keys(E).length>0)R._meta=E;else delete R._meta}for(let v of _){if(v==="inputResponses")y.inputResponses=R[v];if(v==="requestState")y.requestState=R[v];delete R[v]}return{message:{...m,params:R},lifted:y}}function Yi(m,h){let f=m.validateResult(h,void 0);if(!f.ok&&f.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(g){let S=m.validateResult(h,g);if(S.ok)return{value:S.value};return{issues:[{message:S.reason==="invalid"?S.message:`not-in-era: ${h}`}]}}}}}function Br(m){return()=>m}var Fu=Br(void 0);function bi(m,h){return{...m,mcpReq:{...m.mcpReq,requestState:Br(h)}}}var Ec;function be(m,h){Ec(m,h)}var wc=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{Ec=(m,h)=>{m._negotiatedProtocolVersion=h}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(m){this._options=m,this._supportedProtocolVersions=m?.supportedProtocolVersions??Rn,this.setNotificationHandler("notifications/cancelled",(h)=>{this._oncancel(h)}),this.setNotificationHandler("notifications/progress",(h)=>{this._onprogress(h)}),this.setRequestHandler("ping",(h)=>({}))}_shouldDropInbound(m){}_outboundMetaEnvelope(){}_envelopeOutbound(m){let h=this._outboundMetaEnvelope();if(h===void 0)return m;let f=m.params??{};return{...m,params:{...f,_meta:{...h,...f._meta}}}}_resolveNonCompleteResult(m,h){return Promise.reject(new Ke(Be.UnsupportedResultType,`Unsupported result type '${m.kind}' for ${h.request.method}`,{resultType:m.kind,method:h.request.method}))}_getRequestHandler(m){return this._requestHandlers.get(m)}async _oncancel(m){if(!m.params.requestId)return;this._requestHandlerAbortControllers.get(m.params.requestId)?.abort(m.params.reason)}_setupTimeout(m,h,f,g,S=!1){this._timeoutInfo.set(m,{timeoutId:setTimeout(g,h),startTime:Date.now(),timeout:h,maxTotalTimeout:f,resetTimeoutOnProgress:S,onTimeout:g})}_resetTimeout(m){let h=this._timeoutInfo.get(m);if(!h)return!1;let f=Date.now()-h.startTime;if(h.maxTotalTimeout&&f>=h.maxTotalTimeout)throw this._timeoutInfo.delete(m),new Ke(Be.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:h.maxTotalTimeout,totalElapsed:f});return clearTimeout(h.timeoutId),h.timeoutId=setTimeout(h.onTimeout,h.timeout),!0}_cleanupTimeout(m){let h=this._timeoutInfo.get(m);if(h)clearTimeout(h.timeoutId),this._timeoutInfo.delete(m)}async connect(m){this._transport=m;let h=this.transport?.onclose;this._transport.onclose=()=>{try{h?.()}finally{this._onclose()}};let f=this.transport?.onerror;this._transport.onerror=(S)=>{f?.(S),this._onerror(S)};let g=this._transport?.onmessage;this._transport.onmessage=(S,_)=>{if(g?.(S,_),te(S)||ae(S))this._onresponse(S);else if(b(S))this._onrequest(S,_);else if(I(S))this._onnotification(S,_);else this._onerror(Error(`Unknown message type: ${JSON.stringify(S)}`))},m.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let m=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let g of this._timeoutInfo.values())clearTimeout(g.timeoutId);this._timeoutInfo.clear();let h=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let f=new Ke(Be.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let g of m.values())g(f);for(let g of h.values())g.abort(f)}}_onerror(m){this.onerror?.(m)}_onnotification(m,h){let{message:f}=Bi(m,"notification"),g=this._negotiatedWireCodec();if(h?.classification===void 0&&this._shouldDropInbound(m)==="drop")return;if(h?.classification!==void 0){let y=Fi(h.classification);if(y!==g.era){this._onerror(Error(`Era mismatch on inbound notification '${f.method}': classified as ${y} but this instance serves ${g.era}`));return}}if(ai(f.method)&&!g.hasNotificationMethod(f.method))return;let S=this._notificationHandlers.get(f.method),_=this.fallbackNotificationHandler;if(S===void 0&&_===void 0)return;Promise.resolve().then(()=>S===void 0?_(f):S(f,g)).catch((y)=>this._onerror(Error(`Uncaught error in notification handler: ${y}`)))}_onrequest(m,h){let{message:f,lifted:g}=Bi(m,"request"),S=this._negotiatedWireCodec();if(h?.classification===void 0&&this._shouldDropInbound(m)==="drop"){this._onerror(Error(`Dropped inbound request '${m.method}': not servable on this connection's protocol era`));return}let _=this._transport,y=(F,M,z)=>{let D={jsonrpc:"2.0",id:f.id,error:{code:F,message:M,...z!==void 0&&{data:z}}};_?.send(D).catch((w)=>this._onerror(Error(`Failed to send an error response: ${w}`)))};if(h?.classification!==void 0){let F=Fi(h.classification);if(F!==S.era){this._onerror(Error(`Era mismatch on inbound request '${f.method}': classified as ${F} but this instance serves ${S.era}`));let M=h.classification.revision??F;y(i.UnsupportedProtocolVersion,`Unsupported protocol version: ${M}`,{supported:this._supportedProtocolVersions,requested:M});return}}if(ti(f.method)&&!S.hasRequestMethod(f.method)){y(i.MethodNotFound,"Method not found");return}let R=this._requestHandlers.get(f.method)??this.fallbackRequestHandler;if(R===void 0){y(i.MethodNotFound,"Method not found");return}let v=S.checkInboundEnvelope(g);if(v!==void 0){y(i.InvalidParams,v);return}let E=(F,M)=>this._notificationViaCodec(this._resolveOutboundCodec(F.method),F,{...M,relatedRequestId:f.id}),O=(F,M,z)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(F.method),F,M,{...z,relatedRequestId:f.id}),L=new AbortController;this._requestHandlerAbortControllers.set(f.id,L);let G=g.inputResponses===void 0?void 0:xu(g.inputResponses),Y={sessionId:_?.sessionId,mcpReq:{id:f.id,method:f.method,_meta:f.params?._meta,...g.envelope!==void 0&&{envelope:g.envelope},...G!==void 0&&{inputResponses:G.accepted},...G!==void 0&&G.droppedKeys.length>0&&{droppedInputResponseKeys:G.droppedKeys},requestState:g.requestState===void 0?Fu:Br(g.requestState),signal:L.signal,send:(F,M,z)=>{let D=this._resolveOutboundCodec(F.method);if(this._assertOutboundRequestInEra(D,F.method),Va(M))return O(F,M,z);let w=Yi(D,F.method);if(w===void 0)throw TypeError(`'${F.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return O(F,w,M)},notify:E},http:h?.authInfo?{authInfo:h.authInfo}:void 0},U=this.buildContext(Y,h);Promise.resolve().then(()=>R(f,U)).then(async(F)=>{if(L.signal.aborted)return;let M;try{M=S.encodeResult(f.method,F,this._outboundServerInfo())}catch(D){this._onerror(Error(`Failed to encode result for ${f.method}: ${D}`)),y(i.InternalError,"Internal error");return}let z={result:M,jsonrpc:"2.0",id:f.id};await _?.send(z)},async(F)=>{if(L.signal.aborted)return;let M=Number.isSafeInteger(F.code)?F.code:i.InternalError,z={jsonrpc:"2.0",id:f.id,error:{code:S.encodeErrorCode(M),message:F.message??"Internal error",...F.data!==void 0&&{data:F.data}}};await _?.send(z)}).catch((F)=>this._onerror(Error(`Failed to send response: ${F}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(f.id)===L)this._requestHandlerAbortControllers.delete(f.id)})}_onprogress(m){let{progressToken:h,...f}=m.params,g=Number(h),S=this._progressHandlers.get(g);if(!S){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(m)}`));return}let _=this._responseHandlers.get(g),y=this._timeoutInfo.get(g);if(y&&_&&y.resetTimeoutOnProgress)try{this._resetTimeout(g)}catch(R){this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),_(R);return}S(f)}_onresponse(m){let h=Number(m.id),f=this._responseHandlers.get(h);if(f===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(m)}`));return}if(this._responseHandlers.delete(h),this._cleanupTimeout(h),this._progressHandlers.delete(h),te(m))f(m);else f(Ve.fromError(m.error.code,m.error.message,m.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(m,h,f){let g=this._resolveOutboundCodec(m.method);if(this._assertOutboundRequestInEra(g,m.method),Va(h))return this._requestWithSchemaViaCodec(g,m,h,f);let S=Yi(g,m.method);if(S===void 0)throw TypeError(`'${m.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(g,m,S,h)}_negotiatedWireCodec(){return Bt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(m){if(this._negotiatedProtocolVersion===void 0){let h=Vu(m);if(h)return h}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(m,h){if(ti(h)&&!m.hasRequestMethod(h))throw new Ke(Be.MethodNotSupportedByProtocolVersion,`Method '${h}' is not supported by the negotiated protocol version (wire era ${m.era})`,{method:h,era:m.era})}_requestWithSchema(m,h,f){let g=this._resolveOutboundCodec(m.method);return this._assertOutboundRequestInEra(g,m.method),this._requestWithSchemaViaCodec(g,m,h,f)}_requestWithSchemaViaCodec(m,h,f,g){let{relatedRequestId:S,resumptionToken:_,onresumptiontoken:y,headers:R}=g??{},v=Date.now(),E,O;return new Promise((L,G)=>{let Y=(V)=>{G(V)};if(!this._transport){Y(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(h.method)}catch(V){Y(V);return}if(g?.signal?.aborted){let V=g.signal.reason;throw V instanceof Ke?V:new Ke(Be.RequestTimeout,String(V))}let U=m.era===Gr&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,F=this._requestMessageId++;O=F;let M={...h,jsonrpc:"2.0",id:F};if(g?.onprogress)this._progressHandlers.set(F,g.onprogress),M.params={...h.params,_meta:{...h.params?._meta,progressToken:F}};let z=this._envelopeOutbound(M),D=!1,w=(V)=>{if(D)return;if(this._progressHandlers.delete(F),U===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:F,reason:String(V)}}),{relatedRequestId:S,resumptionToken:_,onresumptiontoken:y}).catch((T)=>this._onerror(Error(`Failed to send cancellation: ${T}`)));else U.abort();G(V instanceof Ke?V:new Ke(Be.RequestTimeout,String(V)))};this._responseHandlers.set(F,(V)=>{if(g?.signal?.aborted)return;if(D=!0,V instanceof Error)return G(V);let T;try{T=m.decodeResult(h.method,V.result)}catch(ye){return G(ye instanceof Error?ye:Error(String(ye)))}if(T.kind==="invalid")return G(T.error);if(T.kind==="input_required"){if(g?.allowInputRequired===!0)return L(Ku(T));let ye={codec:m,request:h,resultSchema:f,options:g,flowStartedAt:v,retry:(Oe,Pe)=>this._requestWithSchemaViaCodec(m,Oe===void 0?{method:h.method}:{method:h.method,params:Oe},f,Pe)};return L(this._resolveNonCompleteResult(T,ye))}let Z=T.result;ua(f,Z).then((ye)=>{if(ye.success)L(ye.data);else G(new Ke(Be.InvalidResult,`Invalid result for ${h.method}: ${ye.error}`))},G)}),E=()=>w(g?.signal?.reason),g?.signal?.addEventListener("abort",E,{once:!0});let K=g?.timeout??Du,W=()=>w(new Ke(Be.RequestTimeout,"Request timed out",{timeout:K}));this._setupTimeout(F,K,g?.maxTotalTimeout,W,g?.resetTimeoutOnProgress??!1),this._transport.send(z,{relatedRequestId:S,resumptionToken:_,onresumptiontoken:y,headers:R,requestSignal:U?.signal}).catch((V)=>{this._progressHandlers.delete(F),G(V)})}).finally(()=>{if(E)g?.signal?.removeEventListener("abort",E);if(O!==void 0)this._responseHandlers.delete(O),this._cleanupTimeout(O)})}async notification(m,h){return this._notificationViaCodec(this._resolveOutboundCodec(m.method),m,h)}async _notificationViaCodec(m,h,f){if(!this._transport)throw new Ke(Be.NotConnected,"Not connected");if(ai(h.method)&&!m.hasNotificationMethod(h.method))throw new Ke(Be.MethodNotSupportedByProtocolVersion,`Notification '${h.method}' is not supported by the negotiated protocol version (wire era ${m.era})`,{method:h.method,era:m.era});this.assertNotificationCapability(h.method);let g=this._envelopeOutbound({jsonrpc:"2.0",...h});if((this._options?.debouncedNotificationMethods??[]).includes(h.method)&&!h.params&&!f?.relatedRequestId){if(this._pendingDebouncedNotifications.has(h.method))return;this._pendingDebouncedNotifications.add(h.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(h.method),!this._transport)return;this._transport?.send(g,f).catch((S)=>this._onerror(S))});return}await this._transport.send(g,f)}setRequestHandler(m,h,f){this.assertRequestHandlerCapability(m);let g;if(typeof h==="function"){if(!ti(m))throw TypeError(`'${m}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);g=(S,_)=>{let y=this._negotiatedWireCodec(),R=y.validateRequest(m,S);if(!R.ok&&R.reason==="not-in-era")R=y.validateInputRequest(m,S);if(!R.ok){if(R.reason==="not-in-era")throw new Ve(i.InternalError,`No wire schema for ${m} in the resolved era`);throw Error(R.message)}return Promise.resolve(h(R.value,_))}}else if(f)g=async(S,_)=>{let y=await ua(h.params,{...S.params});if(!y.success)throw new Ve(i.InvalidParams,`Invalid params for ${m}: ${y.error}`);return f(y.data,_)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(m,this._wrapHandler(m,g))}_wrapHandler(m,h){return h}_outboundServerInfo(){}removeRequestHandler(m){this._requestHandlers.delete(m)}assertCanSetRequestHandler(m){if(this._requestHandlers.has(m))throw Error(`A request handler for ${m} already exists, which would be overridden`)}setNotificationHandler(m,h,f){if(typeof h==="function"){if(!ai(m))throw TypeError(`'${m}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(m,(g,S)=>{let _=S.validateNotification(m,g);if(!_.ok){if(_.reason==="not-in-era")throw new Ve(i.InternalError,`No wire schema for ${m} in the resolved era`);throw Error(_.message)}return Promise.resolve(h(_.value))});return}if(!f)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(m,async(g)=>{let S=await ua(h.params,{...g.params});if(!S.success)throw new Ve(i.InvalidParams,`Invalid params for notification ${m}: ${S.error}`);await f(S.data,g)})}removeNotificationHandler(m){this._notificationHandlers.delete(m)}};function Kr(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Tc(m,h){let f={...m};for(let g in h){let S=g,_=h[S];if(_===void 0)continue;let y=f[S];f[S]=Kr(y)&&Kr(_)?{...y,..._}:_}return f}function Wi(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function xu(m){let h={},f=[];if(!Wi(m))return{accepted:h,droppedKeys:f};for(let[g,S]of Object.entries(m)){if(!Wi(S)||"method"in S||"result"in S){f.push(g);continue}h[g]=S}return{accepted:h,droppedKeys:f}}function Ku(m){return{resultType:"input_required",inputRequests:m.inputRequests,...m.requestState!==void 0&&{requestState:m.requestState}}}/*!
|
|
1
|
+
import{Ce,Ee,me,q,he,ne,e,ze,re,oe,o,a,x,Te,l,n,t,d,c,C,k,s,p,r,u,H,A}from"./chunk-n890pdvc.js";var{create:ul,defineProperty:fo,getOwnPropertyDescriptor:dl,getOwnPropertyNames:ml,getPrototypeOf:hl}=Object,pl=Object.prototype.hasOwnProperty,je=(m,h)=>()=>(h||m((h={exports:{}}).exports,h),h.exports),Ni=(m,h)=>{let f={};for(var g in m)fo(f,g,{get:m[g],enumerable:!0});if(h)fo(f,Symbol.toStringTag,{value:"Module"});return f},fl=(m,h,f,g)=>{if(h&&typeof h==="object"||typeof h==="function"){for(var S=ml(h),_=0,y=S.length,R;_<y;_++)if(R=S[_],!pl.call(m,R)&&R!==f)fo(m,R,{get:((v)=>h[v]).bind(null,R),enumerable:!(g=dl(h,R))||g.enumerable})}return m},go=(m,h,f)=>(f=m!=null?ul(hl(m)):{},fl(h||!m||!m.__esModule?fo(f,"default",{value:m,enumerable:!0}):f,m));var gl=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Ii=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Sl=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),_l=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Oi(m){return typeof m==="string"&&Ii.has(m.replace(/#$/,""))}function ki(m,h){if(!("$schema"in m)||typeof m.$schema!=="string")return"2020-12";let f=m.$schema.replace(/#$/,"");if(gl.has(f))return"2020-12";if(Ii.has(f))return"2019-09";if(Sl.has(f)||_l.has(f))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${m.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${h}`)}var Ai={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var Mi;(function(m){})(Mi||(Mi={}));function yl(m){return Ee(oe,m)}var za="2025-11-25";var Rn=[za,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],zn="io.modelcontextprotocol/related-task",Vt="io.modelcontextprotocol/protocolVersion",gr="io.modelcontextprotocol/clientInfo",jt="io.modelcontextprotocol/serverInfo",Dt="io.modelcontextprotocol/clientCapabilities",$a="io.modelcontextprotocol/subscriptionId",ca="io.modelcontextprotocol/logLevel";var Pa="2.0";var Lt=H(()=>c([e(),o(),a(),x(),s(e(),Lt),n(Lt)])),tt=s(e(),Lt),$n=n(Lt),Sr=c([e(),o().int()]),_r=e(),So=t({ttl:o().optional()}),_o=t({taskId:e()}),yr=d({progressToken:Sr.optional(),[zn]:_o.optional()}),dt=t({_meta:yr.optional()}),la=dt.extend({task:So.optional()}),at=t({method:e(),params:dt.loose().optional()}),ft=t({_meta:yr.optional()}),gt=t({method:e(),params:ft.loose().optional()}),vr=d({get[jt](){return Ta.optional().catch(void 0)}}),rt=d({_meta:vr.optional()}),Ut=c([e(),o().int()]),br=t({jsonrpc:r(Pa),id:Ut,...at.shape}).strict(),Rr=t({jsonrpc:r(Pa),...gt.shape}).strict(),Ea=t({jsonrpc:r(Pa),id:Ut,result:rt}).strict(),wa=t({jsonrpc:r(Pa),id:Ut.optional(),error:t({code:o().int(),message:e(),data:l().optional()})}).strict(),yo=c([br,Rr,Ea,wa]),Pn=c([Ea,wa]),zr=rt.strict(),vo=ft.extend({requestId:Ut.optional(),reason:e().optional()}),$r=gt.extend({method:r("notifications/cancelled"),params:vo}),bo=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:p(["light","dark"]).optional()}),Ht=t({icons:n(bo).optional()}),qt=t({name:e(),title:e().optional()}),Ta=qt.extend({...qt.shape,...Ht.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),zl=k(t({applyDefaults:a().optional()}),tt),$l=A((m)=>{if(m&&typeof m==="object"&&!Array.isArray(m)&&Object.keys(m).length===0)return{form:{}};return m},k(t({form:zl.optional(),url:tt.optional()}),tt.optional())),Ro=d({list:tt.optional(),cancel:tt.optional(),requests:d({sampling:d({createMessage:tt.optional()}).optional(),elicitation:d({create:tt.optional()}).optional()}).optional()}),zo=d({list:tt.optional(),cancel:tt.optional(),requests:d({tools:d({call:tt.optional()}).optional()}).optional()}),$o=t({experimental:s(e(),tt).optional(),sampling:t({context:tt.optional(),tools:tt.optional()}).optional(),elicitation:$l.optional(),roots:t({listChanged:a().optional()}).optional(),tasks:Ro.optional(),extensions:s(e(),tt).optional()}),Po=dt.extend({protocolVersion:e(),capabilities:$o,clientInfo:Ta}),Eo=at.extend({method:r("initialize"),params:Po}),Pr=t({experimental:s(e(),tt).optional(),logging:tt.optional(),completions:tt.optional(),prompts:t({listChanged:a().optional()}).optional(),resources:t({subscribe:a().optional(),listChanged:a().optional()}).optional(),tools:t({listChanged:a().optional()}).optional(),tasks:zo.optional(),extensions:s(e(),tt).optional()}),wo=rt.extend({protocolVersion:e(),capabilities:Pr,serverInfo:Ta,instructions:e().optional()}),To=gt.extend({method:r("notifications/initialized"),params:ft.optional()}),Co=at.extend({method:r("server/discover"),params:dt.optional()}),qo=rt.extend({supportedVersions:n(e()),capabilities:Pr,instructions:e().optional()}),Er=at.extend({method:r("ping"),params:dt.optional()}),jo=t({progress:o(),total:u(o()),message:u(e())}),No=t({...ft.shape,...jo.shape,progressToken:Sr}),wr=gt.extend({method:r("notifications/progress"),params:No}),Io=dt.extend({cursor:_r.optional()}),Ft=at.extend({params:Io.optional()}),xt=rt.extend({nextCursor:_r.optional()}),Tr=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),Cr=Tr.extend({text:e()}),En=e().refine((m)=>{try{return atob(m),!0}catch{return!1}},{message:"Invalid Base64 string"}),qr=Tr.extend({blob:En}),Kt=p(["user","assistant"]),Nt=t({audience:n(Kt).optional(),priority:o().min(0).max(1).optional(),lastModified:q({offset:!0}).optional()}),jr=t({...qt.shape,...Ht.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:Nt.optional(),_meta:u(d({}))}),Oo=t({...qt.shape,...Ht.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:Nt.optional(),_meta:u(d({}))}),ko=Ft.extend({method:r("resources/list")}),Mo=xt.extend({resources:n(jr)}),Ao=Ft.extend({method:r("resources/templates/list")}),Lo=xt.extend({resourceTemplates:n(Oo)}),Ca=dt.extend({uri:e()}),Vo=Ca,Do=at.extend({method:r("resources/read"),params:Vo}),Uo=rt.extend({contents:n(c([Cr,qr]))}),Ho=gt.extend({method:r("notifications/resources/list_changed"),params:ft.optional()}),Fo=Ca,xo=at.extend({method:r("resources/subscribe"),params:Fo}),Ko=Ca,Jo=at.extend({method:r("resources/unsubscribe"),params:Ko}),Nr=t({toolsListChanged:a().optional(),promptsListChanged:a().optional(),resourcesListChanged:a().optional(),resourceSubscriptions:n(e()).optional()}),Go=dt.extend({notifications:Nr}),Bo=at.extend({method:r("subscriptions/listen"),params:Go}),Yo=ft.extend({notifications:Nr}),Wo=gt.extend({method:r("notifications/subscriptions/acknowledged"),params:Yo}),Zo=vr.extend({[$a]:Ut}),Xo=rt.extend({_meta:Zo}),Qo=ft.extend({uri:e()}),es=gt.extend({method:r("notifications/resources/updated"),params:Qo}),ts=t({name:e(),description:u(e()),required:u(a())}),as=t({...qt.shape,...Ht.shape,description:u(e()),arguments:u(n(ts)),_meta:u(d({}))}),rs=Ft.extend({method:r("prompts/list")}),os=xt.extend({prompts:n(as)}),ss=dt.extend({name:e(),arguments:s(e(),e()).optional()}),ns=at.extend({method:r("prompts/get"),params:ss}),qa=t({type:r("text"),text:e(),annotations:Nt.optional(),_meta:s(e(),l()).optional()}),ja=t({type:r("image"),data:En,mimeType:e(),annotations:Nt.optional(),_meta:s(e(),l()).optional()}),Na=t({type:r("audio"),data:En,mimeType:e(),annotations:Nt.optional(),_meta:s(e(),l()).optional()}),is=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),cs=t({type:r("resource"),resource:c([Cr,qr]),annotations:Nt.optional(),_meta:s(e(),l()).optional()}),ls=jr.extend({type:r("resource_link")}),Ia=c([qa,ja,Na,ls,cs]),us=t({role:Kt,content:Ia}),ds=rt.extend({description:e().optional(),messages:n(us)}),ms=gt.extend({method:r("notifications/prompts/list_changed"),params:ft.optional()}),hs=t({title:e().optional(),readOnlyHint:a().optional(),destructiveHint:a().optional(),idempotentHint:a().optional(),openWorldHint:a().optional()}),ps=t({taskSupport:p(["required","optional","forbidden"]).optional()}),Ir=t({...qt.shape,...Ht.shape,description:e().optional(),inputSchema:t({type:r("object"),properties:s(e(),Lt).optional(),required:n(e()).optional()}).catchall(l()),outputSchema:d({$schema:e().optional()}).optional(),annotations:hs.optional(),execution:ps.optional(),_meta:s(e(),l()).optional()}),fs=Ft.extend({method:r("tools/list")}),gs=xt.extend({tools:n(Ir)}),Or=rt.extend({content:n(Ia).default([]),structuredContent:l().optional(),isError:a().optional()}),wn=Or.or(rt.extend({toolResult:l()})),Ss=la.extend({name:e(),arguments:s(e(),l()).optional()}),_s=at.extend({method:r("tools/call"),params:Ss}),ys=gt.extend({method:r("notifications/tools/list_changed"),params:ft.optional()}),Tn=t({autoRefresh:a().default(!0),debounceMs:o().int().nonnegative().default(300)}),Jt=p(["debug","info","notice","warning","error","critical","alert","emergency"]),vs=dt.extend({level:Jt}),bs=at.extend({method:r("logging/setLevel"),params:vs}),Rs=ft.extend({level:Jt,logger:e().optional(),data:l()}),zs=gt.extend({method:r("notifications/message"),params:Rs}),$s=t({name:e().optional()}),Ps=t({hints:n($s).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),Es=t({mode:p(["auto","required","none"]).optional()}),ws=t({type:r("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:n(Ia),structuredContent:l().optional(),isError:a().optional(),_meta:s(e(),l()).optional()}),Ts=C("type",[qa,ja,Na]),ia=C("type",[qa,ja,Na,is,ws]),Cs=t({role:Kt,content:c([ia,n(ia)]),_meta:s(e(),l()).optional()}),qs=la.extend({messages:n(Cs),modelPreferences:Ps.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:tt.optional(),tools:n(Ir).optional(),toolChoice:Es.optional()}),js=at.extend({method:r("sampling/createMessage"),params:qs}),Ns=rt.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens"]).or(e())),role:Kt,content:Ts}),Is=rt.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:Kt,content:c([ia,n(ia)])}),kr=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:a().optional()}),Oa=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),ka=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),Mr=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),Ar=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),Lr=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),Os=c([Mr,Ar]),Vr=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),Dr=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),ks=c([Vr,Dr]),Ms=c([Lr,Os,ks]),Ur=c([Ms,kr,Oa,ka]),Ma=la.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),Ur),required:n(e()).optional()}).catchall(l())}),As=la.extend({mode:r("url"),message:e(),elicitationId:e(),url:e().url()}),Ls=c([Ma,As]),Vs=at.extend({method:r("elicitation/create"),params:Ls}),Ds=ft.extend({elicitationId:e()}),Us=gt.extend({method:r("notifications/elicitation/complete"),params:Ds}),Hs=rt.extend({action:p(["accept","decline","cancel"]),content:A((m)=>m===null?void 0:m,s(e(),c([e(),o(),a(),n(e())])).optional())}),Fs=t({type:r("ref/resource"),uri:e()}),xs=t({type:r("ref/prompt"),name:e()}),Ks=dt.extend({ref:c([xs,Fs]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),Js=at.extend({method:r("completion/complete"),params:Ks}),Gs=rt.extend({completion:d({values:n(e()).max(100),total:u(o().int()),hasMore:u(a())})}),Bs=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),Ys=at.extend({method:r("roots/list"),params:dt.optional()}),Ws=rt.extend({roots:n(Bs)}),Zs=gt.extend({method:r("notifications/roots/list_changed"),params:ft.optional()}),Cn=d({ttl:o().optional(),pollInterval:o().optional()}),Xs=p(["working","input_required","completed","failed","cancelled"]),Gt=t({taskId:e(),status:Xs,ttl:c([o(),x()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:u(o()),statusMessage:u(e())}),qn=rt.extend({task:Gt}),Qs=ft.merge(Gt),jn=gt.extend({method:r("notifications/tasks/status"),params:Qs}),Nn=at.extend({method:r("tasks/get"),params:dt.extend({taskId:e()})}),In=rt.merge(Gt),On=at.extend({method:r("tasks/result"),params:dt.extend({taskId:e()})}),kn=rt.loose(),Mn=Ft.extend({method:r("tasks/list")}),An=xt.extend({tasks:n(Gt)}),Ln=at.extend({method:r("tasks/cancel"),params:dt.extend({taskId:e()})}),Vn=rt.merge(Gt),Dn=c([Er,Eo,Co,Js,bs,ns,rs,ko,Ao,Do,xo,Jo,Bo,_s,fs]),Un=c([$r,wr,To,Zs]),Hn=c([zr,Ns,Is,Hs,Ws]),Fn=c([Er,js,Vs,Ys]),xn=c([$r,wr,zs,es,Ho,ys,ms,Wo,Us]),Kn=c([zr,wo,qo,Gs,ds,os,Mo,Lo,Uo,Or,gs,Xo]),ut=re().superRefine((m,h)=>{if(!URL.canParse(m))return h.addIssue({code:Ai.custom,message:"URL must be parseable",fatal:!0}),Ce}).refine((m)=>{let h=new URL(m);return h.protocol!=="javascript:"&&h.protocol!=="data:"&&h.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Jn=d({resource:e().url(),authorization_servers:n(ut).optional(),jwks_uri:e().url().optional(),scopes_supported:n(e()).optional(),bearer_methods_supported:n(e()).optional(),resource_signing_alg_values_supported:n(e()).optional(),resource_name:e().optional(),resource_documentation:e().optional(),resource_policy_uri:e().url().optional(),resource_tos_uri:e().url().optional(),tls_client_certificate_bound_access_tokens:a().optional(),authorization_details_types_supported:n(e()).optional(),dpop_signing_alg_values_supported:n(e()).optional(),dpop_bound_access_tokens_required:a().optional()}),en=d({issuer:e(),authorization_endpoint:ut,token_endpoint:ut,registration_endpoint:ut.optional(),scopes_supported:n(e()).optional(),response_types_supported:n(e()),response_modes_supported:n(e()).optional(),grant_types_supported:n(e()).optional(),token_endpoint_auth_methods_supported:n(e()).optional(),token_endpoint_auth_signing_alg_values_supported:n(e()).optional(),service_documentation:ut.optional(),revocation_endpoint:ut.optional(),revocation_endpoint_auth_methods_supported:n(e()).optional(),revocation_endpoint_auth_signing_alg_values_supported:n(e()).optional(),introspection_endpoint:e().optional(),introspection_endpoint_auth_methods_supported:n(e()).optional(),introspection_endpoint_auth_signing_alg_values_supported:n(e()).optional(),code_challenge_methods_supported:n(e()).optional(),client_id_metadata_document_supported:a().optional(),authorization_response_iss_parameter_supported:a().optional().catch(void 0)}),tn=d({issuer:e(),authorization_endpoint:ut,token_endpoint:ut,userinfo_endpoint:ut.optional(),jwks_uri:ut,registration_endpoint:ut.optional(),scopes_supported:n(e()).optional(),response_types_supported:n(e()),response_modes_supported:n(e()).optional(),grant_types_supported:n(e()).optional(),acr_values_supported:n(e()).optional(),subject_types_supported:n(e()),id_token_signing_alg_values_supported:n(e()),id_token_encryption_alg_values_supported:n(e()).optional(),id_token_encryption_enc_values_supported:n(e()).optional(),userinfo_signing_alg_values_supported:n(e()).optional(),userinfo_encryption_alg_values_supported:n(e()).optional(),userinfo_encryption_enc_values_supported:n(e()).optional(),request_object_signing_alg_values_supported:n(e()).optional(),request_object_encryption_alg_values_supported:n(e()).optional(),request_object_encryption_enc_values_supported:n(e()).optional(),token_endpoint_auth_methods_supported:n(e()).optional(),token_endpoint_auth_signing_alg_values_supported:n(e()).optional(),display_values_supported:n(e()).optional(),claim_types_supported:n(e()).optional(),claims_supported:n(e()).optional(),service_documentation:e().optional(),claims_locales_supported:n(e()).optional(),ui_locales_supported:n(e()).optional(),claims_parameter_supported:a().optional(),request_parameter_supported:a().optional(),request_uri_parameter_supported:a().optional(),require_request_uri_registration:a().optional(),op_policy_uri:ut.optional(),op_tos_uri:ut.optional(),client_id_metadata_document_supported:a().optional(),authorization_response_iss_parameter_supported:a().optional().catch(void 0)}),Gn=t({...tn.shape,...en.pick({code_challenge_methods_supported:!0}).shape}),Bn=t({access_token:e(),id_token:e().optional(),token_type:e(),expires_in:yl().optional(),scope:e().optional(),refresh_token:e().optional()}).strip(),Yn=t({issued_token_type:r("urn:ietf:params:oauth:token-type:id-jag"),access_token:e(),token_type:e().optional(),expires_in:o().optional(),scope:e().optional()}).strip(),Wn=t({error:e(),error_description:e().optional(),error_uri:e().optional()}),bn=ut.optional().or(r("").transform(()=>{return})),an=t({redirect_uris:n(ut),token_endpoint_auth_method:e().optional(),grant_types:n(e()).optional(),response_types:n(e()).optional(),application_type:e().optional(),client_name:e().optional(),client_uri:ut.optional(),logo_uri:bn,scope:e().optional(),contacts:n(e()).optional(),tos_uri:bn,policy_uri:e().optional(),jwks_uri:ut.optional(),jwks:Te().optional(),software_id:e().optional(),software_version:e().optional(),software_statement:e().optional()}).strip(),rn=t({client_id:e(),client_secret:e().optional(),client_id_issued_at:o().optional(),client_secret_expires_at:o().optional()}).strip(),Zn=an.merge(rn),Xn=t({error:e(),error_description:e().optional()}).strip(),Qn=t({token:e(),token_type_hint:e().optional()}).strip();var ri=Symbol.for("mcp.sdk.errorBrands");function ii(m,h){let f=new Set,g=h;while(typeof g==="function"){let S=g.mcpBrand;if(Object.prototype.hasOwnProperty.call(g,"mcpBrand")&&typeof S==="string")f.add(S);g=Object.getPrototypeOf(g)}if(f.size===0)return;Object.defineProperty(m,ri,{value:f,enumerable:!1,configurable:!0})}function La(m,h){try{if(typeof h==="object"&&h!==null&&Object.prototype.hasOwnProperty.call(m,"mcpBrand")&&typeof m.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(h,ri)){let f=h[ri];if(f&&typeof f.has==="function"&&f.has(m.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(m,h)}var Xm=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](h){return La(this,h)}static isInstance(h){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return La(this,h)}constructor(h,f,g){super(f);this.code=h,this.errorUri=g,this.name="OAuthError",ii(this,new.target)}toResponseObject(){let h={error:this.code,error_description:this.message};if(this.errorUri)h.error_uri=this.errorUri;return h}static fromResponse(h){return new m(h.error,h.error_description??h.error,h.error_uri)}},Be=function(m){return m.NotConnected="NOT_CONNECTED",m.AlreadyConnected="ALREADY_CONNECTED",m.NotInitialized="NOT_INITIALIZED",m.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",m.RequestTimeout="REQUEST_TIMEOUT",m.ConnectionClosed="CONNECTION_CLOSED",m.SendFailed="SEND_FAILED",m.InvalidResult="INVALID_RESULT",m.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",m.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",m.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",m.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",m.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",m.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",m.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",m.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",m.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",m.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",m.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",m}({}),Ke=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](m){return La(this,m)}static isInstance(m){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return La(this,m)}constructor(m,h,f){super(h);this.code=m,this.data=f,this.name="SdkError",ii(this,new.target)}},Qm=class extends Ke{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(m,h,f){super(m,h,f);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function Li(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Ol(m,h,f){return m==="elicitation"&&h==="form"&&f.form===void 0&&f.url===void 0}function Zi(m){switch(m.method){case"elicitation/create":if(m.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let h=m.params;if(h!==void 0&&(h.tools!==void 0||h.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function ci(m,h){let f={};for(let[g,S]of Object.entries(m)){if(S===void 0)continue;let _=h===void 0?void 0:h[g];if(_===void 0){f[g]=S;continue}if(Li(S)&&Li(_)){let y={};for(let[R,v]of Object.entries(S))if(v!==void 0&&_[R]===void 0&&!Ol(g,R,_))y[R]=v;if(Object.keys(y).length>0)f[g]=y}}return Object.keys(f).length>0?f:void 0}var Xi="2026-07-28",P=[Xi];function Da(m){return m>=Xi}function Qi(m){return m.filter((h)=>!Da(h))}function li(m){return m.filter((h)=>Da(h))}function ec(m){let h=m.structuredContent;if(h===void 0)return m;if(!(typeof h!=="object"||h===null||Array.isArray(h)))return m;if(m.content?.some((f)=>f.type==="text")??!1)return m;return{...m,content:[...m.content??[],{type:"text",text:JSON.stringify(h)}]}}var tc=["task","inputRequests","requestState"];function ui(m){if(m===null||typeof m!=="object"||Array.isArray(m)||m.content!==void 0||tc.some((h)=>(h in m)))return m;return{...m,content:[]}}function kl(){let m=H(()=>c([e(),o(),a(),x(),s(e(),m),n(m)])),h=s(e(),m),f=c([e(),o().int()]),g=e(),S=t({ttl:o().optional()}),_=t({taskId:e()}),y=d({progressToken:f.optional(),"io.modelcontextprotocol/related-task":_.optional()}),R=t({_meta:y.optional()}),v=R.extend({task:S.optional()}),E=t({method:e(),params:R.loose().optional()}),O=t({_meta:y.optional()}),L=t({method:e(),params:O.loose().optional()}),G=d({_meta:y.optional()}),Y=c([e(),o().int()]),U=G.strict(),F=O.extend({requestId:Y.optional(),reason:e().optional()}),M=L.extend({method:r("notifications/cancelled"),params:F}),z=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:p(["light","dark"]).optional()}),D=t({icons:n(z).optional()}),w=t({name:e(),title:e().optional()}),K=w.extend({...w.shape,...D.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),W=k(t({applyDefaults:a().optional()}),h),V=A((pt)=>{if(pt&&typeof pt==="object"&&!Array.isArray(pt)&&Object.keys(pt).length===0)return{form:{}};return pt},k(t({form:W.optional(),url:h.optional()}),h.optional())),T=d({list:h.optional(),cancel:h.optional(),requests:d({sampling:d({createMessage:h.optional()}).optional(),elicitation:d({create:h.optional()}).optional()}).optional()}),Z=d({list:h.optional(),cancel:h.optional(),requests:d({tools:d({call:h.optional()}).optional()}).optional()}),ye=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:V.optional(),roots:t({listChanged:a().optional()}).optional(),tasks:T.optional(),extensions:s(e(),h).optional()}),Oe=R.extend({protocolVersion:e(),capabilities:ye,clientInfo:K}),Pe=E.extend({method:r("initialize"),params:Oe}),Ne=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:a().optional()}).optional(),resources:t({subscribe:a().optional(),listChanged:a().optional()}).optional(),tools:t({listChanged:a().optional()}).optional(),tasks:Z.optional(),extensions:s(e(),h).optional()}),Ae=G.extend({protocolVersion:e(),capabilities:Ne,serverInfo:K,instructions:e().optional()}),Me=L.extend({method:r("notifications/initialized"),params:O.optional()}),Ge=E.extend({method:r("ping"),params:R.optional()}),Qe=t({progress:o(),total:u(o()),message:u(e())}),Ze=t({...O.shape,...Qe.shape,progressToken:f}),nt=L.extend({method:r("notifications/progress"),params:Ze}),Ye=R.extend({cursor:g.optional()}),de=E.extend({params:Ye.optional()}),fe=G.extend({nextCursor:g.optional()}),Ie=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),J=Ie.extend({text:e()}),ie=e().refine((pt)=>{try{return atob(pt),!0}catch{return!1}},{message:"Invalid Base64 string"}),pe=Ie.extend({blob:ie}),ke=p(["user","assistant"]),Le=t({audience:n(ke).optional(),priority:o().min(0).max(1).optional(),lastModified:q({offset:!0}).optional()}),Je=t({...w.shape,...D.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:Le.optional(),_meta:u(d({}))}),He=t({...w.shape,...D.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:Le.optional(),_meta:u(d({}))}),Xe=de.extend({method:r("resources/list")}),St=fe.extend({resources:n(Je)}),se=de.extend({method:r("resources/templates/list")}),ge=fe.extend({resourceTemplates:n(He)}),qe=R.extend({uri:e()}),De=qe,Ue=E.extend({method:r("resources/read"),params:De}),xe=G.extend({contents:n(c([J,pe]))}),ot=L.extend({method:r("notifications/resources/list_changed"),params:O.optional()}),ct=qe,mt=E.extend({method:r("resources/subscribe"),params:ct}),it=qe,et=E.extend({method:r("resources/unsubscribe"),params:it}),Rt=O.extend({uri:e()}),lt=L.extend({method:r("notifications/resources/updated"),params:Rt}),Tt=t({name:e(),description:u(e()),required:u(a())}),$t=t({...w.shape,...D.shape,description:u(e()),arguments:u(n(Tt)),_meta:u(d({}))}),Ct=de.extend({method:r("prompts/list")}),It=fe.extend({prompts:n($t)}),Ot=R.extend({name:e(),arguments:s(e(),e()).optional()}),Zt=E.extend({method:r("prompts/get"),params:Ot}),Xt=t({type:r("text"),text:e(),annotations:Le.optional(),_meta:s(e(),l()).optional()}),Qt=t({type:r("image"),data:ie,mimeType:e(),annotations:Le.optional(),_meta:s(e(),l()).optional()}),ea=t({type:r("audio"),data:ie,mimeType:e(),annotations:Le.optional(),_meta:s(e(),l()).optional()}),Fa=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),kt=t({type:r("resource"),resource:c([J,pe]),annotations:Le.optional(),_meta:s(e(),l()).optional()}),xa=Je.extend({type:r("resource_link")}),zt=c([Xt,Qt,ea,xa,kt]),ma=t({role:ke,content:zt}),ha=G.extend({description:e().optional(),messages:n(ma)}),ta=L.extend({method:r("notifications/prompts/list_changed"),params:O.optional()}),Ka=t({title:e().optional(),readOnlyHint:a().optional(),destructiveHint:a().optional(),idempotentHint:a().optional(),openWorldHint:a().optional()}),pa=t({taskSupport:p(["required","optional","forbidden"]).optional()}),aa=t({...w.shape,...D.shape,description:e().optional(),inputSchema:t({type:r("object"),properties:s(e(),m).optional(),required:n(e()).optional()}).catchall(l()),outputSchema:t({type:r("object"),properties:s(e(),m).optional(),required:n(e()).optional()}).catchall(l()).optional(),annotations:Ka.optional(),execution:pa.optional(),_meta:s(e(),l()).optional()}),fa=de.extend({method:r("tools/list")}),ga=fe.extend({tools:n(aa)}),Sa=G.extend({content:n(zt),structuredContent:s(e(),l()).optional(),isError:a().optional()}),ht=v.extend({name:e(),arguments:s(e(),l()).optional()}),Ja=E.extend({method:r("tools/call"),params:ht}),Zr=L.extend({method:r("notifications/tools/list_changed"),params:O.optional()}),_a=p(["debug","info","notice","warning","error","critical","alert","emergency"]),Ga=R.extend({level:_a}),Ba=E.extend({method:r("logging/setLevel"),params:Ga}),Ya=O.extend({level:_a,logger:e().optional(),data:l()}),Wa=L.extend({method:r("notifications/message"),params:Ya}),Za=t({name:e().optional()}),Xa=t({hints:n(Za).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),Qa=t({mode:p(["auto","required","none"]).optional()}),Xr=t({type:r("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:n(zt),structuredContent:t({}).loose().optional(),isError:a().optional(),_meta:s(e(),l()).optional()}),er=C("type",[Xt,Qt,ea]),Mt=C("type",[Xt,Qt,ea,Fa,Xr]),tr=t({role:ke,content:c([Mt,n(Mt)]),_meta:s(e(),l()).optional()}),ar=v.extend({messages:n(tr),modelPreferences:Xa.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:h.optional(),tools:n(aa).optional(),toolChoice:Qa.optional()}),rr=E.extend({method:r("sampling/createMessage"),params:ar}),or=G.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens"]).or(e())),role:ke,content:er}),sr=G.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:ke,content:c([Mt,n(Mt)])}),nr=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:a().optional()}),ir=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),cr=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),lr=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),ur=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),dr=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),mr=c([lr,ur]),ra=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),oa=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),Qr=c([ra,oa]),eo=c([dr,mr,Qr]),vt=c([eo,nr,ir,cr]),bt=v.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),vt),required:n(e()).optional()}).catchall(l())}),hr=v.extend({mode:r("url"),message:e(),elicitationId:e(),url:e().url()}),Pt=c([bt,hr]),to=E.extend({method:r("elicitation/create"),params:Pt}),ao=O.extend({elicitationId:e()}),ro=L.extend({method:r("notifications/elicitation/complete"),params:ao}),oo=G.extend({action:p(["accept","decline","cancel"]),content:A((pt)=>pt===null?void 0:pt,s(e(),c([e(),o(),a(),n(e())])).optional())}),so=t({type:r("ref/resource"),uri:e()}),no=t({type:r("ref/prompt"),name:e()}),io=R.extend({ref:c([no,so]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),pr=E.extend({method:r("completion/complete"),params:io}),co=G.extend({completion:d({values:n(e()).max(100),total:u(o().int()),hasMore:u(a())})}),lo=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),ya=E.extend({method:r("roots/list"),params:R.optional()}),fr=G.extend({roots:n(lo)}),uo=L.extend({method:r("notifications/roots/list_changed"),params:O.optional()}),mo=d({ttl:o().optional(),pollInterval:o().optional()}),ho=p(["working","input_required","completed","failed","cancelled"]),At=t({taskId:e(),status:ho,ttl:c([o(),x()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:u(o()),statusMessage:u(e())}),_t=G.extend({task:At}),po=O.merge(At),sa=L.extend({method:r("notifications/tasks/status"),params:po}),va=E.extend({method:r("tasks/get"),params:R.extend({taskId:e()})}),ba=G.merge(At),Ra=E.extend({method:r("tasks/result"),params:R.extend({taskId:e()})}),vn=G.loose(),yt=de.extend({method:r("tasks/list")}),st=fe.extend({tasks:n(At)}),na=E.extend({method:r("tasks/cancel"),params:R.extend({taskId:e()})});return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:f,CursorSchema:g,TaskMetadataSchema:S,RelatedTaskMetadataSchema:_,RequestMetaSchema:y,BaseRequestParamsSchema:R,TaskAugmentedRequestParamsSchema:v,RequestSchema:E,NotificationsParamsSchema:O,NotificationSchema:L,ResultSchema:G,RequestIdSchema:Y,EmptyResultSchema:U,CancelledNotificationParamsSchema:F,CancelledNotificationSchema:M,IconSchema:z,IconsSchema:D,BaseMetadataSchema:w,ImplementationSchema:K,ClientTasksCapabilitySchema:T,ServerTasksCapabilitySchema:Z,ClientCapabilitiesSchema:ye,InitializeRequestParamsSchema:Oe,InitializeRequestSchema:Pe,ServerCapabilitiesSchema:Ne,InitializeResultSchema:Ae,InitializedNotificationSchema:Me,PingRequestSchema:Ge,ProgressSchema:Qe,ProgressNotificationParamsSchema:Ze,ProgressNotificationSchema:nt,PaginatedRequestParamsSchema:Ye,PaginatedRequestSchema:de,PaginatedResultSchema:fe,ResourceContentsSchema:Ie,TextResourceContentsSchema:J,BlobResourceContentsSchema:pe,RoleSchema:ke,AnnotationsSchema:Le,ResourceSchema:Je,ResourceTemplateSchema:He,ListResourcesRequestSchema:Xe,ListResourcesResultSchema:St,ListResourceTemplatesRequestSchema:se,ListResourceTemplatesResultSchema:ge,ResourceRequestParamsSchema:qe,ReadResourceRequestParamsSchema:De,ReadResourceRequestSchema:Ue,ReadResourceResultSchema:xe,ResourceListChangedNotificationSchema:ot,SubscribeRequestParamsSchema:ct,SubscribeRequestSchema:mt,UnsubscribeRequestParamsSchema:it,UnsubscribeRequestSchema:et,ResourceUpdatedNotificationParamsSchema:Rt,ResourceUpdatedNotificationSchema:lt,PromptArgumentSchema:Tt,PromptSchema:$t,ListPromptsRequestSchema:Ct,ListPromptsResultSchema:It,GetPromptRequestParamsSchema:Ot,GetPromptRequestSchema:Zt,TextContentSchema:Xt,ImageContentSchema:Qt,AudioContentSchema:ea,ToolUseContentSchema:Fa,EmbeddedResourceSchema:kt,ResourceLinkSchema:xa,ContentBlockSchema:zt,PromptMessageSchema:ma,GetPromptResultSchema:ha,PromptListChangedNotificationSchema:ta,ToolAnnotationsSchema:Ka,ToolExecutionSchema:pa,ToolSchema:aa,ListToolsRequestSchema:fa,ListToolsResultSchema:ga,CallToolResultSchema:Sa,CallToolRequestParamsSchema:ht,CallToolRequestSchema:Ja,ToolListChangedNotificationSchema:Zr,LoggingLevelSchema:_a,SetLevelRequestParamsSchema:Ga,SetLevelRequestSchema:Ba,LoggingMessageNotificationParamsSchema:Ya,LoggingMessageNotificationSchema:Wa,ModelHintSchema:Za,ModelPreferencesSchema:Xa,ToolChoiceSchema:Qa,ToolResultContentSchema:Xr,SamplingContentSchema:er,SamplingMessageContentBlockSchema:Mt,SamplingMessageSchema:tr,CreateMessageRequestParamsSchema:ar,CreateMessageRequestSchema:rr,CreateMessageResultSchema:or,CreateMessageResultWithToolsSchema:sr,BooleanSchemaSchema:nr,StringSchemaSchema:ir,NumberSchemaSchema:cr,UntitledSingleSelectEnumSchemaSchema:lr,TitledSingleSelectEnumSchemaSchema:ur,LegacyTitledEnumSchemaSchema:dr,SingleSelectEnumSchemaSchema:mr,UntitledMultiSelectEnumSchemaSchema:ra,TitledMultiSelectEnumSchemaSchema:oa,MultiSelectEnumSchemaSchema:Qr,EnumSchemaSchema:eo,PrimitiveSchemaDefinitionSchema:vt,ElicitRequestFormParamsSchema:bt,ElicitRequestURLParamsSchema:hr,ElicitRequestParamsSchema:Pt,ElicitRequestSchema:to,ElicitationCompleteNotificationParamsSchema:ao,ElicitationCompleteNotificationSchema:ro,ElicitResultSchema:oo,ResourceTemplateReferenceSchema:so,PromptReferenceSchema:no,CompleteRequestParamsSchema:io,CompleteRequestSchema:pr,CompleteResultSchema:co,RootSchema:lo,ListRootsRequestSchema:ya,ListRootsResultSchema:fr,RootsListChangedNotificationSchema:uo,TaskCreationParamsSchema:mo,TaskStatusSchema:ho,TaskSchema:At,CreateTaskResultSchema:_t,TaskStatusNotificationParamsSchema:po,TaskStatusNotificationSchema:sa,GetTaskRequestSchema:va,GetTaskResultSchema:ba,GetTaskPayloadRequestSchema:Ra,GetTaskPayloadResultSchema:vn,ListTasksRequestSchema:yt,ListTasksResultSchema:st,CancelTaskRequestSchema:na,CancelTaskResultSchema:G.merge(At),ClientRequestSchema:c([Ge,Pe,pr,Ba,Zt,Ct,Xe,se,Ue,mt,et,Ja,fa,va,Ra,yt,na]),ClientNotificationSchema:c([M,nt,Me,uo,sa]),ClientResultSchema:c([U,or,sr,oo,fr,ba,st,_t]),ServerRequestSchema:c([Ge,rr,to,ya,va,Ra,yt,na]),ServerNotificationSchema:c([M,nt,Wa,lt,ot,Zr,ta,sa,ro]),ServerResultSchema:c([U,Ae,co,ha,It,St,ge,xe,Sa,ga,ba,st,_t]),CallToolResultWireSchema:l().superRefine((pt,ll)=>{if(typeof pt!=="object"||pt===null||Array.isArray(pt)||pt.content!==void 0)return;for(let ji of tc)if(ji in pt){ll.addIssue({code:"custom",message:`content is required when the body carries '${ji}' — another result family cannot default into an empty tools/call success`});return}}).transform(ui).pipe(Sa)}}var Ml;function ac(){return Ml??=kl()}function rc(m){return m.type!=="object"}var Al=new Set(["const","enum","default","examples"]),Ll=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Vi(m){return m!==void 0&&!(typeof m==="string"&&m.startsWith("#"))}function Vl(m){let h=typeof m.$schema==="string"?m.$schema:void 0;if(Vi(m.$id))return{...h!==void 0&&{$schema:h},type:"object",properties:{result:m},required:["result"]};let f=Oi(m.$schema)&&m.$recursiveAnchor!==!0,g=(S,_)=>{if(Array.isArray(S))return S.map((v)=>g(v,!1));if(S===null||typeof S!=="object")return S;if(!_&&Vi(S.$id))return S;let y={},R=!1;for(let[v,E]of Object.entries(S))if(_)y[v]=g(E,!1);else if((v==="$ref"||v==="$dynamicRef")&&typeof E==="string")y[v]=E==="#"?"#/properties/result":E.startsWith("#/")?`#/properties/result${E.slice(1)}`:E;else if(v==="$recursiveRef"&&E==="#"&&f)R=!0;else if(Al.has(v))y[v]=E;else if(Ll.has(v))y[v]=g(E,!0);else y[v]=g(E,!1);if(R)if("$ref"in y)y.allOf=[...Array.isArray(y.allOf)?y.allOf:[],{$ref:"#/properties/result"}];else y.$ref="#/properties/result";return y};return{...h!==void 0&&{$schema:h},type:"object",properties:{result:g(m,!1)},required:["result"]}}var oc={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},sc={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Dl={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},on;function di(){if(on)return on;let m=ac();return on={requestSchemas:{ping:m.PingRequestSchema,initialize:m.InitializeRequestSchema,"completion/complete":m.CompleteRequestSchema,"logging/setLevel":m.SetLevelRequestSchema,"prompts/get":m.GetPromptRequestSchema,"prompts/list":m.ListPromptsRequestSchema,"resources/list":m.ListResourcesRequestSchema,"resources/templates/list":m.ListResourceTemplatesRequestSchema,"resources/read":m.ReadResourceRequestSchema,"resources/subscribe":m.SubscribeRequestSchema,"resources/unsubscribe":m.UnsubscribeRequestSchema,"tools/call":m.CallToolRequestSchema,"tools/list":m.ListToolsRequestSchema,"tasks/get":m.GetTaskRequestSchema,"tasks/result":m.GetTaskPayloadRequestSchema,"tasks/list":m.ListTasksRequestSchema,"tasks/cancel":m.CancelTaskRequestSchema,"sampling/createMessage":m.CreateMessageRequestSchema,"elicitation/create":m.ElicitRequestSchema,"roots/list":m.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":m.CancelledNotificationSchema,"notifications/progress":m.ProgressNotificationSchema,"notifications/initialized":m.InitializedNotificationSchema,"notifications/roots/list_changed":m.RootsListChangedNotificationSchema,"notifications/tasks/status":m.TaskStatusNotificationSchema,"notifications/message":m.LoggingMessageNotificationSchema,"notifications/resources/updated":m.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":m.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":m.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":m.PromptListChangedNotificationSchema,"notifications/elicitation/complete":m.ElicitationCompleteNotificationSchema},resultSchemas:{ping:m.EmptyResultSchema,initialize:m.InitializeResultSchema,"completion/complete":m.CompleteResultSchema,"logging/setLevel":m.EmptyResultSchema,"prompts/get":m.GetPromptResultSchema,"prompts/list":m.ListPromptsResultSchema,"resources/list":m.ListResourcesResultSchema,"resources/templates/list":m.ListResourceTemplatesResultSchema,"resources/read":m.ReadResourceResultSchema,"resources/subscribe":m.EmptyResultSchema,"resources/unsubscribe":m.EmptyResultSchema,"tools/call":m.CallToolResultWireSchema,"tools/list":m.ListToolsResultSchema,"sampling/createMessage":m.CreateMessageResultWithToolsSchema,"elicitation/create":m.ElicitResultSchema,"roots/list":m.ListRootsResultSchema}},on}function nc(m){return Object.prototype.hasOwnProperty.call(oc,m)}function ic(m){return Object.prototype.hasOwnProperty.call(sc,m)}function Ul(m){return Object.prototype.hasOwnProperty.call(Dl,m)}function Hl(m){return Ul(m)?di().resultSchemas[m]:void 0}function Fl(m){return nc(m)?di().requestSchemas[m]:void 0}function xl(m){return ic(m)?di().notificationSchemas[m]:void 0}var eh=Object.keys(oc),th=Object.keys(sc);function oi(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function sn(m,h){if(m===void 0)return{ok:!1,reason:"not-in-era"};let f=m.safeParse(h);return f.success?{ok:!0,value:f.data}:{ok:!1,reason:"invalid",message:String(f.error)}}var Di={ok:!1,reason:"not-in-era"};function Ui(m){return oi(m)&&oi(m.outputSchema)&&rc(m.outputSchema)}function Hi(m){return m}var mi={era:"2025-11-25",hasRequestMethod:nc,hasNotificationMethod:ic,validateRequest:(m,h)=>sn(Fl(m),h),validateResult:(m,h)=>sn(Hl(m),h),validateNotification:(m,h)=>sn(xl(m),h),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Di,validateInputResponse:()=>Di,samplingResultVariant:(m,h)=>{let f=ac();return sn(m?f.CreateMessageResultWithToolsSchema:f.CreateMessageResultSchema,h)},outboundEnvelope:(m)=>{return},validateEnvelopeMeta:(m)=>[],projectCallToolResult(m,h){let f=ec(m),g=f.structuredContent;if(g===void 0)return f;let S=typeof g!=="object"||g===null||Array.isArray(g),_=h!==void 0&&rc(h);if(!S&&!_)return f;return{...f,structuredContent:{result:g}}},decodeResult(m,h){if(oi(h)&&"resultType"in h){let f={...h};return delete f.resultType,{kind:"complete",result:Hi(f)}}return{kind:"complete",result:Hi(h)}},encodeResult(m,h){if(m!=="tools/list")return h;let f=h.tools;if(!Array.isArray(f)||!f.some((g)=>Ui(g)))return h;return{...h,tools:f.map((g)=>Ui(g)?{...g,outputSchema:Vl(g.outputSchema)}:g)}},encodeErrorCode:(m)=>m===-32002?-32602:m,checkInboundEnvelope:(m)=>{return}};function Kl(){let m=H(()=>c([e(),o(),a(),x(),s(e(),m),n(m)])),h=s(e(),m),f=c([e(),o().int()]),g=e(),S=c([e(),o().int()]),_=p(["user","assistant"]),y=p(["debug","info","notice","warning","error","critical","alert","emergency"]),R=e().refine((st)=>{try{return atob(st),!0}catch{return!1}},{message:"Invalid Base64 string"}),v=t({ttl:o().optional()}),E=t({taskId:e()}),O=d({progressToken:f.optional(),"io.modelcontextprotocol/related-task":E.optional()}),L=t({_meta:O.optional()}),G=L.extend({task:v.optional()}),Y=t({_meta:O.optional()}),U=t({method:e(),params:Y.loose().optional()}),F=t({src:e(),mimeType:e().optional(),sizes:n(e()).optional(),theme:p(["light","dark"]).optional()}),M=t({icons:n(F).optional()}),z=t({name:e(),title:e().optional()}),D=z.extend({...z.shape,...M.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),w=k(t({applyDefaults:a().optional()}),h),K=A((st)=>{if(st&&typeof st==="object"&&!Array.isArray(st)&&Object.keys(st).length===0)return{form:{}};return st},k(t({form:w.optional(),url:h.optional()}),h.optional())),W=d({list:h.optional(),cancel:h.optional(),requests:d({sampling:d({createMessage:h.optional()}).optional(),elicitation:d({create:h.optional()}).optional()}).optional()}),V=d({list:h.optional(),cancel:h.optional(),requests:d({tools:d({call:h.optional()}).optional()}).optional()}),T=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:K.optional(),roots:t({listChanged:a().optional()}).optional(),tasks:W.optional(),extensions:s(e(),h).optional()}),Z=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:a().optional()}).optional(),resources:t({subscribe:a().optional(),listChanged:a().optional()}).optional(),tools:t({listChanged:a().optional()}).optional(),tasks:V.optional(),extensions:s(e(),h).optional()}),ye=t({progress:o(),total:u(o()),message:u(e())}),Oe=t({...Y.shape,...ye.shape,progressToken:f}),Pe=U.extend({method:r("notifications/progress"),params:Oe}),Ne=Y.extend({level:y,logger:e().optional(),data:l()}),Ae=U.extend({method:r("notifications/message"),params:Ne}),Me=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),Ge=Me.extend({text:e()}),Qe=Me.extend({blob:R}),Ze=t({audience:n(_).optional(),priority:o().min(0).max(1).optional(),lastModified:q({offset:!0}).optional()}),nt=t({...z.shape,...M.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:Ze.optional(),_meta:u(d({}))}),Ye=t({...z.shape,...M.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:Ze.optional(),_meta:u(d({}))}),de=U.extend({method:r("notifications/resources/list_changed"),params:Y.optional()}),fe=Y.extend({uri:e()}),Ie=U.extend({method:r("notifications/resources/updated"),params:fe}),J=t({name:e(),description:u(e()),required:u(a())}),ie=t({...z.shape,...M.shape,description:u(e()),arguments:u(n(J)),_meta:u(d({}))}),pe=U.extend({method:r("notifications/prompts/list_changed"),params:Y.optional()}),ke=t({type:r("text"),text:e(),annotations:Ze.optional(),_meta:s(e(),l()).optional()}),Le=t({type:r("image"),data:R,mimeType:e(),annotations:Ze.optional(),_meta:s(e(),l()).optional()}),Je=t({type:r("audio"),data:R,mimeType:e(),annotations:Ze.optional(),_meta:s(e(),l()).optional()}),He=t({type:r("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),Xe=t({type:r("resource"),resource:c([Ge,Qe]),annotations:Ze.optional(),_meta:s(e(),l()).optional()}),St=nt.extend({type:r("resource_link")}),se=c([ke,Le,Je,St,Xe]),ge=t({role:_,content:se}),qe=t({title:e().optional(),readOnlyHint:a().optional(),destructiveHint:a().optional(),idempotentHint:a().optional(),openWorldHint:a().optional()}),De=U.extend({method:r("notifications/tools/list_changed"),params:Y.optional()}),Ue=t({name:e().optional()}),xe=t({hints:n(Ue).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),ot=t({mode:p(["auto","required","none"]).optional()}),ct=t({type:r("boolean"),title:e().optional(),description:e().optional(),default:a().optional()}),mt=t({type:r("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),it=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),et=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),default:e().optional()}),Rt=t({type:r("string"),title:e().optional(),description:e().optional(),oneOf:n(t({const:e(),title:e()})),default:e().optional()}),lt=t({type:r("string"),title:e().optional(),description:e().optional(),enum:n(e()),enumNames:n(e()).optional(),default:e().optional()}),Tt=c([et,Rt]),$t=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:r("string"),enum:n(e())}),default:n(e()).optional()}),Ct=t({type:r("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:n(t({const:e(),title:e()}))}),default:n(e()).optional()}),It=c([$t,Ct]),Ot=c([lt,Tt,It]),Zt=c([Ot,ct,mt,it]),Xt=G.extend({mode:r("form").optional(),message:e(),requestedSchema:t({type:r("object"),properties:s(e(),Zt),required:n(e()).optional()}).catchall(l())}),Qt=t({type:r("ref/resource"),uri:e()}),ea=t({type:r("ref/prompt"),name:e()}),Fa=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),kt=T.shape,xa=t({experimental:kt.experimental,sampling:kt.sampling,elicitation:kt.elicitation,roots:kt.roots,extensions:kt.extensions}),zt=Z.shape,ma=t({experimental:zt.experimental,logging:zt.logging,completions:zt.completions,prompts:zt.prompts,resources:zt.resources,tools:zt.tools,extensions:zt.extensions}),ha=d({progressToken:f.optional(),[Vt]:e(),[gr]:D.optional(),[Dt]:xa,[ca]:y.optional()}),ta=t({...z.shape,...M.shape,description:e().optional(),inputSchema:d({$schema:e().optional(),type:r("object")}),outputSchema:d({$schema:e().optional()}).optional(),annotations:qe.optional(),_meta:s(e(),l()).optional()}),Ka=t({type:r("tool_result"),toolUseId:e(),content:n(se),structuredContent:l().optional(),isError:a().optional(),_meta:s(e(),l()).optional()}),pa=c([ke,Le,Je,He,Ka]),aa=t({role:_,content:c([pa,n(pa)]),_meta:s(e(),l()).optional()}),fa=e(),ga=d({[jt]:D.optional().catch(void 0)}),Sa=ga.optional();function ht(st){return d({_meta:Sa,resultType:fa.default("complete"),...st})}let Ja=ht({}),Zr=ht({nextCursor:g.optional()}),_a=ht({content:n(se),structuredContent:l().optional(),isError:a().optional()}),Ga=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),tools:n(ta),nextCursor:g.optional()}),Ba=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),prompts:n(ie),nextCursor:g.optional()}),Ya=ht({description:e().optional(),messages:n(ge)}),Wa=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resources:n(nt),nextCursor:g.optional()}),Za=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resourceTemplates:n(Ye),nextCursor:g.optional()}),Xa=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),contents:n(c([Ge,Qe]))}),Qa=ht({completion:t({values:n(e()).max(100),total:o().int().optional(),hasMore:a().optional()}).loose()}),Xr=ht({ttlMs:o().int().min(0),cacheScope:p(["public","private"])}),er=ht({ttlMs:o().int().min(0).catch(0),cacheScope:p(["public","private"]).catch("private"),supportedVersions:n(e()),capabilities:ma,instructions:e().optional()}),Mt=t({messages:n(aa),modelPreferences:xe.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:n(e()).optional(),metadata:h.optional(),tools:n(ta).optional(),toolChoice:ot.optional()}),tr=t({method:r("sampling/createMessage"),params:Mt}),ar=t({method:r("roots/list"),params:t({_meta:s(e(),l()).optional()}).optional()}),rr=t({...aa.shape,model:e(),stopReason:e().optional()}),or=t({roots:n(Fa)}),sr=t({action:p(["accept","decline","cancel"]),content:s(e(),c([e(),o(),a(),n(e())])).optional()}),nr=t({mode:r("url"),message:e(),url:e().url()}),ir=c([Xt,nr]),cr=t({method:r("elicitation/create"),params:ir}),lr=c([tr,ar,cr]),ur=c([rr,or,sr]),dr=s(e(),lr),mr=s(e(),ur),ra=ht({inputRequests:dr.optional(),requestState:e().optional()}),oa={inputResponses:mr.optional(),requestState:e().optional()},Qr=t({_meta:ha,...oa}),eo=d({progressToken:f.optional()});function vt(st,na){return t({method:r(st),params:t({_meta:ha,...na})})}function bt(st,na){return t({method:r(st),params:t({_meta:eo.optional(),...na}).optional()})}let hr={name:e(),arguments:s(e(),l()).optional(),...oa},Pt={cursor:g.optional()},to=vt("tools/call",hr),ao=vt("tools/list",Pt),ro=vt("prompts/list",Pt),oo=vt("prompts/get",{name:e(),arguments:s(e(),e()).optional(),...oa}),so=vt("resources/list",Pt),no=vt("resources/templates/list",Pt),io=vt("resources/read",{uri:e(),...oa}),pr={ref:c([ea,Qt]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()},co=vt("completion/complete",pr),lo=vt("server/discover",{}),ya=t({toolsListChanged:a().optional(),promptsListChanged:a().optional(),resourcesListChanged:a().optional(),resourceSubscriptions:n(e()).optional()}),fr={notifications:ya},uo=vt("subscriptions/listen",fr),mo=ga.extend({"io.modelcontextprotocol/subscriptionId":S}),ho=d({_meta:mo,resultType:fa.default("complete")}),At={"tools/call":bt("tools/call",hr),"tools/list":bt("tools/list",Pt),"prompts/get":bt("prompts/get",{name:e(),arguments:s(e(),e()).optional()}),"prompts/list":bt("prompts/list",Pt),"resources/list":bt("resources/list",Pt),"resources/templates/list":bt("resources/templates/list",Pt),"resources/read":bt("resources/read",{uri:e()}),"completion/complete":bt("completion/complete",pr),"server/discover":bt("server/discover",{}),"subscriptions/listen":bt("subscriptions/listen",fr)};function _t(st){return d({_meta:Sa,...st})}let po={"tools/call":_t({content:n(se),structuredContent:l().optional(),isError:a().optional()}),"tools/list":_t({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),tools:n(ta),nextCursor:g.optional()}),"prompts/get":_t({description:e().optional(),messages:n(ge)}),"prompts/list":_t({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),prompts:n(ie),nextCursor:g.optional()}),"resources/list":_t({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resources:n(nt),nextCursor:g.optional()}),"resources/templates/list":_t({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resourceTemplates:n(Ye),nextCursor:g.optional()}),"resources/read":_t({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),contents:n(c([Ge,Qe]))}),"completion/complete":_t({completion:t({values:n(e()).max(100),total:o().int().optional(),hasMore:a().optional()}).loose()}),"server/discover":_t({ttlMs:o().int().min(0).catch(0),cacheScope:p(["public","private"]).catch("private"),supportedVersions:n(e()),capabilities:ma,instructions:e().optional()}),"subscriptions/listen":_t({})},sa=d({"io.modelcontextprotocol/subscriptionId":S.optional()}),va=t({method:r("notifications/subscriptions/acknowledged"),params:t({_meta:sa.optional(),notifications:ya})}),ba=t({_meta:sa.optional(),requestId:S,reason:e().optional()}),Ra=t({method:r("notifications/cancelled"),params:ba}),vn={"notifications/cancelled":Ra,"notifications/progress":Pe,"notifications/message":Ae,"notifications/resources/updated":Ie,"notifications/resources/list_changed":de,"notifications/tools/list_changed":De,"notifications/prompts/list_changed":pe,"notifications/subscriptions/acknowledged":va},yt=(st)=>t({jsonrpc:r("2.0"),id:c([e(),o().int()]),result:st}).strict();return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:f,CursorSchema:g,RequestIdSchema:S,RoleSchema:_,LoggingLevelSchema:y,TaskMetadataSchema:v,RelatedTaskMetadataSchema:E,RequestMetaSchema:O,BaseRequestParamsSchema:L,TaskAugmentedRequestParamsSchema:G,NotificationsParamsSchema:Y,NotificationSchema:U,IconSchema:F,IconsSchema:M,BaseMetadataSchema:z,ImplementationSchema:D,ClientTasksCapabilitySchema:W,ServerTasksCapabilitySchema:V,ClientCapabilitiesSchema:T,ServerCapabilitiesSchema:Z,ProgressSchema:ye,ProgressNotificationParamsSchema:Oe,ProgressNotificationSchema:Pe,LoggingMessageNotificationParamsSchema:Ne,LoggingMessageNotificationSchema:Ae,ResourceContentsSchema:Me,TextResourceContentsSchema:Ge,BlobResourceContentsSchema:Qe,AnnotationsSchema:Ze,ResourceSchema:nt,ResourceTemplateSchema:Ye,ResourceListChangedNotificationSchema:de,ResourceUpdatedNotificationParamsSchema:fe,ResourceUpdatedNotificationSchema:Ie,PromptArgumentSchema:J,PromptSchema:ie,PromptListChangedNotificationSchema:pe,TextContentSchema:ke,ImageContentSchema:Le,AudioContentSchema:Je,ToolUseContentSchema:He,EmbeddedResourceSchema:Xe,ResourceLinkSchema:St,ContentBlockSchema:se,PromptMessageSchema:ge,ToolAnnotationsSchema:qe,ToolListChangedNotificationSchema:De,ModelHintSchema:Ue,ModelPreferencesSchema:xe,ToolChoiceSchema:ot,BooleanSchemaSchema:ct,StringSchemaSchema:mt,NumberSchemaSchema:it,UntitledSingleSelectEnumSchemaSchema:et,TitledSingleSelectEnumSchemaSchema:Rt,LegacyTitledEnumSchemaSchema:lt,SingleSelectEnumSchemaSchema:Tt,UntitledMultiSelectEnumSchemaSchema:$t,TitledMultiSelectEnumSchemaSchema:Ct,MultiSelectEnumSchemaSchema:It,EnumSchemaSchema:Ot,PrimitiveSchemaDefinitionSchema:Zt,ElicitRequestFormParamsSchema:Xt,ResourceTemplateReferenceSchema:Qt,PromptReferenceSchema:ea,RootSchema:Fa,ClientCapabilities2026Schema:xa,ServerCapabilities2026Schema:ma,RequestMetaEnvelopeSchema:ha,ToolSchema:ta,ToolResultContentSchema:Ka,SamplingMessageContentBlockSchema:pa,SamplingMessageSchema:aa,ResultTypeSchema:fa,ResultMetaSchema:ga,ResultSchema:Ja,PaginatedResultSchema:Zr,CallToolResultSchema:_a,ListToolsResultSchema:Ga,ListPromptsResultSchema:Ba,GetPromptResultSchema:Ya,ListResourcesResultSchema:Wa,ListResourceTemplatesResultSchema:Za,ReadResourceResultSchema:Xa,CompleteResultSchema:Qa,CacheableResultSchema:Xr,DiscoverResultSchema:er,CreateMessageRequestParamsSchema:Mt,CreateMessageRequestSchema:tr,ListRootsRequestSchema:ar,CreateMessageResultSchema:rr,ListRootsResultSchema:or,ElicitResultSchema:sr,ElicitRequestURLParamsSchema:nr,ElicitRequestParamsSchema:ir,ElicitRequestSchema:cr,InputRequestSchema:lr,InputResponseSchema:ur,InputRequestsSchema:dr,InputResponsesSchema:mr,InputRequiredResultSchema:ra,InputResponseRequestParamsSchema:Qr,CallToolRequestSchema:to,ListToolsRequestSchema:ao,ListPromptsRequestSchema:ro,GetPromptRequestSchema:oo,ListResourcesRequestSchema:so,ListResourceTemplatesRequestSchema:no,ReadResourceRequestSchema:io,CompleteRequestSchema:co,DiscoverRequestSchema:lo,SubscriptionFilterSchema:ya,SubscriptionsListenRequestSchema:uo,SubscriptionsListenResultMetaSchema:mo,SubscriptionsListenResultSchema:ho,dispatchRequestSchemas:At,dispatchResultSchemas:po,NotificationMetaSchema:sa,SubscriptionsAcknowledgedNotificationSchema:va,CancelledNotificationParamsSchema:ba,CancelledNotificationSchema:Ra,notificationSchemas2026:vn,JSONRPCResultResponseSchema:yt(Ja),CallToolResultResponseSchema:yt(c([_a,ra])),ListToolsResultResponseSchema:yt(Ga),ListPromptsResultResponseSchema:yt(Ba),GetPromptResultResponseSchema:yt(c([Ya,ra])),ListResourcesResultResponseSchema:yt(Wa),ListResourceTemplatesResultResponseSchema:yt(Za),ReadResourceResultResponseSchema:yt(c([Xa,ra])),CompleteResultResponseSchema:yt(Qa),DiscoverResultResponseSchema:yt(er)}}var Jl;function da(){return Jl??=Kl()}var Gl=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function Bl(m){return Gl.includes(m)}var Aa=Symbol("modelcontextprotocol.resultCacheHintFallback");function mn(m,h){if(h===void 0)return m;let f=m[Aa];if(f===void 0)return{...m,[Aa]:h};let g={},S=f.ttlMs??h.ttlMs;if(S!==void 0)g.ttlMs=S;let _=f.cacheScope??h.cacheScope;if(_!==void 0)g.cacheScope=_;return{...m,[Aa]:g}}function Yl(m){return m[Aa]}function hi(m){return typeof m==="number"&&Number.isSafeInteger(m)&&m>=0}function pi(m){return m==="public"||m==="private"}function fi(m,h){if(m.ttlMs!==void 0&&!hi(m.ttlMs))throw RangeError(`Invalid cache hint for ${h}: ttlMs must be a non-negative safe integer (got ${String(m.ttlMs)})`);if(m.cacheScope!==void 0&&!pi(m.cacheScope))throw RangeError(`Invalid cache hint for ${h}: cacheScope must be 'public' or 'private' (got ${String(m.cacheScope)})`)}var i=function(m){return m[m.ParseError=-32700]="ParseError",m[m.InvalidRequest=-32600]="InvalidRequest",m[m.MethodNotFound=-32601]="MethodNotFound",m[m.InvalidParams=-32602]="InvalidParams",m[m.InternalError=-32603]="InternalError",m[m.ResourceNotFound=-32002]="ResourceNotFound",m[m.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",m[m.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",m[m.UrlElicitationRequired=-32042]="UrlElicitationRequired",m}({}),Ve=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](h){return La(this,h)}static isInstance(h){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return La(this,h)}constructor(h,f,g){super(f);this.code=h,this.data=g,this.name="ProtocolError",ii(this,new.target)}static fromError(h,f,g){if(h===i.UrlElicitationRequired&&g){let S=g;if(S.elicitations)return new Wl(S.elicitations,f)}if(h===i.UnsupportedProtocolVersion&&g){let S=g;if(Array.isArray(S.supported)&&typeof S.requested==="string")return new B({supported:S.supported,requested:S.requested},f)}if(h===i.InvalidParams||h===i.ResourceNotFound){let S=g;if(typeof S?.uri==="string"&&(h===i.ResourceNotFound||Object.keys(S).length===1))return new gi(S.uri,f)}if(h===i.MissingRequiredClientCapability&&g){let S=g;if(S.requiredCapabilities!==null&&typeof S.requiredCapabilities==="object"&&!Array.isArray(S.requiredCapabilities))return new Si({requiredCapabilities:S.requiredCapabilities},f)}return new m(h,f,g)}},gi=class extends Ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(m,h=`Resource not found: ${m}`){super(i.InvalidParams,h,{uri:m})}get uri(){return this.data.uri}},Wl=class extends Ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(m,h=`URL elicitation${m.length>1?"s":""} required`){super(i.UrlElicitationRequired,h,{elicitations:m})}get elicitations(){return this.data?.elicitations??[]}},B=class extends Ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(m,h=`Unsupported protocol version: ${m.requested}`){super(i.UnsupportedProtocolVersion,h,m)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Si=class extends Ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(m,h=`Missing required client capabilities: ${Object.keys(m.requiredCapabilities).join(", ")}`){super(i.MissingRequiredClientCapability,h,m)}get requiredCapabilities(){return this.data.requiredCapabilities}},Zl=0,Xl="private",Ql=["tools/call","prompts/get","resources/read"];function eu(m,h){let f=h.resultType;if(f===void 0)return{...h,resultType:"complete"};if(f==="complete")return h;if(Ql.includes(m))return h;throw new Ve(i.InternalError,`Handler for ${m} returned resultType '${String(f)}', but results of ${m} only support 'complete' on protocol revision 2026-07-28`)}function tu(m,h){let f=Yl(h);if(h.resultType!=="complete"||!Bl(m))return f===void 0?h:nu(h);let g=h,S=hi(g.ttlMs)?g.ttlMs:ou(f),_=pi(g.cacheScope)?g.cacheScope:su(f),y={...g,ttlMs:S,cacheScope:_};return delete y[Aa],y}function au(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function ru(m,h){if(h===void 0)return m;let f=m._meta;if(f===void 0)return{...m,_meta:{[jt]:h}};if(!au(f))return m;if(f[jt]!==void 0)return m;return{...m,_meta:{...f,[jt]:h}}}function ou(m){return m!==void 0&&hi(m.ttlMs)?m.ttlMs:Zl}function su(m){return m!==void 0&&pi(m.cacheScope)?m.cacheScope:Xl}function nu(m){let h={...m};return delete h[Aa],h}var iu=["elicitation/create","sampling/createMessage","roots/list"],nn;function cc(){if(nn)return nn;let m=da();return nn={request:{"elicitation/create":t({method:r("elicitation/create"),params:m.ElicitRequestParamsSchema}),"sampling/createMessage":t({method:r("sampling/createMessage"),params:m.CreateMessageRequestParamsSchema}),"roots/list":t({method:r("roots/list"),params:d({}).optional()})},response:{"elicitation/create":m.ElicitResultSchema,"sampling/createMessage":m.CreateMessageResultSchema,"roots/list":m.ListRootsResultSchema}},nn}function lc(m){return iu.includes(m)}function ei(m){return lc(m)?cc().request[m]:void 0}function cu(m){return lc(m)?cc().response[m]:void 0}var _i={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},uc={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function dc(m){return Object.prototype.hasOwnProperty.call(_i,m)}function mc(m){return Object.prototype.hasOwnProperty.call(uc,m)}function lu(m){return Object.prototype.hasOwnProperty.call(_i,m)}function uu(m){return dc(m)?da().dispatchRequestSchemas[m]:void 0}function du(m){return lu(m)?da().dispatchResultSchemas[m]:void 0}function mu(m){return mc(m)?da().notificationSchemas2026[m]:void 0}var ah=Object.keys(_i),rh=Object.keys(uc);function xr(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Hr(m,h){if(m===void 0)return{ok:!1,reason:"not-in-era"};let f=m.safeParse(h);return f.success?{ok:!0,value:f.data}:{ok:!1,reason:"invalid",message:String(f.error)}}var hu={ok:!1,reason:"not-in-era"},pu=[Vt,Dt];function fu(m,h){let f=h,g=!1,S=()=>{if(!g)f={...f},g=!0;return f},_=h.tools;if(m==="tools/list"&&Array.isArray(_)&&_.some((R)=>xr(R)&&("execution"in R)))S().tools=_.map((R)=>{if(!xr(R)||!("execution"in R))return R;let v={...R};return delete v.execution,v});let y=h.capabilities;if(xr(y)&&"tasks"in y){let R={...y};delete R.tasks,S().capabilities=R}return f}var yi={era:"2026-07-28",hasRequestMethod:dc,hasNotificationMethod:mc,hasInputRequestMethod:(m)=>ei(m)!==void 0,validateRequest:(m,h)=>Hr(uu(m),h),validateResult:(m,h)=>Hr(du(m),h),validateNotification:(m,h)=>Hr(mu(m),h),validateInputRequest:(m,h)=>Hr(ei(m),h),validateInputResponse:(m,h)=>Hr(cu(m),h),samplingResultVariant:()=>hu,outboundEnvelope(m){return{[Vt]:m.protocolVersion,[gr]:m.clientInfo,[Dt]:m.clientCapabilities,...m.logLevel!==void 0&&{[ca]:m.logLevel}}},validateEnvelopeMeta(m){let h=[];for(let g of pu)if(!(g in m))h.push({key:g,problem:"missing"});let f=da().RequestMetaEnvelopeSchema.safeParse(m);if(!f.success)for(let g of f.error.issues){let S=g.path.map(String),_=S.length>0?S.join("."):"_meta";if(S.length===1&&h.some((y)=>y.key===_&&y.problem==="missing"))continue;h.push({key:_,problem:g.message})}return h},projectCallToolResult:(m)=>ec(m),inputRequestSchema:ei,decodeResult(m,h){if(!xr(h))return{kind:"invalid",error:new Ke(Be.InvalidResult,`Invalid result for ${m}: not an object`,{method:m})};let f=h.resultType;if(f===void 0)return{kind:"invalid",error:new Ke(Be.InvalidResult,`Invalid result for ${m}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:m,violation:"missing-resultType"})};if(typeof f!=="string")return{kind:"invalid",error:new Ke(Be.InvalidResult,`Invalid result for ${m}: non-string resultType`,{method:m,resultType:f})};if(f==="input_required"){let y=h.inputRequests,R=xr(y)?y:{},v=h.requestState;if(Object.keys(R).length===0&&typeof v!=="string")return{kind:"invalid",error:new Ke(Be.InvalidResult,`Invalid result for ${m}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:m,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:R,...typeof v==="string"&&{requestState:v}}}if(f!=="complete")return{kind:"invalid",error:new Ke(Be.UnsupportedResultType,`Unsupported result type '${f}' for ${m}`,{resultType:f,method:m})};let g=gu(),S=Object.hasOwn(g,m)?g[m]:void 0;if(S!==void 0){let y=S.safeParse(h);if(!y.success)return{kind:"invalid",error:new Ke(Be.InvalidResult,`Invalid result for ${m}: ${y.error}`,{method:m})}}let _={...h};return delete _.resultType,{kind:"complete",result:_}},encodeResult(m,h,f){return ru(tu(m,eu(m,fu(m,h))),f)},encodeErrorCode:(m)=>m===-32002?-32602:m,checkInboundEnvelope(m){if(m.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let h=da().RequestMetaEnvelopeSchema.safeParse(m.envelope);if(!h.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${h.error.issues.map((f)=>f.message).join("; ")}`}},cn;function gu(){if(cn)return cn;let m=da();return cn={"tools/call":m.CallToolResultSchema,"tools/list":m.ListToolsResultSchema,"prompts/get":m.GetPromptResultSchema,"prompts/list":m.ListPromptsResultSchema,"resources/list":m.ListResourcesResultSchema,"resources/templates/list":m.ListResourceTemplatesResultSchema,"resources/read":m.ReadResourceResultSchema,"completion/complete":m.CompleteResultSchema,"server/discover":m.DiscoverResultSchema},cn}var Gr="2026-07-28";function Bt(m){return m!==void 0&&Da(m)?yi:mi}function Fi(m){if(m.revision!==void 0)return Bt(m.revision).era;return m.era==="modern"?yi.era:mi.era}function ti(m){return hc.some((h)=>h.hasRequestMethod(m))}function ai(m){return hc.some((h)=>h.hasNotificationMethod(m))}var hc=[mi,yi];function xi(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function N(m){if(!xi(m))return;let h=m._meta;return xi(h)?h:void 0}function X(m){let h=N(m);return h!==void 0&&Vt in h}function Q(m){let h=N(m)?.[Vt];return typeof h==="string"?h:void 0}function ee(m){return Bt(Gr).validateEnvelopeMeta(m)}var Su=Ni({AnnotationsSchema:()=>Nt,AudioContentSchema:()=>Na,BaseMetadataSchema:()=>qt,BaseRequestParamsSchema:()=>dt,BlobResourceContentsSchema:()=>qr,BooleanSchemaSchema:()=>kr,CallToolRequestParamsSchema:()=>Ss,CallToolRequestSchema:()=>_s,CallToolResultSchema:()=>Or,CancelTaskRequestSchema:()=>Ln,CancelTaskResultSchema:()=>Vn,CancelledNotificationParamsSchema:()=>vo,CancelledNotificationSchema:()=>$r,ClientCapabilitiesSchema:()=>$o,ClientNotificationSchema:()=>Un,ClientRequestSchema:()=>Dn,ClientResultSchema:()=>Hn,ClientTasksCapabilitySchema:()=>Ro,CompatibilityCallToolResultSchema:()=>wn,CompleteRequestParamsSchema:()=>Ks,CompleteRequestSchema:()=>Js,CompleteResultSchema:()=>Gs,ContentBlockSchema:()=>Ia,CreateMessageRequestParamsSchema:()=>qs,CreateMessageRequestSchema:()=>js,CreateMessageResultSchema:()=>Ns,CreateMessageResultWithToolsSchema:()=>Is,CreateTaskResultSchema:()=>qn,CursorSchema:()=>_r,DiscoverRequestSchema:()=>Co,DiscoverResultSchema:()=>qo,ElicitRequestFormParamsSchema:()=>Ma,ElicitRequestParamsSchema:()=>Ls,ElicitRequestSchema:()=>Vs,ElicitRequestURLParamsSchema:()=>As,ElicitResultSchema:()=>Hs,ElicitationCompleteNotificationParamsSchema:()=>Ds,ElicitationCompleteNotificationSchema:()=>Us,EmbeddedResourceSchema:()=>cs,EmptyResultSchema:()=>zr,EnumSchemaSchema:()=>Ms,GetPromptRequestParamsSchema:()=>ss,GetPromptRequestSchema:()=>ns,GetPromptResultSchema:()=>ds,GetTaskPayloadRequestSchema:()=>On,GetTaskPayloadResultSchema:()=>kn,GetTaskRequestSchema:()=>Nn,GetTaskResultSchema:()=>In,IconSchema:()=>bo,IconsSchema:()=>Ht,ImageContentSchema:()=>ja,ImplementationSchema:()=>Ta,InitializeRequestParamsSchema:()=>Po,InitializeRequestSchema:()=>Eo,InitializeResultSchema:()=>wo,InitializedNotificationSchema:()=>To,JSONArraySchema:()=>$n,JSONObjectSchema:()=>tt,JSONRPCErrorResponseSchema:()=>wa,JSONRPCMessageSchema:()=>yo,JSONRPCNotificationSchema:()=>Rr,JSONRPCRequestSchema:()=>br,JSONRPCResponseSchema:()=>Pn,JSONRPCResultResponseSchema:()=>Ea,JSONValueSchema:()=>Lt,LegacyTitledEnumSchemaSchema:()=>Lr,ListChangedOptionsBaseSchema:()=>Tn,ListPromptsRequestSchema:()=>rs,ListPromptsResultSchema:()=>os,ListResourceTemplatesRequestSchema:()=>Ao,ListResourceTemplatesResultSchema:()=>Lo,ListResourcesRequestSchema:()=>ko,ListResourcesResultSchema:()=>Mo,ListRootsRequestSchema:()=>Ys,ListRootsResultSchema:()=>Ws,ListTasksRequestSchema:()=>Mn,ListTasksResultSchema:()=>An,ListToolsRequestSchema:()=>fs,ListToolsResultSchema:()=>gs,LoggingLevelSchema:()=>Jt,LoggingMessageNotificationParamsSchema:()=>Rs,LoggingMessageNotificationSchema:()=>zs,ModelHintSchema:()=>$s,ModelPreferencesSchema:()=>Ps,MultiSelectEnumSchemaSchema:()=>ks,NotificationSchema:()=>gt,NotificationsParamsSchema:()=>ft,NumberSchemaSchema:()=>ka,PaginatedRequestParamsSchema:()=>Io,PaginatedRequestSchema:()=>Ft,PaginatedResultSchema:()=>xt,PingRequestSchema:()=>Er,PrimitiveSchemaDefinitionSchema:()=>Ur,ProgressNotificationParamsSchema:()=>No,ProgressNotificationSchema:()=>wr,ProgressSchema:()=>jo,ProgressTokenSchema:()=>Sr,PromptArgumentSchema:()=>ts,PromptListChangedNotificationSchema:()=>ms,PromptMessageSchema:()=>us,PromptReferenceSchema:()=>xs,PromptSchema:()=>as,ReadResourceRequestParamsSchema:()=>Vo,ReadResourceRequestSchema:()=>Do,ReadResourceResultSchema:()=>Uo,RelatedTaskMetadataSchema:()=>_o,RequestIdSchema:()=>Ut,RequestMetaSchema:()=>yr,RequestSchema:()=>at,ResourceContentsSchema:()=>Tr,ResourceLinkSchema:()=>ls,ResourceListChangedNotificationSchema:()=>Ho,ResourceRequestParamsSchema:()=>Ca,ResourceSchema:()=>jr,ResourceTemplateReferenceSchema:()=>Fs,ResourceTemplateSchema:()=>Oo,ResourceUpdatedNotificationParamsSchema:()=>Qo,ResourceUpdatedNotificationSchema:()=>es,ResultMetaObjectSchema:()=>vr,ResultSchema:()=>rt,RoleSchema:()=>Kt,RootSchema:()=>Bs,RootsListChangedNotificationSchema:()=>Zs,SamplingContentSchema:()=>Ts,SamplingMessageContentBlockSchema:()=>ia,SamplingMessageSchema:()=>Cs,ServerCapabilitiesSchema:()=>Pr,ServerNotificationSchema:()=>xn,ServerRequestSchema:()=>Fn,ServerResultSchema:()=>Kn,ServerTasksCapabilitySchema:()=>zo,SetLevelRequestParamsSchema:()=>vs,SetLevelRequestSchema:()=>bs,SingleSelectEnumSchemaSchema:()=>Os,StringSchemaSchema:()=>Oa,SubscribeRequestParamsSchema:()=>Fo,SubscribeRequestSchema:()=>xo,SubscriptionFilterSchema:()=>Nr,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Yo,SubscriptionsAcknowledgedNotificationSchema:()=>Wo,SubscriptionsListenRequestParamsSchema:()=>Go,SubscriptionsListenRequestSchema:()=>Bo,SubscriptionsListenResultMetaSchema:()=>Zo,SubscriptionsListenResultSchema:()=>Xo,TaskAugmentedRequestParamsSchema:()=>la,TaskCreationParamsSchema:()=>Cn,TaskMetadataSchema:()=>So,TaskSchema:()=>Gt,TaskStatusNotificationParamsSchema:()=>Qs,TaskStatusNotificationSchema:()=>jn,TaskStatusSchema:()=>Xs,TextContentSchema:()=>qa,TextResourceContentsSchema:()=>Cr,TitledMultiSelectEnumSchemaSchema:()=>Dr,TitledSingleSelectEnumSchemaSchema:()=>Ar,ToolAnnotationsSchema:()=>hs,ToolChoiceSchema:()=>Es,ToolExecutionSchema:()=>ps,ToolListChangedNotificationSchema:()=>ys,ToolResultContentSchema:()=>ws,ToolSchema:()=>Ir,ToolUseContentSchema:()=>is,UnsubscribeRequestParamsSchema:()=>Ko,UnsubscribeRequestSchema:()=>Jo,UntitledMultiSelectEnumSchemaSchema:()=>Vr,UntitledSingleSelectEnumSchemaSchema:()=>Mr});var b=(m)=>br.safeParse(m).success,I=(m)=>Rr.safeParse(m).success,te=(m)=>Ea.safeParse(m).success,ae=(m)=>wa.safeParse(m).success;var Yt=(m)=>typeof m==="object"&&m!==null&&!Array.isArray(m)&&m.resultType==="input_required";function pc(m){if(m.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${m.params.ref.type}`)}function fc(m){if(m.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${m.params.ref.type}`)}var Ki="x-mcp-header",_u=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,yu=new Set(["string","integer","boolean","number"]);function gc(m){let h=[],f=new Map,g=(_,y,R)=>{if(_===null||typeof _!=="object")return;let v=_;if(Ki in v){if(!R||y.length===0)return`${ln(y)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let O=v[Ki];if(typeof O!=="string"||O.length===0)return`${ln(y)}: x-mcp-header MUST be a non-empty string`;if(!_u.test(O))return`${ln(y)}: x-mcp-header '${O}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let L=typeof v.type==="string"?v.type:void 0;if(L===void 0||!yu.has(L))return`${ln(y)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${L??"<none>"}`;let G=O.toLowerCase(),Y=f.get(G);if(Y!==void 0)return`x-mcp-header '${O}' is not case-insensitively unique (also declared as '${Y}')`;f.set(G,O),h.push({path:y,headerName:O,type:L})}let E=v.properties;if(E!==null&&typeof E==="object")for(let[O,L]of Object.entries(E)){let G=g(L,[...y,O],R);if(G!==void 0)return G}for(let O of vu){let L=v[O];if(L===void 0)continue;let G=Array.isArray(L)?L:L!==null&&typeof L==="object"&&bu.has(O)?Object.values(L):[L];for(let Y of G){let U=g(Y,[...y,`<${O}>`],!1);if(U!==void 0)return U}}},S=g(m,[],!0);return S===void 0?{valid:!0,declarations:h}:{valid:!1,reason:S}}var vu=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],bu=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function ln(m){return m.length===0?"<root>":m.join(".")}var dn=-32020,oh=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[i.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[dn,i.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[i.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[i.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[i.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[dn],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[i.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[dn],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],sh={[i.ParseError]:400,[i.InvalidRequest]:400,[i.MethodNotFound]:404,[i.UnsupportedProtocolVersion]:400,[i.MissingRequiredClientCapability]:400,[dn]:400};function un(m,h,f,g,S){return{kind:"reject",rung:m,cell:h,httpStatus:f,code:g.code,message:g.message,...g.data!==void 0&&{data:g.data},settled:S}}function ce(m){if(!X(m))return!1;let h=Q(m);if(h===void 0||!Da(h))return!1;let f=N(m);return f!==void 0&&ee(f).length===0}function Se(m,h){switch(m.reason){case"http-method":return un("http-method","modern-only-method-not-allowed",405,new Ve(-32000,"Method not allowed."),!0);case"batch":return un("jsonrpc-shape","modern-only-batch-not-supported",400,new Ve(i.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return un("jsonrpc-shape","modern-only-response-post",400,new Ve(i.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let f=m.requestedVersion;return un("era-classification","modern-only-missing-envelope",400,f===void 0?new Ve(i.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...h]}):new B({supported:[...h],requested:f}),!0)}}}function hn(m,h){return ne(m,h)}function Fr(m){return new Set(m.flatMap((h)=>Object.keys(h.shape)))}function Va(m){if(m==null)return!1;let h=typeof m;if(h!=="object"&&h!=="function")return!1;if(!("~standard"in m))return!1;return typeof m["~standard"]?.validate==="function"}var Ji=!1,si="draft-2020-12";function Wt(m,h="input"){let f=m["~standard"],g;if(f.jsonSchema)g=f.jsonSchema[h]({target:si});else if(f.vendor==="zod"){if(!("_zod"in m))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!Ji)Ji=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");g=me(m,{target:si,io:h})}else throw Error(`Schema library "${f.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(h==="output"){if(g.type!==void 0)return g;return Sc(g)?{type:"object",...g}:g}if(g.type!==void 0&&g.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(g.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...g}}function Sc(m){if("properties"in m||"patternProperties"in m||"additionalProperties"in m||"required"in m)return!0;for(let h of["oneOf","anyOf","allOf"]){let f=m[h];if(Array.isArray(f)&&f.length>0)return f.every((g)=>g!==null&&typeof g==="object"&&(g.type==="object"||Sc(g)))}return!1}function Ru(m){if(!m.path?.length)return m.message;return`${m.path.map((h)=>String(typeof h==="object"?h.key:h)).join(".")}: ${m.message}`}async function ua(m,h){let f=await m["~standard"].validate(h);if(f.issues&&f.issues.length>0)return{success:!1,error:f.issues.map((g)=>Ru(g)).join(", ")};return{success:!0,data:f.value}}function zu(m){let h=me(m,{target:si,io:"input"});return typeof h.pattern==="string"?h.pattern:void 0}var $u=/\\\.\\d\{(\d+)\}/;function Pu(m){let h=$u.exec(m),f=[void 0,-1,0];if(h)f.push(Number(h[1]));return[!1,!0].flatMap((g)=>[!1,!0].flatMap((S)=>f.map((_)=>q({local:g,offset:S,precision:_}))))}function Eu(m,h){let f;switch(m){case"email":f=[ze()];break;case"uri":f=[re()];break;case"date":f=[he()];break;case"date-time":f=Pu(h);break}return new Set(f.map((g)=>zu(g)).filter((g)=>g!==void 0))}function wu(m,h,f){if(f!=="zod")return!0;return Eu(m,h).has(h)}function _c(m){let h=Wt(m,"input"),f=h.properties||{},g=h.required||[];return Object.entries(f).map(([S,_])=>({name:S,description:_?.description,required:g.includes(S)}))}function Jr(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function Tu(m){try{return Wt(m,"input")}catch(h){let f=h instanceof Error?h.message:String(h);throw new Ve(i.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${f}`)}}var Cu=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function vi(m){return Cu.has(m)||m.startsWith("x-")}var qu=new Set(["$schema",...Object.keys(Ma.shape.requestedSchema.shape)]),Gi={string:Fr([Oa,Mr,Ar,Lr]),number:Fr([ka]),integer:Fr([ka]),boolean:Fr([kr]),array:Fr([Vr,Dr])},ju=new Set(Oa.shape.format.unwrap().options);function Nu(m,h,f,g){if(!Jr(m))return m;let S=typeof m.type==="string"&&Object.hasOwn(Gi,m.type)?Gi[m.type]:void 0;if(S===void 0)return m;let _={};for(let[y,R]of Object.entries(m))if(S.has(y)||vi(y))_[y]=R;else if(y==="pattern"&&m.type==="string"&&typeof m.format==="string"){if(!ju.has(m.format))_[y]=R;else if(typeof R!=="string"||!wu(m.format,R,f))g.push(`${h}.${y}`)}else g.push(`${h}.${y}`);return _}function Iu(m,h){let f={},g=[];for(let[S,_]of Object.entries(m))if(S==="properties"&&Jr(_))f[S]=Object.fromEntries(Object.entries(_).map(([y,R])=>[y,Nu(R,`properties.${y}`,h,g)]));else if(qu.has(S))f[S]=_;else if(!vi(S))g.push(S);if(g.length>0)throw new Ve(i.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${g.join(", ")}`);return f}function Ou(m,h){if(!Jr(m.properties))return h;let f=Object.entries(m.properties).filter(([,g])=>!hn(Ur,g).success).map(([g])=>`properties.${g}`);return f.length>0?f.join(", "):h}function ni(m,h,f=""){if(Array.isArray(m)&&Array.isArray(h))return m.flatMap((g,S)=>ni(g,h[S],`${f}[${S}]`));if(!Jr(m)||!Jr(h))return[];return Object.entries(m).flatMap(([g,S])=>{let _=f?`${f}.${g}`:g;if(!Object.prototype.hasOwnProperty.call(h,g))return vi(g)?[]:[_];return ni(S,h[g],_)})}function ku(m){if(!Va(m.requestedSchema))return{...m,mode:"form",requestedSchema:m.requestedSchema};let h=m.requestedSchema["~standard"].vendor,f=Iu(Tu(m.requestedSchema),h),g=hn(Ma.shape.requestedSchema,f);if(!g.success)throw new Ve(i.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Ou(f,g.error.message)}`);let S=ni(f,g.data);if(S.length>0)throw new Ve(i.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${S.join(", ")}`);let _=(g.data.required??[]).filter((y)=>!Object.prototype.hasOwnProperty.call(g.data.properties,y));if(_.length>0)throw new Ve(i.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${_.join(", ")}`);return{...m,mode:"form",requestedSchema:g.data}}function Mu(m){let h=m.inputRequests!==void 0&&Object.keys(m.inputRequests).length>0,f=typeof m.requestState==="string";if(!h&&!f)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...m.inputRequests!==void 0&&{inputRequests:m.inputRequests},...m.requestState!==void 0&&{requestState:m.requestState}}}var nh=Object.assign(Mu,{elicit(m){try{return{method:"elicitation/create",params:ku(m)}}catch(h){throw h instanceof Ve?TypeError(h.message,{cause:h}):h}},elicitUrl(m){return{method:"elicitation/create",params:{...m,mode:"url"}}},createMessage(m){return{method:"sampling/createMessage",params:m}},listRoots(){return{method:"roots/list"}}});var yc=250;function vc(m,h){return`Multi-round-trip request '${m}' still required input after ${h} rounds (inputRequired.maxRounds)`}function bc(m,h){return new Promise((f,g)=>{if(h?.aborted){g(h.reason instanceof Ke?h.reason:new Ke(Be.RequestTimeout,String(h.reason)));return}let S=setTimeout(()=>{h?.removeEventListener("abort",_),f()},m),_=()=>{clearTimeout(S),g(h?.reason instanceof Ke?h.reason:new Ke(Be.RequestTimeout,String(h?.reason)))};h?.addEventListener("abort",_,{once:!0})})}function Rc(m){let h=new AbortController,f=()=>h.abort(m?.reason);if(m?.addEventListener("abort",f,{once:!0}),m?.aborted)h.abort(m.reason);return{signal:h.signal,abort:(g)=>h.abort(g),dispose:()=>m?.removeEventListener("abort",f)}}var Au=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],Lu={IdJagTokenExchangeResponseSchema:Yn,OAuthClientInformationFullSchema:Zn,OAuthClientInformationSchema:rn,OAuthClientMetadataSchema:an,OAuthClientRegistrationErrorSchema:Xn,OAuthErrorResponseSchema:Wn,OAuthMetadataSchema:en,OAuthProtectedResourceMetadataSchema:Jn,OAuthTokenRevocationRequestSchema:Qn,OAuthTokensSchema:Bn,OpenIdProviderDiscoveryMetadataSchema:Gn,OpenIdProviderMetadataSchema:tn},zc={},$c={};function Pc(m,h){let f=m.slice(0,-6);zc[f]=h,$c[f]=(g)=>h.safeParse(g).success}for(let m of Au)Pc(m,Su[m]);for(let[m,h]of Object.entries(Lu))Pc(m,h);var ih=Object.freeze(zc),ch=Object.freeze($c);function Vu(m){switch(m){case"initialize":case"notifications/initialized":return Bt(void 0);case"server/discover":return Bt(Gr);default:return}}var Du=60000,Uu=[Vt,gr,Dt,ca],Hu=["inputResponses","requestState"];function Bi(m,h){let f=m.params;if(!Kr(f))return{message:m,lifted:{}};let g=f._meta,S=Kr(g)?Uu.filter((v)=>(v in g)):[],_=h==="request"?Hu.filter((v)=>(v in f)):[];if(S.length===0&&_.length===0)return{message:m,lifted:{}};let y={},R={...f};if(S.length>0&&Kr(g)){let v={},E={...g};for(let O of S)v[O]=g[O],delete E[O];if(y.envelope=v,Object.keys(E).length>0)R._meta=E;else delete R._meta}for(let v of _){if(v==="inputResponses")y.inputResponses=R[v];if(v==="requestState")y.requestState=R[v];delete R[v]}return{message:{...m,params:R},lifted:y}}function Yi(m,h){let f=m.validateResult(h,void 0);if(!f.ok&&f.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(g){let S=m.validateResult(h,g);if(S.ok)return{value:S.value};return{issues:[{message:S.reason==="invalid"?S.message:`not-in-era: ${h}`}]}}}}}function Br(m){return()=>m}var Fu=Br(void 0);function bi(m,h){return{...m,mcpReq:{...m.mcpReq,requestState:Br(h)}}}var Ec;function be(m,h){Ec(m,h)}var wc=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{Ec=(m,h)=>{m._negotiatedProtocolVersion=h}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(m){this._options=m,this._supportedProtocolVersions=m?.supportedProtocolVersions??Rn,this.setNotificationHandler("notifications/cancelled",(h)=>{this._oncancel(h)}),this.setNotificationHandler("notifications/progress",(h)=>{this._onprogress(h)}),this.setRequestHandler("ping",(h)=>({}))}_shouldDropInbound(m){}_outboundMetaEnvelope(){}_envelopeOutbound(m){let h=this._outboundMetaEnvelope();if(h===void 0)return m;let f=m.params??{};return{...m,params:{...f,_meta:{...h,...f._meta}}}}_resolveNonCompleteResult(m,h){return Promise.reject(new Ke(Be.UnsupportedResultType,`Unsupported result type '${m.kind}' for ${h.request.method}`,{resultType:m.kind,method:h.request.method}))}_getRequestHandler(m){return this._requestHandlers.get(m)}async _oncancel(m){if(!m.params.requestId)return;this._requestHandlerAbortControllers.get(m.params.requestId)?.abort(m.params.reason)}_setupTimeout(m,h,f,g,S=!1){this._timeoutInfo.set(m,{timeoutId:setTimeout(g,h),startTime:Date.now(),timeout:h,maxTotalTimeout:f,resetTimeoutOnProgress:S,onTimeout:g})}_resetTimeout(m){let h=this._timeoutInfo.get(m);if(!h)return!1;let f=Date.now()-h.startTime;if(h.maxTotalTimeout&&f>=h.maxTotalTimeout)throw this._timeoutInfo.delete(m),new Ke(Be.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:h.maxTotalTimeout,totalElapsed:f});return clearTimeout(h.timeoutId),h.timeoutId=setTimeout(h.onTimeout,h.timeout),!0}_cleanupTimeout(m){let h=this._timeoutInfo.get(m);if(h)clearTimeout(h.timeoutId),this._timeoutInfo.delete(m)}async connect(m){this._transport=m;let h=this.transport?.onclose;this._transport.onclose=()=>{try{h?.()}finally{this._onclose()}};let f=this.transport?.onerror;this._transport.onerror=(S)=>{f?.(S),this._onerror(S)};let g=this._transport?.onmessage;this._transport.onmessage=(S,_)=>{if(g?.(S,_),te(S)||ae(S))this._onresponse(S);else if(b(S))this._onrequest(S,_);else if(I(S))this._onnotification(S,_);else this._onerror(Error(`Unknown message type: ${JSON.stringify(S)}`))},m.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let m=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let g of this._timeoutInfo.values())clearTimeout(g.timeoutId);this._timeoutInfo.clear();let h=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let f=new Ke(Be.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let g of m.values())g(f);for(let g of h.values())g.abort(f)}}_onerror(m){this.onerror?.(m)}_onnotification(m,h){let{message:f}=Bi(m,"notification"),g=this._negotiatedWireCodec();if(h?.classification===void 0&&this._shouldDropInbound(m)==="drop")return;if(h?.classification!==void 0){let y=Fi(h.classification);if(y!==g.era){this._onerror(Error(`Era mismatch on inbound notification '${f.method}': classified as ${y} but this instance serves ${g.era}`));return}}if(ai(f.method)&&!g.hasNotificationMethod(f.method))return;let S=this._notificationHandlers.get(f.method),_=this.fallbackNotificationHandler;if(S===void 0&&_===void 0)return;Promise.resolve().then(()=>S===void 0?_(f):S(f,g)).catch((y)=>this._onerror(Error(`Uncaught error in notification handler: ${y}`)))}_onrequest(m,h){let{message:f,lifted:g}=Bi(m,"request"),S=this._negotiatedWireCodec();if(h?.classification===void 0&&this._shouldDropInbound(m)==="drop"){this._onerror(Error(`Dropped inbound request '${m.method}': not servable on this connection's protocol era`));return}let _=this._transport,y=(F,M,z)=>{let D={jsonrpc:"2.0",id:f.id,error:{code:F,message:M,...z!==void 0&&{data:z}}};_?.send(D).catch((w)=>this._onerror(Error(`Failed to send an error response: ${w}`)))};if(h?.classification!==void 0){let F=Fi(h.classification);if(F!==S.era){this._onerror(Error(`Era mismatch on inbound request '${f.method}': classified as ${F} but this instance serves ${S.era}`));let M=h.classification.revision??F;y(i.UnsupportedProtocolVersion,`Unsupported protocol version: ${M}`,{supported:this._supportedProtocolVersions,requested:M});return}}if(ti(f.method)&&!S.hasRequestMethod(f.method)){y(i.MethodNotFound,"Method not found");return}let R=this._requestHandlers.get(f.method)??this.fallbackRequestHandler;if(R===void 0){y(i.MethodNotFound,"Method not found");return}let v=S.checkInboundEnvelope(g);if(v!==void 0){y(i.InvalidParams,v);return}let E=(F,M)=>this._notificationViaCodec(this._resolveOutboundCodec(F.method),F,{...M,relatedRequestId:f.id}),O=(F,M,z)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(F.method),F,M,{...z,relatedRequestId:f.id}),L=new AbortController;this._requestHandlerAbortControllers.set(f.id,L);let G=g.inputResponses===void 0?void 0:xu(g.inputResponses),Y={sessionId:_?.sessionId,mcpReq:{id:f.id,method:f.method,_meta:f.params?._meta,...g.envelope!==void 0&&{envelope:g.envelope},...G!==void 0&&{inputResponses:G.accepted},...G!==void 0&&G.droppedKeys.length>0&&{droppedInputResponseKeys:G.droppedKeys},requestState:g.requestState===void 0?Fu:Br(g.requestState),signal:L.signal,send:(F,M,z)=>{let D=this._resolveOutboundCodec(F.method);if(this._assertOutboundRequestInEra(D,F.method),Va(M))return O(F,M,z);let w=Yi(D,F.method);if(w===void 0)throw TypeError(`'${F.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return O(F,w,M)},notify:E},http:h?.authInfo?{authInfo:h.authInfo}:void 0},U=this.buildContext(Y,h);Promise.resolve().then(()=>R(f,U)).then(async(F)=>{if(L.signal.aborted)return;let M;try{M=S.encodeResult(f.method,F,this._outboundServerInfo())}catch(D){this._onerror(Error(`Failed to encode result for ${f.method}: ${D}`)),y(i.InternalError,"Internal error");return}let z={result:M,jsonrpc:"2.0",id:f.id};await _?.send(z)},async(F)=>{if(L.signal.aborted)return;let M=Number.isSafeInteger(F.code)?F.code:i.InternalError,z={jsonrpc:"2.0",id:f.id,error:{code:S.encodeErrorCode(M),message:F.message??"Internal error",...F.data!==void 0&&{data:F.data}}};await _?.send(z)}).catch((F)=>this._onerror(Error(`Failed to send response: ${F}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(f.id)===L)this._requestHandlerAbortControllers.delete(f.id)})}_onprogress(m){let{progressToken:h,...f}=m.params,g=Number(h),S=this._progressHandlers.get(g);if(!S){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(m)}`));return}let _=this._responseHandlers.get(g),y=this._timeoutInfo.get(g);if(y&&_&&y.resetTimeoutOnProgress)try{this._resetTimeout(g)}catch(R){this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),_(R);return}S(f)}_onresponse(m){let h=Number(m.id),f=this._responseHandlers.get(h);if(f===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(m)}`));return}if(this._responseHandlers.delete(h),this._cleanupTimeout(h),this._progressHandlers.delete(h),te(m))f(m);else f(Ve.fromError(m.error.code,m.error.message,m.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(m,h,f){let g=this._resolveOutboundCodec(m.method);if(this._assertOutboundRequestInEra(g,m.method),Va(h))return this._requestWithSchemaViaCodec(g,m,h,f);let S=Yi(g,m.method);if(S===void 0)throw TypeError(`'${m.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(g,m,S,h)}_negotiatedWireCodec(){return Bt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(m){if(this._negotiatedProtocolVersion===void 0){let h=Vu(m);if(h)return h}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(m,h){if(ti(h)&&!m.hasRequestMethod(h))throw new Ke(Be.MethodNotSupportedByProtocolVersion,`Method '${h}' is not supported by the negotiated protocol version (wire era ${m.era})`,{method:h,era:m.era})}_requestWithSchema(m,h,f){let g=this._resolveOutboundCodec(m.method);return this._assertOutboundRequestInEra(g,m.method),this._requestWithSchemaViaCodec(g,m,h,f)}_requestWithSchemaViaCodec(m,h,f,g){let{relatedRequestId:S,resumptionToken:_,onresumptiontoken:y,headers:R}=g??{},v=Date.now(),E,O;return new Promise((L,G)=>{let Y=(V)=>{G(V)};if(!this._transport){Y(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(h.method)}catch(V){Y(V);return}if(g?.signal?.aborted){let V=g.signal.reason;throw V instanceof Ke?V:new Ke(Be.RequestTimeout,String(V))}let U=m.era===Gr&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,F=this._requestMessageId++;O=F;let M={...h,jsonrpc:"2.0",id:F};if(g?.onprogress)this._progressHandlers.set(F,g.onprogress),M.params={...h.params,_meta:{...h.params?._meta,progressToken:F}};let z=this._envelopeOutbound(M),D=!1,w=(V)=>{if(D)return;if(this._progressHandlers.delete(F),U===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:F,reason:String(V)}}),{relatedRequestId:S,resumptionToken:_,onresumptiontoken:y}).catch((T)=>this._onerror(Error(`Failed to send cancellation: ${T}`)));else U.abort();G(V instanceof Ke?V:new Ke(Be.RequestTimeout,String(V)))};this._responseHandlers.set(F,(V)=>{if(g?.signal?.aborted)return;if(D=!0,V instanceof Error)return G(V);let T;try{T=m.decodeResult(h.method,V.result)}catch(ye){return G(ye instanceof Error?ye:Error(String(ye)))}if(T.kind==="invalid")return G(T.error);if(T.kind==="input_required"){if(g?.allowInputRequired===!0)return L(Ku(T));let ye={codec:m,request:h,resultSchema:f,options:g,flowStartedAt:v,retry:(Oe,Pe)=>this._requestWithSchemaViaCodec(m,Oe===void 0?{method:h.method}:{method:h.method,params:Oe},f,Pe)};return L(this._resolveNonCompleteResult(T,ye))}let Z=T.result;ua(f,Z).then((ye)=>{if(ye.success)L(ye.data);else G(new Ke(Be.InvalidResult,`Invalid result for ${h.method}: ${ye.error}`))},G)}),E=()=>w(g?.signal?.reason),g?.signal?.addEventListener("abort",E,{once:!0});let K=g?.timeout??Du,W=()=>w(new Ke(Be.RequestTimeout,"Request timed out",{timeout:K}));this._setupTimeout(F,K,g?.maxTotalTimeout,W,g?.resetTimeoutOnProgress??!1),this._transport.send(z,{relatedRequestId:S,resumptionToken:_,onresumptiontoken:y,headers:R,requestSignal:U?.signal}).catch((V)=>{this._progressHandlers.delete(F),G(V)})}).finally(()=>{if(E)g?.signal?.removeEventListener("abort",E);if(O!==void 0)this._responseHandlers.delete(O),this._cleanupTimeout(O)})}async notification(m,h){return this._notificationViaCodec(this._resolveOutboundCodec(m.method),m,h)}async _notificationViaCodec(m,h,f){if(!this._transport)throw new Ke(Be.NotConnected,"Not connected");if(ai(h.method)&&!m.hasNotificationMethod(h.method))throw new Ke(Be.MethodNotSupportedByProtocolVersion,`Notification '${h.method}' is not supported by the negotiated protocol version (wire era ${m.era})`,{method:h.method,era:m.era});this.assertNotificationCapability(h.method);let g=this._envelopeOutbound({jsonrpc:"2.0",...h});if((this._options?.debouncedNotificationMethods??[]).includes(h.method)&&!h.params&&!f?.relatedRequestId){if(this._pendingDebouncedNotifications.has(h.method))return;this._pendingDebouncedNotifications.add(h.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(h.method),!this._transport)return;this._transport?.send(g,f).catch((S)=>this._onerror(S))});return}await this._transport.send(g,f)}setRequestHandler(m,h,f){this.assertRequestHandlerCapability(m);let g;if(typeof h==="function"){if(!ti(m))throw TypeError(`'${m}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);g=(S,_)=>{let y=this._negotiatedWireCodec(),R=y.validateRequest(m,S);if(!R.ok&&R.reason==="not-in-era")R=y.validateInputRequest(m,S);if(!R.ok){if(R.reason==="not-in-era")throw new Ve(i.InternalError,`No wire schema for ${m} in the resolved era`);throw Error(R.message)}return Promise.resolve(h(R.value,_))}}else if(f)g=async(S,_)=>{let y=await ua(h.params,{...S.params});if(!y.success)throw new Ve(i.InvalidParams,`Invalid params for ${m}: ${y.error}`);return f(y.data,_)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(m,this._wrapHandler(m,g))}_wrapHandler(m,h){return h}_outboundServerInfo(){}removeRequestHandler(m){this._requestHandlers.delete(m)}assertCanSetRequestHandler(m){if(this._requestHandlers.has(m))throw Error(`A request handler for ${m} already exists, which would be overridden`)}setNotificationHandler(m,h,f){if(typeof h==="function"){if(!ai(m))throw TypeError(`'${m}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(m,(g,S)=>{let _=S.validateNotification(m,g);if(!_.ok){if(_.reason==="not-in-era")throw new Ve(i.InternalError,`No wire schema for ${m} in the resolved era`);throw Error(_.message)}return Promise.resolve(h(_.value))});return}if(!f)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(m,async(g)=>{let S=await ua(h.params,{...g.params});if(!S.success)throw new Ve(i.InvalidParams,`Invalid params for notification ${m}: ${S.error}`);await f(S.data,g)})}removeNotificationHandler(m){this._notificationHandlers.delete(m)}};function Kr(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Tc(m,h){let f={...m};for(let g in h){let S=g,_=h[S];if(_===void 0)continue;let y=f[S];f[S]=Kr(y)&&Kr(_)?{...y,..._}:_}return f}function Wi(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function xu(m){let h={},f=[];if(!Wi(m))return{accepted:h,droppedKeys:f};for(let[g,S]of Object.entries(m)){if(!Wi(S)||"method"in S||"result"in S){f.push(g);continue}h[g]=S}return{accepted:h,droppedKeys:f}}function Ku(m){return{resultType:"input_required",inputRequests:m.inputRequests,...m.requestState!==void 0&&{requestState:m.requestState}}}/*!
|
|
2
2
|
* content-type
|
|
3
3
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
4
4
|
* MIT Licensed
|