broods 0.33.5 → 0.34.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 +8 -1
- package/dist/account.d.ts +2 -1
- package/dist/account.js +1 -1
- package/dist/{chunk-kry08nkb.js → chunk-2twpayzy.js} +1 -1
- package/dist/{chunk-brynjz54.js → chunk-6bhwgtat.js} +1 -1
- package/dist/{chunk-dwjss2jz.js → chunk-eq8rdd5j.js} +1 -1
- package/dist/chunk-wgwmcq6q.js +5 -0
- package/dist/chunk-yd3vh7k7.js +2 -0
- package/dist/cli/index.js +7 -7
- package/dist/index.d.ts +35 -14
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-7xc63gnm.js +0 -5
- package/dist/chunk-mqwt5n8x.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ce,v,le,ue,we,_e,P,j,de,Q,e,Re,ee,te,o,i,R,Ee,l,r,t,d,c,T,E,s,p,n,u,M,A}from"./cli/index.js";var{create:Sl,defineProperty:yo,getOwnPropertyDescriptor:_l,getOwnPropertyNames:yl,getPrototypeOf:vl}=Object,bl=Object.prototype.hasOwnProperty,ke=(m,h)=>()=>(h||m((h={exports:{}}).exports,h),h.exports),Ai=(m,h)=>{let f={};for(var g in m)yo(f,g,{get:m[g],enumerable:!0});if(h)yo(f,Symbol.toStringTag,{value:"Module"});return f},Rl=(m,h,f,g)=>{if(h&&typeof h==="object"||typeof h==="function"){for(var S=yl(h),_=0,y=S.length,w;_<y;_++)if(w=S[_],!bl.call(m,w)&&w!==f)yo(m,w,{get:((z)=>h[z]).bind(null,w),enumerable:!(g=_l(h,w))||g.enumerable})}return m},vo=(m,h,f)=>(f=m!=null?Sl(vl(m)):{},Rl(h||!m||!m.__esModule?yo(f,"default",{value:m,enumerable:!0}):f,m));var zl=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Li=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),$l=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),El=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Di(m){return typeof m==="string"&&Li.has(m.replace(/#$/,""))}function Vi(m,h){if(!("$schema"in m)||typeof m.$schema!=="string")return"2020-12";let f=m.$schema.replace(/#$/,"");if(zl.has(f))return"2020-12";if(Li.has(f))return"2019-09";if($l.has(f)||El.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 wl=()=>{let m={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function h(S){return m[S]??null}let f={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},g={nan:"NaN"};return(S)=>{switch(S.code){case"invalid_type":{let _=g[S.expected]??S.expected,y=we(S.input),w=g[y]??y;return`Invalid input: expected ${_}, received ${w}`}case"invalid_value":if(S.values.length===1)return`Invalid input: expected ${ue(S.values[0])}`;return`Invalid option: expected one of ${le(S.values,"|")}`;case"too_big":{let _=S.inclusive?"<=":"<",y=h(S.origin);if(y)return`Too big: expected ${S.origin??"value"} to have ${_}${S.maximum.toString()} ${y.unit??"elements"}`;return`Too big: expected ${S.origin??"value"} to be ${_}${S.maximum.toString()}`}case"too_small":{let _=S.inclusive?">=":">",y=h(S.origin);if(y)return`Too small: expected ${S.origin} to have ${_}${S.minimum.toString()} ${y.unit}`;return`Too small: expected ${S.origin} to be ${_}${S.minimum.toString()}`}case"invalid_format":{let _=S;if(_.format==="starts_with")return`Invalid string: must start with "${_.prefix}"`;if(_.format==="ends_with")return`Invalid string: must end with "${_.suffix}"`;if(_.format==="includes")return`Invalid string: must include "${_.includes}"`;if(_.format==="regex")return`Invalid string: must match pattern ${_.pattern}`;return`Invalid ${f[_.format]??S.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${S.divisor}`;case"unrecognized_keys":return`Unrecognized key${S.keys.length>1?"s":""}: ${le(S.keys,", ")}`;case"invalid_key":return`Invalid key in ${S.origin}`;case"invalid_union":if(S.options&&Array.isArray(S.options)&&S.options.length>0)return`Invalid discriminator value. Expected ${S.options.map((y)=>`'${y}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${S.origin}`;default:return"Invalid input"}}};function En(){return{localeError:wl()}}var Hi={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 Ui;(function(m){})(Ui||(Ui={}));function Cl(m){return _e(te,m)}v(En());var wa="2025-11-25";var wn=[wa,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Tn="io.modelcontextprotocol/related-task",Ft="io.modelcontextprotocol/protocolVersion",vr="io.modelcontextprotocol/clientInfo",kt="io.modelcontextprotocol/serverInfo",xt="io.modelcontextprotocol/clientCapabilities",Ta="io.modelcontextprotocol/subscriptionId",ma="io.modelcontextprotocol/logLevel";var Ca="2.0";var Ht=M(()=>c([e(),o(),i(),R(),s(e(),Ht),r(Ht)])),st=s(e(),Ht),Cn=r(Ht),br=c([e(),o().int()]),Rr=e(),bo=t({ttl:o().optional()}),Ro=t({taskId:e()}),zr=d({progressToken:br.optional(),[Tn]:Ro.optional()}),ft=t({_meta:zr.optional()}),ha=ft.extend({task:bo.optional()}),nt=t({method:e(),params:ft.loose().optional()}),yt=t({_meta:zr.optional()}),vt=t({method:e(),params:yt.loose().optional()}),$r=d({get[kt](){return Na.optional().catch(void 0)}}),it=d({_meta:$r.optional()}),Kt=c([e(),o().int()]),Er=t({jsonrpc:n(Ca),id:Kt,...nt.shape}).strict(),Pr=t({jsonrpc:n(Ca),...vt.shape}).strict(),qa=t({jsonrpc:n(Ca),id:Kt,result:it}).strict(),ja=t({jsonrpc:n(Ca),id:Kt.optional(),error:t({code:o().int(),message:e(),data:l().optional()})}).strict(),zo=c([Er,Pr,qa,ja]),qn=c([qa,ja]),wr=it.strict(),$o=yt.extend({requestId:Kt.optional(),reason:e().optional()}),Tr=vt.extend({method:n("notifications/cancelled"),params:$o}),Eo=t({src:e(),mimeType:e().optional(),sizes:r(e()).optional(),theme:p(["light","dark"]).optional()}),Jt=t({icons:r(Eo).optional()}),Ot=t({name:e(),title:e().optional()}),Na=Ot.extend({...Ot.shape,...Jt.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),jl=E(t({applyDefaults:i().optional()}),st),Nl=A((m)=>{if(m&&typeof m==="object"&&!Array.isArray(m)&&Object.keys(m).length===0)return{form:{}};return m},E(t({form:jl.optional(),url:st.optional()}),st.optional())),Po=d({list:st.optional(),cancel:st.optional(),requests:d({sampling:d({createMessage:st.optional()}).optional(),elicitation:d({create:st.optional()}).optional()}).optional()}),wo=d({list:st.optional(),cancel:st.optional(),requests:d({tools:d({call:st.optional()}).optional()}).optional()}),To=t({experimental:s(e(),st).optional(),sampling:t({context:st.optional(),tools:st.optional()}).optional(),elicitation:Nl.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:Po.optional(),extensions:s(e(),st).optional()}),Co=ft.extend({protocolVersion:e(),capabilities:To,clientInfo:Na}),qo=nt.extend({method:n("initialize"),params:Co}),Cr=t({experimental:s(e(),st).optional(),logging:st.optional(),completions:st.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:wo.optional(),extensions:s(e(),st).optional()}),jo=it.extend({protocolVersion:e(),capabilities:Cr,serverInfo:Na,instructions:e().optional()}),No=vt.extend({method:n("notifications/initialized"),params:yt.optional()}),Io=nt.extend({method:n("server/discover"),params:ft.optional()}),Oo=it.extend({supportedVersions:r(e()),capabilities:Cr,instructions:e().optional()}),qr=nt.extend({method:n("ping"),params:ft.optional()}),ko=t({progress:o(),total:u(o()),message:u(e())}),Mo=t({...yt.shape,...ko.shape,progressToken:br}),jr=vt.extend({method:n("notifications/progress"),params:Mo}),Ao=ft.extend({cursor:Rr.optional()}),Gt=nt.extend({params:Ao.optional()}),Bt=it.extend({nextCursor:Rr.optional()}),Nr=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),Ir=Nr.extend({text:e()}),jn=e().refine((m)=>{try{return atob(m),!0}catch{return!1}},{message:"Invalid Base64 string"}),Or=Nr.extend({blob:jn}),Yt=p(["user","assistant"]),Mt=t({audience:r(Yt).optional(),priority:o().min(0).max(1).optional(),lastModified:j({offset:!0}).optional()}),kr=t({...Ot.shape,...Jt.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:Mt.optional(),_meta:u(d({}))}),Lo=t({...Ot.shape,...Jt.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:Mt.optional(),_meta:u(d({}))}),Do=Gt.extend({method:n("resources/list")}),Vo=Bt.extend({resources:r(kr)}),Uo=Gt.extend({method:n("resources/templates/list")}),Ho=Bt.extend({resourceTemplates:r(Lo)}),Ia=ft.extend({uri:e()}),Fo=Ia,xo=nt.extend({method:n("resources/read"),params:Fo}),Ko=it.extend({contents:r(c([Ir,Or]))}),Jo=vt.extend({method:n("notifications/resources/list_changed"),params:yt.optional()}),Go=Ia,Bo=nt.extend({method:n("resources/subscribe"),params:Go}),Yo=Ia,Wo=nt.extend({method:n("resources/unsubscribe"),params:Yo}),Mr=t({toolsListChanged:i().optional(),promptsListChanged:i().optional(),resourcesListChanged:i().optional(),resourceSubscriptions:r(e()).optional()}),Zo=ft.extend({notifications:Mr}),Xo=nt.extend({method:n("subscriptions/listen"),params:Zo}),Qo=yt.extend({notifications:Mr}),es=vt.extend({method:n("notifications/subscriptions/acknowledged"),params:Qo}),ts=$r.extend({[Ta]:Kt}),as=it.extend({_meta:ts}),rs=yt.extend({uri:e()}),os=vt.extend({method:n("notifications/resources/updated"),params:rs}),ss=t({name:e(),description:u(e()),required:u(i())}),ns=t({...Ot.shape,...Jt.shape,description:u(e()),arguments:u(r(ss)),_meta:u(d({}))}),is=Gt.extend({method:n("prompts/list")}),cs=Bt.extend({prompts:r(ns)}),ls=ft.extend({name:e(),arguments:s(e(),e()).optional()}),us=nt.extend({method:n("prompts/get"),params:ls}),Oa=t({type:n("text"),text:e(),annotations:Mt.optional(),_meta:s(e(),l()).optional()}),ka=t({type:n("image"),data:jn,mimeType:e(),annotations:Mt.optional(),_meta:s(e(),l()).optional()}),Ma=t({type:n("audio"),data:jn,mimeType:e(),annotations:Mt.optional(),_meta:s(e(),l()).optional()}),ds=t({type:n("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),ms=t({type:n("resource"),resource:c([Ir,Or]),annotations:Mt.optional(),_meta:s(e(),l()).optional()}),hs=kr.extend({type:n("resource_link")}),Aa=c([Oa,ka,Ma,hs,ms]),ps=t({role:Yt,content:Aa}),fs=it.extend({description:e().optional(),messages:r(ps)}),gs=vt.extend({method:n("notifications/prompts/list_changed"),params:yt.optional()}),Ss=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),_s=t({taskSupport:p(["required","optional","forbidden"]).optional()}),Ar=t({...Ot.shape,...Jt.shape,description:e().optional(),inputSchema:t({type:n("object"),properties:s(e(),Ht).optional(),required:r(e()).optional()}).catchall(l()),outputSchema:d({$schema:e().optional()}).optional(),annotations:Ss.optional(),execution:_s.optional(),_meta:s(e(),l()).optional()}),ys=Gt.extend({method:n("tools/list")}),vs=Bt.extend({tools:r(Ar)}),Lr=it.extend({content:r(Aa).default([]),structuredContent:l().optional(),isError:i().optional()}),Nn=Lr.or(it.extend({toolResult:l()})),bs=ha.extend({name:e(),arguments:s(e(),l()).optional()}),Rs=nt.extend({method:n("tools/call"),params:bs}),zs=vt.extend({method:n("notifications/tools/list_changed"),params:yt.optional()}),In=t({autoRefresh:i().default(!0),debounceMs:o().int().nonnegative().default(300)}),Wt=p(["debug","info","notice","warning","error","critical","alert","emergency"]),$s=ft.extend({level:Wt}),Es=nt.extend({method:n("logging/setLevel"),params:$s}),Ps=yt.extend({level:Wt,logger:e().optional(),data:l()}),ws=vt.extend({method:n("notifications/message"),params:Ps}),Ts=t({name:e().optional()}),Cs=t({hints:r(Ts).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),qs=t({mode:p(["auto","required","none"]).optional()}),js=t({type:n("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:r(Aa),structuredContent:l().optional(),isError:i().optional(),_meta:s(e(),l()).optional()}),Ns=T("type",[Oa,ka,Ma]),da=T("type",[Oa,ka,Ma,ds,js]),Is=t({role:Yt,content:c([da,r(da)]),_meta:s(e(),l()).optional()}),Os=ha.extend({messages:r(Is),modelPreferences:Cs.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:r(e()).optional(),metadata:st.optional(),tools:r(Ar).optional(),toolChoice:qs.optional()}),ks=nt.extend({method:n("sampling/createMessage"),params:Os}),Ms=it.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens"]).or(e())),role:Yt,content:Ns}),As=it.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:Yt,content:c([da,r(da)])}),Dr=t({type:n("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),La=t({type:n("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),Da=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),Vr=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),default:e().optional()}),Ur=t({type:n("string"),title:e().optional(),description:e().optional(),oneOf:r(t({const:e(),title:e()})),default:e().optional()}),Hr=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),enumNames:r(e()).optional(),default:e().optional()}),Ls=c([Vr,Ur]),Fr=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:n("string"),enum:r(e())}),default:r(e()).optional()}),xr=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:r(t({const:e(),title:e()}))}),default:r(e()).optional()}),Ds=c([Fr,xr]),Vs=c([Hr,Ls,Ds]),Kr=c([Vs,Dr,La,Da]),Va=ha.extend({mode:n("form").optional(),message:e(),requestedSchema:t({type:n("object"),properties:s(e(),Kr),required:r(e()).optional()}).catchall(l())}),Us=ha.extend({mode:n("url"),message:e(),elicitationId:e(),url:e().url()}),Hs=c([Va,Us]),Fs=nt.extend({method:n("elicitation/create"),params:Hs}),xs=yt.extend({elicitationId:e()}),Ks=vt.extend({method:n("notifications/elicitation/complete"),params:xs}),Js=it.extend({action:p(["accept","decline","cancel"]),content:A((m)=>m===null?void 0:m,s(e(),c([e(),o(),i(),r(e())])).optional())}),Gs=t({type:n("ref/resource"),uri:e()}),Bs=t({type:n("ref/prompt"),name:e()}),Ys=ft.extend({ref:c([Bs,Gs]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),Ws=nt.extend({method:n("completion/complete"),params:Ys}),Zs=it.extend({completion:d({values:r(e()).max(100),total:u(o().int()),hasMore:u(i())})}),Xs=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),Qs=nt.extend({method:n("roots/list"),params:ft.optional()}),en=it.extend({roots:r(Xs)}),tn=vt.extend({method:n("notifications/roots/list_changed"),params:yt.optional()}),On=d({ttl:o().optional(),pollInterval:o().optional()}),an=p(["working","input_required","completed","failed","cancelled"]),Zt=t({taskId:e(),status:an,ttl:c([o(),R()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:u(o()),statusMessage:u(e())}),kn=it.extend({task:Zt}),rn=yt.merge(Zt),Mn=vt.extend({method:n("notifications/tasks/status"),params:rn}),An=nt.extend({method:n("tasks/get"),params:ft.extend({taskId:e()})}),Ln=it.merge(Zt),Dn=nt.extend({method:n("tasks/result"),params:ft.extend({taskId:e()})}),Vn=it.loose(),Un=Gt.extend({method:n("tasks/list")}),Hn=Bt.extend({tasks:r(Zt)}),Fn=nt.extend({method:n("tasks/cancel"),params:ft.extend({taskId:e()})}),xn=it.merge(Zt),Kn=c([qr,qo,Io,Ws,Es,us,is,Do,Uo,xo,Bo,Wo,Xo,Rs,ys]),Jn=c([Tr,jr,No,tn]),Gn=c([wr,Ms,As,Js,en]),Bn=c([qr,ks,Fs,Qs]),Yn=c([Tr,jr,ws,os,Jo,zs,gs,es,Ks]),Wn=c([wr,jo,Oo,Zs,fs,cs,Vo,Ho,Ko,Lr,vs,as]),pt=ee().superRefine((m,h)=>{if(!URL.canParse(m))return h.addIssue({code:Hi.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"}),Zn=d({resource:e().url(),authorization_servers:r(pt).optional(),jwks_uri:e().url().optional(),scopes_supported:r(e()).optional(),bearer_methods_supported:r(e()).optional(),resource_signing_alg_values_supported:r(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:i().optional(),authorization_details_types_supported:r(e()).optional(),dpop_signing_alg_values_supported:r(e()).optional(),dpop_bound_access_tokens_required:i().optional()}),on=d({issuer:e(),authorization_endpoint:pt,token_endpoint:pt,registration_endpoint:pt.optional(),scopes_supported:r(e()).optional(),response_types_supported:r(e()),response_modes_supported:r(e()).optional(),grant_types_supported:r(e()).optional(),token_endpoint_auth_methods_supported:r(e()).optional(),token_endpoint_auth_signing_alg_values_supported:r(e()).optional(),service_documentation:pt.optional(),revocation_endpoint:pt.optional(),revocation_endpoint_auth_methods_supported:r(e()).optional(),revocation_endpoint_auth_signing_alg_values_supported:r(e()).optional(),introspection_endpoint:e().optional(),introspection_endpoint_auth_methods_supported:r(e()).optional(),introspection_endpoint_auth_signing_alg_values_supported:r(e()).optional(),code_challenge_methods_supported:r(e()).optional(),client_id_metadata_document_supported:i().optional(),authorization_response_iss_parameter_supported:i().optional().catch(void 0)}),sn=d({issuer:e(),authorization_endpoint:pt,token_endpoint:pt,userinfo_endpoint:pt.optional(),jwks_uri:pt,registration_endpoint:pt.optional(),scopes_supported:r(e()).optional(),response_types_supported:r(e()),response_modes_supported:r(e()).optional(),grant_types_supported:r(e()).optional(),acr_values_supported:r(e()).optional(),subject_types_supported:r(e()),id_token_signing_alg_values_supported:r(e()),id_token_encryption_alg_values_supported:r(e()).optional(),id_token_encryption_enc_values_supported:r(e()).optional(),userinfo_signing_alg_values_supported:r(e()).optional(),userinfo_encryption_alg_values_supported:r(e()).optional(),userinfo_encryption_enc_values_supported:r(e()).optional(),request_object_signing_alg_values_supported:r(e()).optional(),request_object_encryption_alg_values_supported:r(e()).optional(),request_object_encryption_enc_values_supported:r(e()).optional(),token_endpoint_auth_methods_supported:r(e()).optional(),token_endpoint_auth_signing_alg_values_supported:r(e()).optional(),display_values_supported:r(e()).optional(),claim_types_supported:r(e()).optional(),claims_supported:r(e()).optional(),service_documentation:e().optional(),claims_locales_supported:r(e()).optional(),ui_locales_supported:r(e()).optional(),claims_parameter_supported:i().optional(),request_parameter_supported:i().optional(),request_uri_parameter_supported:i().optional(),require_request_uri_registration:i().optional(),op_policy_uri:pt.optional(),op_tos_uri:pt.optional(),client_id_metadata_document_supported:i().optional(),authorization_response_iss_parameter_supported:i().optional().catch(void 0)}),Xn=t({...sn.shape,...on.pick({code_challenge_methods_supported:!0}).shape}),Qn=t({access_token:e(),id_token:e().optional(),token_type:e(),expires_in:Cl().optional(),scope:e().optional(),refresh_token:e().optional()}).strip(),ei=t({issued_token_type:n("urn:ietf:params:oauth:token-type:id-jag"),access_token:e(),token_type:e().optional(),expires_in:o().optional(),scope:e().optional()}).strip(),ti=t({error:e(),error_description:e().optional(),error_uri:e().optional()}),Pn=pt.optional().or(n("").transform(()=>{return})),nn=t({redirect_uris:r(pt),token_endpoint_auth_method:e().optional(),grant_types:r(e()).optional(),response_types:r(e()).optional(),application_type:e().optional(),client_name:e().optional(),client_uri:pt.optional(),logo_uri:Pn,scope:e().optional(),contacts:r(e()).optional(),tos_uri:Pn,policy_uri:e().optional(),jwks_uri:pt.optional(),jwks:Ee().optional(),software_id:e().optional(),software_version:e().optional(),software_statement:e().optional()}).strip(),cn=t({client_id:e(),client_secret:e().optional(),client_id_issued_at:o().optional(),client_secret_expires_at:o().optional()}).strip(),ai=nn.merge(cn),ri=t({error:e(),error_description:e().optional()}).strip(),oi=t({token:e(),token_type_hint:e().optional()}).strip();var ci=Symbol.for("mcp.sdk.errorBrands");function mi(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,ci,{value:f,enumerable:!1,configurable:!0})}function Ha(m,h){try{if(typeof h==="object"&&h!==null&&Object.prototype.hasOwnProperty.call(m,"mcpBrand")&&typeof m.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(h,ci)){let f=h[ci];if(f&&typeof f.has==="function"&&f.has(m.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(m,h)}var Ch=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](h){return Ha(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 Ha(this,h)}constructor(h,f,g){super(f);this.code=h,this.errorUri=g,this.name="OAuthError",mi(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)}},Xe=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}({}),Ye=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](m){return Ha(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 Ha(this,m)}constructor(m,h,f){super(h);this.code=m,this.data=f,this.name="SdkError",mi(this,new.target)}},qh=class extends Ye{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 Ki(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Hl(m,h,f){return m==="elicitation"&&h==="form"&&f.form===void 0&&f.url===void 0}function oc(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 hi(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(Ki(S)&&Ki(_)){let y={};for(let[w,z]of Object.entries(S))if(z!==void 0&&_[w]===void 0&&!Hl(g,w,_))y[w]=z;if(Object.keys(y).length>0)f[g]=y}}return Object.keys(f).length>0?f:void 0}var sc="2026-07-28",x=[sc];function xa(m){return m>=sc}function nc(m){return m.filter((h)=>!xa(h))}function pi(m){return m.filter((h)=>xa(h))}function ic(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 cc=["task","inputRequests","requestState"];function fi(m){if(m===null||typeof m!=="object"||Array.isArray(m)||m.content!==void 0||cc.some((h)=>(h in m)))return m;return{...m,content:[]}}function Fl(){let m=M(()=>c([e(),o(),i(),R(),s(e(),m),r(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()}),w=t({_meta:y.optional()}),z=w.extend({task:S.optional()}),q=t({method:e(),params:w.loose().optional()}),D=t({_meta:y.optional()}),U=t({method:e(),params:D.loose().optional()}),ne=d({_meta:y.optional()}),me=c([e(),o().int()]),B=ne.strict(),W=D.extend({requestId:me.optional(),reason:e().optional()}),V=U.extend({method:n("notifications/cancelled"),params:W}),C=t({src:e(),mimeType:e().optional(),sizes:r(e()).optional(),theme:p(["light","dark"]).optional()}),K=t({icons:r(C).optional()}),I=t({name:e(),title:e().optional()}),Z=I.extend({...I.shape,...K.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),pe=E(t({applyDefaults:i().optional()}),h),H=A((_t)=>{if(_t&&typeof _t==="object"&&!Array.isArray(_t)&&Object.keys(_t).length===0)return{form:{}};return _t},E(t({form:pe.optional(),url:h.optional()}),h.optional())),L=d({list:h.optional(),cancel:h.optional(),requests:d({sampling:d({createMessage:h.optional()}).optional(),elicitation:d({create:h.optional()}).optional()}).optional()}),ze=d({list:h.optional(),cancel:h.optional(),requests:d({tools:d({call:h.optional()}).optional()}).optional()}),Ne=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:H.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:L.optional(),extensions:s(e(),h).optional()}),Le=w.extend({protocolVersion:e(),capabilities:Ne,clientInfo:Z}),Ie=q.extend({method:n("initialize"),params:Le}),Me=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:ze.optional(),extensions:s(e(),h).optional()}),Ue=ne.extend({protocolVersion:e(),capabilities:Me,serverInfo:Z,instructions:e().optional()}),Ve=U.extend({method:n("notifications/initialized"),params:D.optional()}),Ze=q.extend({method:n("ping"),params:w.optional()}),rt=t({progress:o(),total:u(o()),message:u(e())}),tt=t({...D.shape,...rt.shape,progressToken:f}),ut=U.extend({method:n("notifications/progress"),params:tt}),Qe=w.extend({cursor:g.optional()}),Te=q.extend({params:Qe.optional()}),qe=ne.extend({nextCursor:g.optional()}),Ae=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),re=Ae.extend({text:e()}),Pe=e().refine((_t)=>{try{return atob(_t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ce=Ae.extend({blob:Pe}),De=p(["user","assistant"]),He=t({audience:r(De).optional(),priority:o().min(0).max(1).optional(),lastModified:j({offset:!0}).optional()}),We=t({...I.shape,...K.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:He.optional(),_meta:u(d({}))}),Je=t({...I.shape,...K.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:He.optional(),_meta:u(d({}))}),at=Te.extend({method:n("resources/list")}),bt=qe.extend({resources:r(We)}),$e=Te.extend({method:n("resources/templates/list")}),je=qe.extend({resourceTemplates:r(Je)}),Oe=w.extend({uri:e()}),xe=Oe,Ke=q.extend({method:n("resources/read"),params:xe}),Be=ne.extend({contents:r(c([re,Ce]))}),ct=U.extend({method:n("notifications/resources/list_changed"),params:D.optional()}),mt=Oe,gt=q.extend({method:n("resources/subscribe"),params:mt}),dt=Oe,ot=q.extend({method:n("resources/unsubscribe"),params:dt}),Pt=D.extend({uri:e()}),ht=U.extend({method:n("notifications/resources/updated"),params:Pt}),Nt=t({name:e(),description:u(e()),required:u(i())}),Tt=t({...I.shape,...K.shape,description:u(e()),arguments:u(r(Nt)),_meta:u(d({}))}),It=Te.extend({method:n("prompts/list")}),At=qe.extend({prompts:r(Tt)}),Lt=w.extend({name:e(),arguments:s(e(),e()).optional()}),ta=q.extend({method:n("prompts/get"),params:Lt}),aa=t({type:n("text"),text:e(),annotations:He.optional(),_meta:s(e(),l()).optional()}),ra=t({type:n("image"),data:Pe,mimeType:e(),annotations:He.optional(),_meta:s(e(),l()).optional()}),oa=t({type:n("audio"),data:Pe,mimeType:e(),annotations:He.optional(),_meta:s(e(),l()).optional()}),Ga=t({type:n("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),Dt=t({type:n("resource"),resource:c([re,Ce]),annotations:He.optional(),_meta:s(e(),l()).optional()}),Ba=We.extend({type:n("resource_link")}),wt=c([aa,ra,oa,Ba,Dt]),ga=t({role:De,content:wt}),Sa=ne.extend({description:e().optional(),messages:r(ga)}),sa=U.extend({method:n("notifications/prompts/list_changed"),params:D.optional()}),Ya=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),_a=t({taskSupport:p(["required","optional","forbidden"]).optional()}),na=t({...I.shape,...K.shape,description:e().optional(),inputSchema:t({type:n("object"),properties:s(e(),m).optional(),required:r(e()).optional()}).catchall(l()),outputSchema:t({type:n("object"),properties:s(e(),m).optional(),required:r(e()).optional()}).catchall(l()).optional(),annotations:Ya.optional(),execution:_a.optional(),_meta:s(e(),l()).optional()}),ya=Te.extend({method:n("tools/list")}),va=qe.extend({tools:r(na)}),ba=ne.extend({content:r(wt),structuredContent:s(e(),l()).optional(),isError:i().optional()}),St=z.extend({name:e(),arguments:s(e(),l()).optional()}),Wa=q.extend({method:n("tools/call"),params:St}),to=U.extend({method:n("notifications/tools/list_changed"),params:D.optional()}),Ra=p(["debug","info","notice","warning","error","critical","alert","emergency"]),Za=w.extend({level:Ra}),Xa=q.extend({method:n("logging/setLevel"),params:Za}),Qa=D.extend({level:Ra,logger:e().optional(),data:l()}),er=U.extend({method:n("notifications/message"),params:Qa}),tr=t({name:e().optional()}),ar=t({hints:r(tr).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),rr=t({mode:p(["auto","required","none"]).optional()}),ao=t({type:n("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:r(wt),structuredContent:t({}).loose().optional(),isError:i().optional(),_meta:s(e(),l()).optional()}),or=T("type",[aa,ra,oa]),Vt=T("type",[aa,ra,oa,Ga,ao]),sr=t({role:De,content:c([Vt,r(Vt)]),_meta:s(e(),l()).optional()}),nr=z.extend({messages:r(sr),modelPreferences:ar.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:r(e()).optional(),metadata:h.optional(),tools:r(na).optional(),toolChoice:rr.optional()}),ir=q.extend({method:n("sampling/createMessage"),params:nr}),cr=ne.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens"]).or(e())),role:De,content:or}),lr=ne.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:De,content:c([Vt,r(Vt)])}),ur=t({type:n("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),dr=t({type:n("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),mr=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),hr=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),default:e().optional()}),pr=t({type:n("string"),title:e().optional(),description:e().optional(),oneOf:r(t({const:e(),title:e()})),default:e().optional()}),fr=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),enumNames:r(e()).optional(),default:e().optional()}),gr=c([hr,pr]),ia=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:n("string"),enum:r(e())}),default:r(e()).optional()}),ca=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:r(t({const:e(),title:e()}))}),default:r(e()).optional()}),ro=c([ia,ca]),oo=c([fr,gr,ro]),$t=c([oo,ur,dr,mr]),Et=z.extend({mode:n("form").optional(),message:e(),requestedSchema:t({type:n("object"),properties:s(e(),$t),required:r(e()).optional()}).catchall(l())}),Sr=z.extend({mode:n("url"),message:e(),elicitationId:e(),url:e().url()}),Ct=c([Et,Sr]),so=q.extend({method:n("elicitation/create"),params:Ct}),no=D.extend({elicitationId:e()}),io=U.extend({method:n("notifications/elicitation/complete"),params:no}),co=ne.extend({action:p(["accept","decline","cancel"]),content:A((_t)=>_t===null?void 0:_t,s(e(),c([e(),o(),i(),r(e())])).optional())}),lo=t({type:n("ref/resource"),uri:e()}),uo=t({type:n("ref/prompt"),name:e()}),mo=w.extend({ref:c([uo,lo]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),_r=q.extend({method:n("completion/complete"),params:mo}),ho=ne.extend({completion:d({values:r(e()).max(100),total:u(o().int()),hasMore:u(i())})}),po=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),za=q.extend({method:n("roots/list"),params:w.optional()}),yr=ne.extend({roots:r(po)}),fo=U.extend({method:n("notifications/roots/list_changed"),params:D.optional()}),go=d({ttl:o().optional(),pollInterval:o().optional()}),So=p(["working","input_required","completed","failed","cancelled"]),Ut=t({taskId:e(),status:So,ttl:c([o(),R()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:u(o()),statusMessage:u(e())}),Rt=ne.extend({task:Ut}),_o=D.merge(Ut),la=U.extend({method:n("notifications/tasks/status"),params:_o}),$a=q.extend({method:n("tasks/get"),params:w.extend({taskId:e()})}),Ea=ne.merge(Ut),Pa=q.extend({method:n("tasks/result"),params:w.extend({taskId:e()})}),$n=ne.loose(),zt=Te.extend({method:n("tasks/list")}),lt=qe.extend({tasks:r(Ut)}),ua=q.extend({method:n("tasks/cancel"),params:w.extend({taskId:e()})});return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:f,CursorSchema:g,TaskMetadataSchema:S,RelatedTaskMetadataSchema:_,RequestMetaSchema:y,BaseRequestParamsSchema:w,TaskAugmentedRequestParamsSchema:z,RequestSchema:q,NotificationsParamsSchema:D,NotificationSchema:U,ResultSchema:ne,RequestIdSchema:me,EmptyResultSchema:B,CancelledNotificationParamsSchema:W,CancelledNotificationSchema:V,IconSchema:C,IconsSchema:K,BaseMetadataSchema:I,ImplementationSchema:Z,ClientTasksCapabilitySchema:L,ServerTasksCapabilitySchema:ze,ClientCapabilitiesSchema:Ne,InitializeRequestParamsSchema:Le,InitializeRequestSchema:Ie,ServerCapabilitiesSchema:Me,InitializeResultSchema:Ue,InitializedNotificationSchema:Ve,PingRequestSchema:Ze,ProgressSchema:rt,ProgressNotificationParamsSchema:tt,ProgressNotificationSchema:ut,PaginatedRequestParamsSchema:Qe,PaginatedRequestSchema:Te,PaginatedResultSchema:qe,ResourceContentsSchema:Ae,TextResourceContentsSchema:re,BlobResourceContentsSchema:Ce,RoleSchema:De,AnnotationsSchema:He,ResourceSchema:We,ResourceTemplateSchema:Je,ListResourcesRequestSchema:at,ListResourcesResultSchema:bt,ListResourceTemplatesRequestSchema:$e,ListResourceTemplatesResultSchema:je,ResourceRequestParamsSchema:Oe,ReadResourceRequestParamsSchema:xe,ReadResourceRequestSchema:Ke,ReadResourceResultSchema:Be,ResourceListChangedNotificationSchema:ct,SubscribeRequestParamsSchema:mt,SubscribeRequestSchema:gt,UnsubscribeRequestParamsSchema:dt,UnsubscribeRequestSchema:ot,ResourceUpdatedNotificationParamsSchema:Pt,ResourceUpdatedNotificationSchema:ht,PromptArgumentSchema:Nt,PromptSchema:Tt,ListPromptsRequestSchema:It,ListPromptsResultSchema:At,GetPromptRequestParamsSchema:Lt,GetPromptRequestSchema:ta,TextContentSchema:aa,ImageContentSchema:ra,AudioContentSchema:oa,ToolUseContentSchema:Ga,EmbeddedResourceSchema:Dt,ResourceLinkSchema:Ba,ContentBlockSchema:wt,PromptMessageSchema:ga,GetPromptResultSchema:Sa,PromptListChangedNotificationSchema:sa,ToolAnnotationsSchema:Ya,ToolExecutionSchema:_a,ToolSchema:na,ListToolsRequestSchema:ya,ListToolsResultSchema:va,CallToolResultSchema:ba,CallToolRequestParamsSchema:St,CallToolRequestSchema:Wa,ToolListChangedNotificationSchema:to,LoggingLevelSchema:Ra,SetLevelRequestParamsSchema:Za,SetLevelRequestSchema:Xa,LoggingMessageNotificationParamsSchema:Qa,LoggingMessageNotificationSchema:er,ModelHintSchema:tr,ModelPreferencesSchema:ar,ToolChoiceSchema:rr,ToolResultContentSchema:ao,SamplingContentSchema:or,SamplingMessageContentBlockSchema:Vt,SamplingMessageSchema:sr,CreateMessageRequestParamsSchema:nr,CreateMessageRequestSchema:ir,CreateMessageResultSchema:cr,CreateMessageResultWithToolsSchema:lr,BooleanSchemaSchema:ur,StringSchemaSchema:dr,NumberSchemaSchema:mr,UntitledSingleSelectEnumSchemaSchema:hr,TitledSingleSelectEnumSchemaSchema:pr,LegacyTitledEnumSchemaSchema:fr,SingleSelectEnumSchemaSchema:gr,UntitledMultiSelectEnumSchemaSchema:ia,TitledMultiSelectEnumSchemaSchema:ca,MultiSelectEnumSchemaSchema:ro,EnumSchemaSchema:oo,PrimitiveSchemaDefinitionSchema:$t,ElicitRequestFormParamsSchema:Et,ElicitRequestURLParamsSchema:Sr,ElicitRequestParamsSchema:Ct,ElicitRequestSchema:so,ElicitationCompleteNotificationParamsSchema:no,ElicitationCompleteNotificationSchema:io,ElicitResultSchema:co,ResourceTemplateReferenceSchema:lo,PromptReferenceSchema:uo,CompleteRequestParamsSchema:mo,CompleteRequestSchema:_r,CompleteResultSchema:ho,RootSchema:po,ListRootsRequestSchema:za,ListRootsResultSchema:yr,RootsListChangedNotificationSchema:fo,TaskCreationParamsSchema:go,TaskStatusSchema:So,TaskSchema:Ut,CreateTaskResultSchema:Rt,TaskStatusNotificationParamsSchema:_o,TaskStatusNotificationSchema:la,GetTaskRequestSchema:$a,GetTaskResultSchema:Ea,GetTaskPayloadRequestSchema:Pa,GetTaskPayloadResultSchema:$n,ListTasksRequestSchema:zt,ListTasksResultSchema:lt,CancelTaskRequestSchema:ua,CancelTaskResultSchema:ne.merge(Ut),ClientRequestSchema:c([Ze,Ie,_r,Xa,ta,It,at,$e,Ke,gt,ot,Wa,ya,$a,Pa,zt,ua]),ClientNotificationSchema:c([V,ut,Ve,fo,la]),ClientResultSchema:c([B,cr,lr,co,yr,Ea,lt,Rt]),ServerRequestSchema:c([Ze,ir,so,za,$a,Pa,zt,ua]),ServerNotificationSchema:c([V,ut,er,ht,ct,to,sa,la,io]),ServerResultSchema:c([B,Ue,ho,Sa,At,bt,je,Be,ba,va,Ea,lt,Rt]),CallToolResultWireSchema:l().superRefine((_t,gl)=>{if(typeof _t!=="object"||_t===null||Array.isArray(_t)||_t.content!==void 0)return;for(let Mi of cc)if(Mi in _t){gl.addIssue({code:"custom",message:`content is required when the body carries '${Mi}' — another result family cannot default into an empty tools/call success`});return}}).transform(fi).pipe(ba)}}var xl;function lc(){return xl??=Fl()}function uc(m){return m.type!=="object"}var Kl=new Set(["const","enum","default","examples"]),Jl=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Ji(m){return m!==void 0&&!(typeof m==="string"&&m.startsWith("#"))}function Gl(m){let h=typeof m.$schema==="string"?m.$schema:void 0;if(Ji(m.$id))return{...h!==void 0&&{$schema:h},type:"object",properties:{result:m},required:["result"]};let f=Di(m.$schema)&&m.$recursiveAnchor!==!0,g=(S,_)=>{if(Array.isArray(S))return S.map((z)=>g(z,!1));if(S===null||typeof S!=="object")return S;if(!_&&Ji(S.$id))return S;let y={},w=!1;for(let[z,q]of Object.entries(S))if(_)y[z]=g(q,!1);else if((z==="$ref"||z==="$dynamicRef")&&typeof q==="string")y[z]=q==="#"?"#/properties/result":q.startsWith("#/")?`#/properties/result${q.slice(1)}`:q;else if(z==="$recursiveRef"&&q==="#"&&f)w=!0;else if(Kl.has(z))y[z]=q;else if(Jl.has(z))y[z]=g(q,!0);else y[z]=g(q,!1);if(w)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 dc={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},mc={"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},Bl={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},ln;function gi(){if(ln)return ln;let m=lc();return ln={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}},ln}function hc(m){return Object.prototype.hasOwnProperty.call(dc,m)}function pc(m){return Object.prototype.hasOwnProperty.call(mc,m)}function Yl(m){return Object.prototype.hasOwnProperty.call(Bl,m)}function Wl(m){return Yl(m)?gi().resultSchemas[m]:void 0}function Zl(m){return hc(m)?gi().requestSchemas[m]:void 0}function Xl(m){return pc(m)?gi().notificationSchemas[m]:void 0}var jh=Object.keys(dc),Nh=Object.keys(mc);function li(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function un(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 Gi={ok:!1,reason:"not-in-era"};function Bi(m){return li(m)&&li(m.outputSchema)&&uc(m.outputSchema)}function Yi(m){return m}var Si={era:"2025-11-25",hasRequestMethod:hc,hasNotificationMethod:pc,validateRequest:(m,h)=>un(Zl(m),h),validateResult:(m,h)=>un(Wl(m),h),validateNotification:(m,h)=>un(Xl(m),h),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Gi,validateInputResponse:()=>Gi,samplingResultVariant:(m,h)=>{let f=lc();return un(m?f.CreateMessageResultWithToolsSchema:f.CreateMessageResultSchema,h)},outboundEnvelope:(m)=>{return},validateEnvelopeMeta:(m)=>[],projectCallToolResult(m,h){let f=ic(m),g=f.structuredContent;if(g===void 0)return f;let S=typeof g!=="object"||g===null||Array.isArray(g),_=h!==void 0&&uc(h);if(!S&&!_)return f;return{...f,structuredContent:{result:g}}},decodeResult(m,h){if(li(h)&&"resultType"in h){let f={...h};return delete f.resultType,{kind:"complete",result:Yi(f)}}return{kind:"complete",result:Yi(h)}},encodeResult(m,h){if(m!=="tools/list")return h;let f=h.tools;if(!Array.isArray(f)||!f.some((g)=>Bi(g)))return h;return{...h,tools:f.map((g)=>Bi(g)?{...g,outputSchema:Gl(g.outputSchema)}:g)}},encodeErrorCode:(m)=>m===-32002?-32602:m,checkInboundEnvelope:(m)=>{return}};function Ql(){let m=M(()=>c([e(),o(),i(),R(),s(e(),m),r(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"]),w=e().refine((lt)=>{try{return atob(lt),!0}catch{return!1}},{message:"Invalid Base64 string"}),z=t({ttl:o().optional()}),q=t({taskId:e()}),D=d({progressToken:f.optional(),"io.modelcontextprotocol/related-task":q.optional()}),U=t({_meta:D.optional()}),ne=U.extend({task:z.optional()}),me=t({_meta:D.optional()}),B=t({method:e(),params:me.loose().optional()}),W=t({src:e(),mimeType:e().optional(),sizes:r(e()).optional(),theme:p(["light","dark"]).optional()}),V=t({icons:r(W).optional()}),C=t({name:e(),title:e().optional()}),K=C.extend({...C.shape,...V.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),I=E(t({applyDefaults:i().optional()}),h),Z=A((lt)=>{if(lt&&typeof lt==="object"&&!Array.isArray(lt)&&Object.keys(lt).length===0)return{form:{}};return lt},E(t({form:I.optional(),url:h.optional()}),h.optional())),pe=d({list:h.optional(),cancel:h.optional(),requests:d({sampling:d({createMessage:h.optional()}).optional(),elicitation:d({create:h.optional()}).optional()}).optional()}),H=d({list:h.optional(),cancel:h.optional(),requests:d({tools:d({call:h.optional()}).optional()}).optional()}),L=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:Z.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:pe.optional(),extensions:s(e(),h).optional()}),ze=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:H.optional(),extensions:s(e(),h).optional()}),Ne=t({progress:o(),total:u(o()),message:u(e())}),Le=t({...me.shape,...Ne.shape,progressToken:f}),Ie=B.extend({method:n("notifications/progress"),params:Le}),Me=me.extend({level:y,logger:e().optional(),data:l()}),Ue=B.extend({method:n("notifications/message"),params:Me}),Ve=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),Ze=Ve.extend({text:e()}),rt=Ve.extend({blob:w}),tt=t({audience:r(_).optional(),priority:o().min(0).max(1).optional(),lastModified:j({offset:!0}).optional()}),ut=t({...C.shape,...V.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:tt.optional(),_meta:u(d({}))}),Qe=t({...C.shape,...V.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:tt.optional(),_meta:u(d({}))}),Te=B.extend({method:n("notifications/resources/list_changed"),params:me.optional()}),qe=me.extend({uri:e()}),Ae=B.extend({method:n("notifications/resources/updated"),params:qe}),re=t({name:e(),description:u(e()),required:u(i())}),Pe=t({...C.shape,...V.shape,description:u(e()),arguments:u(r(re)),_meta:u(d({}))}),Ce=B.extend({method:n("notifications/prompts/list_changed"),params:me.optional()}),De=t({type:n("text"),text:e(),annotations:tt.optional(),_meta:s(e(),l()).optional()}),He=t({type:n("image"),data:w,mimeType:e(),annotations:tt.optional(),_meta:s(e(),l()).optional()}),We=t({type:n("audio"),data:w,mimeType:e(),annotations:tt.optional(),_meta:s(e(),l()).optional()}),Je=t({type:n("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),at=t({type:n("resource"),resource:c([Ze,rt]),annotations:tt.optional(),_meta:s(e(),l()).optional()}),bt=ut.extend({type:n("resource_link")}),$e=c([De,He,We,bt,at]),je=t({role:_,content:$e}),Oe=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),xe=B.extend({method:n("notifications/tools/list_changed"),params:me.optional()}),Ke=t({name:e().optional()}),Be=t({hints:r(Ke).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),ct=t({mode:p(["auto","required","none"]).optional()}),mt=t({type:n("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),gt=t({type:n("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),dt=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),ot=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),default:e().optional()}),Pt=t({type:n("string"),title:e().optional(),description:e().optional(),oneOf:r(t({const:e(),title:e()})),default:e().optional()}),ht=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),enumNames:r(e()).optional(),default:e().optional()}),Nt=c([ot,Pt]),Tt=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:n("string"),enum:r(e())}),default:r(e()).optional()}),It=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:r(t({const:e(),title:e()}))}),default:r(e()).optional()}),At=c([Tt,It]),Lt=c([ht,Nt,At]),ta=c([Lt,mt,gt,dt]),aa=ne.extend({mode:n("form").optional(),message:e(),requestedSchema:t({type:n("object"),properties:s(e(),ta),required:r(e()).optional()}).catchall(l())}),ra=t({type:n("ref/resource"),uri:e()}),oa=t({type:n("ref/prompt"),name:e()}),Ga=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),Dt=L.shape,Ba=t({experimental:Dt.experimental,sampling:Dt.sampling,elicitation:Dt.elicitation,roots:Dt.roots,extensions:Dt.extensions}),wt=ze.shape,ga=t({experimental:wt.experimental,logging:wt.logging,completions:wt.completions,prompts:wt.prompts,resources:wt.resources,tools:wt.tools,extensions:wt.extensions}),Sa=d({progressToken:f.optional(),[Ft]:e(),[vr]:K.optional(),[xt]:Ba,[ma]:y.optional()}),sa=t({...C.shape,...V.shape,description:e().optional(),inputSchema:d({$schema:e().optional(),type:n("object")}),outputSchema:d({$schema:e().optional()}).optional(),annotations:Oe.optional(),_meta:s(e(),l()).optional()}),Ya=t({type:n("tool_result"),toolUseId:e(),content:r($e),structuredContent:l().optional(),isError:i().optional(),_meta:s(e(),l()).optional()}),_a=c([De,He,We,Je,Ya]),na=t({role:_,content:c([_a,r(_a)]),_meta:s(e(),l()).optional()}),ya=e(),va=d({[kt]:K.optional().catch(void 0)}),ba=va.optional();function St(lt){return d({_meta:ba,resultType:ya.default("complete"),...lt})}let Wa=St({}),to=St({nextCursor:g.optional()}),Ra=St({content:r($e),structuredContent:l().optional(),isError:i().optional()}),Za=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),tools:r(sa),nextCursor:g.optional()}),Xa=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),prompts:r(Pe),nextCursor:g.optional()}),Qa=St({description:e().optional(),messages:r(je)}),er=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resources:r(ut),nextCursor:g.optional()}),tr=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resourceTemplates:r(Qe),nextCursor:g.optional()}),ar=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),contents:r(c([Ze,rt]))}),rr=St({completion:t({values:r(e()).max(100),total:o().int().optional(),hasMore:i().optional()}).loose()}),ao=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"])}),or=St({ttlMs:o().int().min(0).catch(0),cacheScope:p(["public","private"]).catch("private"),supportedVersions:r(e()),capabilities:ga,instructions:e().optional()}),Vt=t({messages:r(na),modelPreferences:Be.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:r(e()).optional(),metadata:h.optional(),tools:r(sa).optional(),toolChoice:ct.optional()}),sr=t({method:n("sampling/createMessage"),params:Vt}),nr=t({method:n("roots/list"),params:t({_meta:s(e(),l()).optional()}).optional()}),ir=t({...na.shape,model:e(),stopReason:e().optional()}),cr=t({roots:r(Ga)}),lr=t({action:p(["accept","decline","cancel"]),content:s(e(),c([e(),o(),i(),r(e())])).optional()}),ur=t({mode:n("url"),message:e(),url:e().url()}),dr=c([aa,ur]),mr=t({method:n("elicitation/create"),params:dr}),hr=c([sr,nr,mr]),pr=c([ir,cr,lr]),fr=s(e(),hr),gr=s(e(),pr),ia=St({inputRequests:fr.optional(),requestState:e().optional()}),ca={inputResponses:gr.optional(),requestState:e().optional()},ro=t({_meta:Sa,...ca}),oo=d({progressToken:f.optional()});function $t(lt,ua){return t({method:n(lt),params:t({_meta:Sa,...ua})})}function Et(lt,ua){return t({method:n(lt),params:t({_meta:oo.optional(),...ua}).optional()})}let Sr={name:e(),arguments:s(e(),l()).optional(),...ca},Ct={cursor:g.optional()},so=$t("tools/call",Sr),no=$t("tools/list",Ct),io=$t("prompts/list",Ct),co=$t("prompts/get",{name:e(),arguments:s(e(),e()).optional(),...ca}),lo=$t("resources/list",Ct),uo=$t("resources/templates/list",Ct),mo=$t("resources/read",{uri:e(),...ca}),_r={ref:c([oa,ra]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()},ho=$t("completion/complete",_r),po=$t("server/discover",{}),za=t({toolsListChanged:i().optional(),promptsListChanged:i().optional(),resourcesListChanged:i().optional(),resourceSubscriptions:r(e()).optional()}),yr={notifications:za},fo=$t("subscriptions/listen",yr),go=va.extend({"io.modelcontextprotocol/subscriptionId":S}),So=d({_meta:go,resultType:ya.default("complete")}),Ut={"tools/call":Et("tools/call",Sr),"tools/list":Et("tools/list",Ct),"prompts/get":Et("prompts/get",{name:e(),arguments:s(e(),e()).optional()}),"prompts/list":Et("prompts/list",Ct),"resources/list":Et("resources/list",Ct),"resources/templates/list":Et("resources/templates/list",Ct),"resources/read":Et("resources/read",{uri:e()}),"completion/complete":Et("completion/complete",_r),"server/discover":Et("server/discover",{}),"subscriptions/listen":Et("subscriptions/listen",yr)};function Rt(lt){return d({_meta:ba,...lt})}let _o={"tools/call":Rt({content:r($e),structuredContent:l().optional(),isError:i().optional()}),"tools/list":Rt({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),tools:r(sa),nextCursor:g.optional()}),"prompts/get":Rt({description:e().optional(),messages:r(je)}),"prompts/list":Rt({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),prompts:r(Pe),nextCursor:g.optional()}),"resources/list":Rt({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resources:r(ut),nextCursor:g.optional()}),"resources/templates/list":Rt({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resourceTemplates:r(Qe),nextCursor:g.optional()}),"resources/read":Rt({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),contents:r(c([Ze,rt]))}),"completion/complete":Rt({completion:t({values:r(e()).max(100),total:o().int().optional(),hasMore:i().optional()}).loose()}),"server/discover":Rt({ttlMs:o().int().min(0).catch(0),cacheScope:p(["public","private"]).catch("private"),supportedVersions:r(e()),capabilities:ga,instructions:e().optional()}),"subscriptions/listen":Rt({})},la=d({"io.modelcontextprotocol/subscriptionId":S.optional()}),$a=t({method:n("notifications/subscriptions/acknowledged"),params:t({_meta:la.optional(),notifications:za})}),Ea=t({_meta:la.optional(),requestId:S,reason:e().optional()}),Pa=t({method:n("notifications/cancelled"),params:Ea}),$n={"notifications/cancelled":Pa,"notifications/progress":Ie,"notifications/message":Ue,"notifications/resources/updated":Ae,"notifications/resources/list_changed":Te,"notifications/tools/list_changed":xe,"notifications/prompts/list_changed":Ce,"notifications/subscriptions/acknowledged":$a},zt=(lt)=>t({jsonrpc:n("2.0"),id:c([e(),o().int()]),result:lt}).strict();return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:f,CursorSchema:g,RequestIdSchema:S,RoleSchema:_,LoggingLevelSchema:y,TaskMetadataSchema:z,RelatedTaskMetadataSchema:q,RequestMetaSchema:D,BaseRequestParamsSchema:U,TaskAugmentedRequestParamsSchema:ne,NotificationsParamsSchema:me,NotificationSchema:B,IconSchema:W,IconsSchema:V,BaseMetadataSchema:C,ImplementationSchema:K,ClientTasksCapabilitySchema:pe,ServerTasksCapabilitySchema:H,ClientCapabilitiesSchema:L,ServerCapabilitiesSchema:ze,ProgressSchema:Ne,ProgressNotificationParamsSchema:Le,ProgressNotificationSchema:Ie,LoggingMessageNotificationParamsSchema:Me,LoggingMessageNotificationSchema:Ue,ResourceContentsSchema:Ve,TextResourceContentsSchema:Ze,BlobResourceContentsSchema:rt,AnnotationsSchema:tt,ResourceSchema:ut,ResourceTemplateSchema:Qe,ResourceListChangedNotificationSchema:Te,ResourceUpdatedNotificationParamsSchema:qe,ResourceUpdatedNotificationSchema:Ae,PromptArgumentSchema:re,PromptSchema:Pe,PromptListChangedNotificationSchema:Ce,TextContentSchema:De,ImageContentSchema:He,AudioContentSchema:We,ToolUseContentSchema:Je,EmbeddedResourceSchema:at,ResourceLinkSchema:bt,ContentBlockSchema:$e,PromptMessageSchema:je,ToolAnnotationsSchema:Oe,ToolListChangedNotificationSchema:xe,ModelHintSchema:Ke,ModelPreferencesSchema:Be,ToolChoiceSchema:ct,BooleanSchemaSchema:mt,StringSchemaSchema:gt,NumberSchemaSchema:dt,UntitledSingleSelectEnumSchemaSchema:ot,TitledSingleSelectEnumSchemaSchema:Pt,LegacyTitledEnumSchemaSchema:ht,SingleSelectEnumSchemaSchema:Nt,UntitledMultiSelectEnumSchemaSchema:Tt,TitledMultiSelectEnumSchemaSchema:It,MultiSelectEnumSchemaSchema:At,EnumSchemaSchema:Lt,PrimitiveSchemaDefinitionSchema:ta,ElicitRequestFormParamsSchema:aa,ResourceTemplateReferenceSchema:ra,PromptReferenceSchema:oa,RootSchema:Ga,ClientCapabilities2026Schema:Ba,ServerCapabilities2026Schema:ga,RequestMetaEnvelopeSchema:Sa,ToolSchema:sa,ToolResultContentSchema:Ya,SamplingMessageContentBlockSchema:_a,SamplingMessageSchema:na,ResultTypeSchema:ya,ResultMetaSchema:va,ResultSchema:Wa,PaginatedResultSchema:to,CallToolResultSchema:Ra,ListToolsResultSchema:Za,ListPromptsResultSchema:Xa,GetPromptResultSchema:Qa,ListResourcesResultSchema:er,ListResourceTemplatesResultSchema:tr,ReadResourceResultSchema:ar,CompleteResultSchema:rr,CacheableResultSchema:ao,DiscoverResultSchema:or,CreateMessageRequestParamsSchema:Vt,CreateMessageRequestSchema:sr,ListRootsRequestSchema:nr,CreateMessageResultSchema:ir,ListRootsResultSchema:cr,ElicitResultSchema:lr,ElicitRequestURLParamsSchema:ur,ElicitRequestParamsSchema:dr,ElicitRequestSchema:mr,InputRequestSchema:hr,InputResponseSchema:pr,InputRequestsSchema:fr,InputResponsesSchema:gr,InputRequiredResultSchema:ia,InputResponseRequestParamsSchema:ro,CallToolRequestSchema:so,ListToolsRequestSchema:no,ListPromptsRequestSchema:io,GetPromptRequestSchema:co,ListResourcesRequestSchema:lo,ListResourceTemplatesRequestSchema:uo,ReadResourceRequestSchema:mo,CompleteRequestSchema:ho,DiscoverRequestSchema:po,SubscriptionFilterSchema:za,SubscriptionsListenRequestSchema:fo,SubscriptionsListenResultMetaSchema:go,SubscriptionsListenResultSchema:So,dispatchRequestSchemas:Ut,dispatchResultSchemas:_o,NotificationMetaSchema:la,SubscriptionsAcknowledgedNotificationSchema:$a,CancelledNotificationParamsSchema:Ea,CancelledNotificationSchema:Pa,notificationSchemas2026:$n,JSONRPCResultResponseSchema:zt(Wa),CallToolResultResponseSchema:zt(c([Ra,ia])),ListToolsResultResponseSchema:zt(Za),ListPromptsResultResponseSchema:zt(Xa),GetPromptResultResponseSchema:zt(c([Qa,ia])),ListResourcesResultResponseSchema:zt(er),ListResourceTemplatesResultResponseSchema:zt(tr),ReadResourceResultResponseSchema:zt(c([ar,ia])),CompleteResultResponseSchema:zt(rr),DiscoverResultResponseSchema:zt(or)}}var eu;function fa(){return eu??=Ql()}var tu=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function au(m){return tu.includes(m)}var Ua=Symbol("modelcontextprotocol.resultCacheHintFallback");function gn(m,h){if(h===void 0)return m;let f=m[Ua];if(f===void 0)return{...m,[Ua]: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,[Ua]:g}}function ru(m){return m[Ua]}function _i(m){return typeof m==="number"&&Number.isSafeInteger(m)&&m>=0}function yi(m){return m==="public"||m==="private"}function vi(m,h){if(m.ttlMs!==void 0&&!_i(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&&!yi(m.cacheScope))throw RangeError(`Invalid cache hint for ${h}: cacheScope must be 'public' or 'private' (got ${String(m.cacheScope)})`)}var a=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}({}),Fe=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](h){return Ha(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 Ha(this,h)}constructor(h,f,g){super(f);this.code=h,this.data=g,this.name="ProtocolError",mi(this,new.target)}static fromError(h,f,g){if(h===a.UrlElicitationRequired&&g){let S=g;if(S.elicitations)return new ou(S.elicitations,f)}if(h===a.UnsupportedProtocolVersion&&g){let S=g;if(Array.isArray(S.supported)&&typeof S.requested==="string")return new F({supported:S.supported,requested:S.requested},f)}if(h===a.InvalidParams||h===a.ResourceNotFound){let S=g;if(typeof S?.uri==="string"&&(h===a.ResourceNotFound||Object.keys(S).length===1))return new bi(S.uri,f)}if(h===a.MissingRequiredClientCapability&&g){let S=g;if(S.requiredCapabilities!==null&&typeof S.requiredCapabilities==="object"&&!Array.isArray(S.requiredCapabilities))return new Ri({requiredCapabilities:S.requiredCapabilities},f)}return new m(h,f,g)}},bi=class extends Fe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(m,h=`Resource not found: ${m}`){super(a.InvalidParams,h,{uri:m})}get uri(){return this.data.uri}},ou=class extends Fe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(m,h=`URL elicitation${m.length>1?"s":""} required`){super(a.UrlElicitationRequired,h,{elicitations:m})}get elicitations(){return this.data?.elicitations??[]}},F=class extends Fe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(m,h=`Unsupported protocol version: ${m.requested}`){super(a.UnsupportedProtocolVersion,h,m)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Ri=class extends Fe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(m,h=`Missing required client capabilities: ${Object.keys(m.requiredCapabilities).join(", ")}`){super(a.MissingRequiredClientCapability,h,m)}get requiredCapabilities(){return this.data.requiredCapabilities}},su=0,nu="private",iu=["tools/call","prompts/get","resources/read"];function cu(m,h){let f=h.resultType;if(f===void 0)return{...h,resultType:"complete"};if(f==="complete")return h;if(iu.includes(m))return h;throw new Fe(a.InternalError,`Handler for ${m} returned resultType '${String(f)}', but results of ${m} only support 'complete' on protocol revision 2026-07-28`)}function lu(m,h){let f=ru(h);if(h.resultType!=="complete"||!au(m))return f===void 0?h:pu(h);let g=h,S=_i(g.ttlMs)?g.ttlMs:mu(f),_=yi(g.cacheScope)?g.cacheScope:hu(f),y={...g,ttlMs:S,cacheScope:_};return delete y[Ua],y}function uu(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function du(m,h){if(h===void 0)return m;let f=m._meta;if(f===void 0)return{...m,_meta:{[kt]:h}};if(!uu(f))return m;if(f[kt]!==void 0)return m;return{...m,_meta:{...f,[kt]:h}}}function mu(m){return m!==void 0&&_i(m.ttlMs)?m.ttlMs:su}function hu(m){return m!==void 0&&yi(m.cacheScope)?m.cacheScope:nu}function pu(m){let h={...m};return delete h[Ua],h}var fu=["elicitation/create","sampling/createMessage","roots/list"],dn;function fc(){if(dn)return dn;let m=fa();return dn={request:{"elicitation/create":t({method:n("elicitation/create"),params:m.ElicitRequestParamsSchema}),"sampling/createMessage":t({method:n("sampling/createMessage"),params:m.CreateMessageRequestParamsSchema}),"roots/list":t({method:n("roots/list"),params:d({}).optional()})},response:{"elicitation/create":m.ElicitResultSchema,"sampling/createMessage":m.CreateMessageResultSchema,"roots/list":m.ListRootsResultSchema}},dn}function gc(m){return fu.includes(m)}function si(m){return gc(m)?fc().request[m]:void 0}function gu(m){return gc(m)?fc().response[m]:void 0}var zi={"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},Sc={"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 _c(m){return Object.prototype.hasOwnProperty.call(zi,m)}function yc(m){return Object.prototype.hasOwnProperty.call(Sc,m)}function Su(m){return Object.prototype.hasOwnProperty.call(zi,m)}function _u(m){return _c(m)?fa().dispatchRequestSchemas[m]:void 0}function yu(m){return Su(m)?fa().dispatchResultSchemas[m]:void 0}function vu(m){return yc(m)?fa().notificationSchemas2026[m]:void 0}var Ih=Object.keys(zi),Oh=Object.keys(Sc);function Br(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Jr(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 bu={ok:!1,reason:"not-in-era"},Ru=[Ft,xt];function zu(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((w)=>Br(w)&&("execution"in w)))S().tools=_.map((w)=>{if(!Br(w)||!("execution"in w))return w;let z={...w};return delete z.execution,z});let y=h.capabilities;if(Br(y)&&"tasks"in y){let w={...y};delete w.tasks,S().capabilities=w}return f}var $i={era:"2026-07-28",hasRequestMethod:_c,hasNotificationMethod:yc,hasInputRequestMethod:(m)=>si(m)!==void 0,validateRequest:(m,h)=>Jr(_u(m),h),validateResult:(m,h)=>Jr(yu(m),h),validateNotification:(m,h)=>Jr(vu(m),h),validateInputRequest:(m,h)=>Jr(si(m),h),validateInputResponse:(m,h)=>Jr(gu(m),h),samplingResultVariant:()=>bu,outboundEnvelope(m){return{[Ft]:m.protocolVersion,[vr]:m.clientInfo,[xt]:m.clientCapabilities,...m.logLevel!==void 0&&{[ma]:m.logLevel}}},validateEnvelopeMeta(m){let h=[];for(let g of Ru)if(!(g in m))h.push({key:g,problem:"missing"});let f=fa().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)=>ic(m),inputRequestSchema:si,decodeResult(m,h){if(!Br(h))return{kind:"invalid",error:new Ye(Xe.InvalidResult,`Invalid result for ${m}: not an object`,{method:m})};let f=h.resultType;if(f===void 0)return{kind:"invalid",error:new Ye(Xe.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 Ye(Xe.InvalidResult,`Invalid result for ${m}: non-string resultType`,{method:m,resultType:f})};if(f==="input_required"){let y=h.inputRequests,w=Br(y)?y:{},z=h.requestState;if(Object.keys(w).length===0&&typeof z!=="string")return{kind:"invalid",error:new Ye(Xe.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:w,...typeof z==="string"&&{requestState:z}}}if(f!=="complete")return{kind:"invalid",error:new Ye(Xe.UnsupportedResultType,`Unsupported result type '${f}' for ${m}`,{resultType:f,method:m})};let g=$u(),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 Ye(Xe.InvalidResult,`Invalid result for ${m}: ${y.error}`,{method:m})}}let _={...h};return delete _.resultType,{kind:"complete",result:_}},encodeResult(m,h,f){return du(lu(m,cu(m,zu(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=fa().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("; ")}`}},mn;function $u(){if(mn)return mn;let m=fa();return mn={"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},mn}var Zr="2026-07-28";function Xt(m){return m!==void 0&&xa(m)?$i:Si}function Wi(m){if(m.revision!==void 0)return Xt(m.revision).era;return m.era==="modern"?$i.era:Si.era}function ni(m){return vc.some((h)=>h.hasRequestMethod(m))}function ii(m){return vc.some((h)=>h.hasNotificationMethod(m))}var vc=[Si,$i];function Zi(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function O(m){if(!Zi(m))return;let h=m._meta;return Zi(h)?h:void 0}function G(m){let h=O(m);return h!==void 0&&Ft in h}function J(m){let h=O(m)?.[Ft];return typeof h==="string"?h:void 0}function Y(m){return Xt(Zr).validateEnvelopeMeta(m)}var Eu=Ai({AnnotationsSchema:()=>Mt,AudioContentSchema:()=>Ma,BaseMetadataSchema:()=>Ot,BaseRequestParamsSchema:()=>ft,BlobResourceContentsSchema:()=>Or,BooleanSchemaSchema:()=>Dr,CallToolRequestParamsSchema:()=>bs,CallToolRequestSchema:()=>Rs,CallToolResultSchema:()=>Lr,CancelTaskRequestSchema:()=>Fn,CancelTaskResultSchema:()=>xn,CancelledNotificationParamsSchema:()=>$o,CancelledNotificationSchema:()=>Tr,ClientCapabilitiesSchema:()=>To,ClientNotificationSchema:()=>Jn,ClientRequestSchema:()=>Kn,ClientResultSchema:()=>Gn,ClientTasksCapabilitySchema:()=>Po,CompatibilityCallToolResultSchema:()=>Nn,CompleteRequestParamsSchema:()=>Ys,CompleteRequestSchema:()=>Ws,CompleteResultSchema:()=>Zs,ContentBlockSchema:()=>Aa,CreateMessageRequestParamsSchema:()=>Os,CreateMessageRequestSchema:()=>ks,CreateMessageResultSchema:()=>Ms,CreateMessageResultWithToolsSchema:()=>As,CreateTaskResultSchema:()=>kn,CursorSchema:()=>Rr,DiscoverRequestSchema:()=>Io,DiscoverResultSchema:()=>Oo,ElicitRequestFormParamsSchema:()=>Va,ElicitRequestParamsSchema:()=>Hs,ElicitRequestSchema:()=>Fs,ElicitRequestURLParamsSchema:()=>Us,ElicitResultSchema:()=>Js,ElicitationCompleteNotificationParamsSchema:()=>xs,ElicitationCompleteNotificationSchema:()=>Ks,EmbeddedResourceSchema:()=>ms,EmptyResultSchema:()=>wr,EnumSchemaSchema:()=>Vs,GetPromptRequestParamsSchema:()=>ls,GetPromptRequestSchema:()=>us,GetPromptResultSchema:()=>fs,GetTaskPayloadRequestSchema:()=>Dn,GetTaskPayloadResultSchema:()=>Vn,GetTaskRequestSchema:()=>An,GetTaskResultSchema:()=>Ln,IconSchema:()=>Eo,IconsSchema:()=>Jt,ImageContentSchema:()=>ka,ImplementationSchema:()=>Na,InitializeRequestParamsSchema:()=>Co,InitializeRequestSchema:()=>qo,InitializeResultSchema:()=>jo,InitializedNotificationSchema:()=>No,JSONArraySchema:()=>Cn,JSONObjectSchema:()=>st,JSONRPCErrorResponseSchema:()=>ja,JSONRPCMessageSchema:()=>zo,JSONRPCNotificationSchema:()=>Pr,JSONRPCRequestSchema:()=>Er,JSONRPCResponseSchema:()=>qn,JSONRPCResultResponseSchema:()=>qa,JSONValueSchema:()=>Ht,LegacyTitledEnumSchemaSchema:()=>Hr,ListChangedOptionsBaseSchema:()=>In,ListPromptsRequestSchema:()=>is,ListPromptsResultSchema:()=>cs,ListResourceTemplatesRequestSchema:()=>Uo,ListResourceTemplatesResultSchema:()=>Ho,ListResourcesRequestSchema:()=>Do,ListResourcesResultSchema:()=>Vo,ListRootsRequestSchema:()=>Qs,ListRootsResultSchema:()=>en,ListTasksRequestSchema:()=>Un,ListTasksResultSchema:()=>Hn,ListToolsRequestSchema:()=>ys,ListToolsResultSchema:()=>vs,LoggingLevelSchema:()=>Wt,LoggingMessageNotificationParamsSchema:()=>Ps,LoggingMessageNotificationSchema:()=>ws,ModelHintSchema:()=>Ts,ModelPreferencesSchema:()=>Cs,MultiSelectEnumSchemaSchema:()=>Ds,NotificationSchema:()=>vt,NotificationsParamsSchema:()=>yt,NumberSchemaSchema:()=>Da,PaginatedRequestParamsSchema:()=>Ao,PaginatedRequestSchema:()=>Gt,PaginatedResultSchema:()=>Bt,PingRequestSchema:()=>qr,PrimitiveSchemaDefinitionSchema:()=>Kr,ProgressNotificationParamsSchema:()=>Mo,ProgressNotificationSchema:()=>jr,ProgressSchema:()=>ko,ProgressTokenSchema:()=>br,PromptArgumentSchema:()=>ss,PromptListChangedNotificationSchema:()=>gs,PromptMessageSchema:()=>ps,PromptReferenceSchema:()=>Bs,PromptSchema:()=>ns,ReadResourceRequestParamsSchema:()=>Fo,ReadResourceRequestSchema:()=>xo,ReadResourceResultSchema:()=>Ko,RelatedTaskMetadataSchema:()=>Ro,RequestIdSchema:()=>Kt,RequestMetaSchema:()=>zr,RequestSchema:()=>nt,ResourceContentsSchema:()=>Nr,ResourceLinkSchema:()=>hs,ResourceListChangedNotificationSchema:()=>Jo,ResourceRequestParamsSchema:()=>Ia,ResourceSchema:()=>kr,ResourceTemplateReferenceSchema:()=>Gs,ResourceTemplateSchema:()=>Lo,ResourceUpdatedNotificationParamsSchema:()=>rs,ResourceUpdatedNotificationSchema:()=>os,ResultMetaObjectSchema:()=>$r,ResultSchema:()=>it,RoleSchema:()=>Yt,RootSchema:()=>Xs,RootsListChangedNotificationSchema:()=>tn,SamplingContentSchema:()=>Ns,SamplingMessageContentBlockSchema:()=>da,SamplingMessageSchema:()=>Is,ServerCapabilitiesSchema:()=>Cr,ServerNotificationSchema:()=>Yn,ServerRequestSchema:()=>Bn,ServerResultSchema:()=>Wn,ServerTasksCapabilitySchema:()=>wo,SetLevelRequestParamsSchema:()=>$s,SetLevelRequestSchema:()=>Es,SingleSelectEnumSchemaSchema:()=>Ls,StringSchemaSchema:()=>La,SubscribeRequestParamsSchema:()=>Go,SubscribeRequestSchema:()=>Bo,SubscriptionFilterSchema:()=>Mr,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Qo,SubscriptionsAcknowledgedNotificationSchema:()=>es,SubscriptionsListenRequestParamsSchema:()=>Zo,SubscriptionsListenRequestSchema:()=>Xo,SubscriptionsListenResultMetaSchema:()=>ts,SubscriptionsListenResultSchema:()=>as,TaskAugmentedRequestParamsSchema:()=>ha,TaskCreationParamsSchema:()=>On,TaskMetadataSchema:()=>bo,TaskSchema:()=>Zt,TaskStatusNotificationParamsSchema:()=>rn,TaskStatusNotificationSchema:()=>Mn,TaskStatusSchema:()=>an,TextContentSchema:()=>Oa,TextResourceContentsSchema:()=>Ir,TitledMultiSelectEnumSchemaSchema:()=>xr,TitledSingleSelectEnumSchemaSchema:()=>Ur,ToolAnnotationsSchema:()=>Ss,ToolChoiceSchema:()=>qs,ToolExecutionSchema:()=>_s,ToolListChangedNotificationSchema:()=>zs,ToolResultContentSchema:()=>js,ToolSchema:()=>Ar,ToolUseContentSchema:()=>ds,UnsubscribeRequestParamsSchema:()=>Yo,UnsubscribeRequestSchema:()=>Wo,UntitledMultiSelectEnumSchemaSchema:()=>Fr,UntitledSingleSelectEnumSchemaSchema:()=>Vr});var b=(m)=>Er.safeParse(m).success,k=(m)=>Pr.safeParse(m).success,X=(m)=>qa.safeParse(m).success,oe=(m)=>ja.safeParse(m).success;var Qt=(m)=>typeof m==="object"&&m!==null&&!Array.isArray(m)&&m.resultType==="input_required";function bc(m){if(m.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${m.params.ref.type}`)}function Rc(m){if(m.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${m.params.ref.type}`)}var Xi="x-mcp-header",Pu=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,wu=new Set(["string","integer","boolean","number"]);function zc(m){let h=[],f=new Map,g=(_,y,w)=>{if(_===null||typeof _!=="object")return;let z=_;if(Xi in z){if(!w||y.length===0)return`${hn(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 D=z[Xi];if(typeof D!=="string"||D.length===0)return`${hn(y)}: x-mcp-header MUST be a non-empty string`;if(!Pu.test(D))return`${hn(y)}: x-mcp-header '${D}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let U=typeof z.type==="string"?z.type:void 0;if(U===void 0||!wu.has(U))return`${hn(y)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${U??"<none>"}`;let ne=D.toLowerCase(),me=f.get(ne);if(me!==void 0)return`x-mcp-header '${D}' is not case-insensitively unique (also declared as '${me}')`;f.set(ne,D),h.push({path:y,headerName:D,type:U})}let q=z.properties;if(q!==null&&typeof q==="object")for(let[D,U]of Object.entries(q)){let ne=g(U,[...y,D],w);if(ne!==void 0)return ne}for(let D of Tu){let U=z[D];if(U===void 0)continue;let ne=Array.isArray(U)?U:U!==null&&typeof U==="object"&&Cu.has(D)?Object.values(U):[U];for(let me of ne){let B=g(me,[...y,`<${D}>`],!1);if(B!==void 0)return B}}},S=g(m,[],!0);return S===void 0?{valid:!0,declarations:h}:{valid:!1,reason:S}}var Tu=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Cu=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function hn(m){return m.length===0?"<root>":m.join(".")}var fn=-32020,kh=[{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:[a.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:[fn,a.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:[a.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:[a.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:[a.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:[fn],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:[a.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:[fn],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."}],Mh={[a.ParseError]:400,[a.InvalidRequest]:400,[a.MethodNotFound]:404,[a.UnsupportedProtocolVersion]:400,[a.MissingRequiredClientCapability]:400,[fn]:400};function pn(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 se(m){if(!G(m))return!1;let h=J(m);if(h===void 0||!xa(h))return!1;let f=O(m);return f!==void 0&&Y(f).length===0}function fe(m,h){switch(m.reason){case"http-method":return pn("http-method","modern-only-method-not-allowed",405,new Fe(-32000,"Method not allowed."),!0);case"batch":return pn("jsonrpc-shape","modern-only-batch-not-supported",400,new Fe(a.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return pn("jsonrpc-shape","modern-only-response-post",400,new Fe(a.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 pn("era-classification","modern-only-missing-envelope",400,f===void 0?new Fe(a.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...h]}):new F({supported:[...h],requested:f}),!0)}}}function Sn(m,h){return Q(m,h)}function Gr(m){return new Set(m.flatMap((h)=>Object.keys(h.shape)))}function Fa(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 Qi=!1,ui="draft-2020-12";function ea(m,h="input"){let f=m["~standard"],g;if(f.jsonSchema)g=f.jsonSchema[h]({target:ui});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(!Qi)Qi=!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=P(m,{target:ui,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 $c(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 $c(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"||$c(g)))}return!1}function qu(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 pa(m,h){let f=await m["~standard"].validate(h);if(f.issues&&f.issues.length>0)return{success:!1,error:f.issues.map((g)=>qu(g)).join(", ")};return{success:!0,data:f.value}}function ju(m){let h=P(m,{target:ui,io:"input"});return typeof h.pattern==="string"?h.pattern:void 0}var Nu=/\\\.\\d\{(\d+)\}/;function Iu(m){let h=Nu.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((_)=>j({local:g,offset:S,precision:_}))))}function Ou(m,h){let f;switch(m){case"email":f=[Re()];break;case"uri":f=[ee()];break;case"date":f=[de()];break;case"date-time":f=Iu(h);break}return new Set(f.map((g)=>ju(g)).filter((g)=>g!==void 0))}function ku(m,h,f){if(f!=="zod")return!0;return Ou(m,h).has(h)}function Ec(m){let h=ea(m,"input"),f=h.properties||{},g=h.required||[];return Object.entries(f).map(([S,_])=>({name:S,description:_?.description,required:g.includes(S)}))}function Wr(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function Mu(m){try{return ea(m,"input")}catch(h){let f=h instanceof Error?h.message:String(h);throw new Fe(a.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${f}`)}}var Au=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Ei(m){return Au.has(m)||m.startsWith("x-")}var Lu=new Set(["$schema",...Object.keys(Va.shape.requestedSchema.shape)]),ec={string:Gr([La,Vr,Ur,Hr]),number:Gr([Da]),integer:Gr([Da]),boolean:Gr([Dr]),array:Gr([Fr,xr])},Du=new Set(La.shape.format.unwrap().options);function Vu(m,h,f,g){if(!Wr(m))return m;let S=typeof m.type==="string"&&Object.hasOwn(ec,m.type)?ec[m.type]:void 0;if(S===void 0)return m;let _={};for(let[y,w]of Object.entries(m))if(S.has(y)||Ei(y))_[y]=w;else if(y==="pattern"&&m.type==="string"&&typeof m.format==="string"){if(!Du.has(m.format))_[y]=w;else if(typeof w!=="string"||!ku(m.format,w,f))g.push(`${h}.${y}`)}else g.push(`${h}.${y}`);return _}function Uu(m,h){let f={},g=[];for(let[S,_]of Object.entries(m))if(S==="properties"&&Wr(_))f[S]=Object.fromEntries(Object.entries(_).map(([y,w])=>[y,Vu(w,`properties.${y}`,h,g)]));else if(Lu.has(S))f[S]=_;else if(!Ei(S))g.push(S);if(g.length>0)throw new Fe(a.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${g.join(", ")}`);return f}function Hu(m,h){if(!Wr(m.properties))return h;let f=Object.entries(m.properties).filter(([,g])=>!Sn(Kr,g).success).map(([g])=>`properties.${g}`);return f.length>0?f.join(", "):h}function di(m,h,f=""){if(Array.isArray(m)&&Array.isArray(h))return m.flatMap((g,S)=>di(g,h[S],`${f}[${S}]`));if(!Wr(m)||!Wr(h))return[];return Object.entries(m).flatMap(([g,S])=>{let _=f?`${f}.${g}`:g;if(!Object.prototype.hasOwnProperty.call(h,g))return Ei(g)?[]:[_];return di(S,h[g],_)})}function Fu(m){if(!Fa(m.requestedSchema))return{...m,mode:"form",requestedSchema:m.requestedSchema};let h=m.requestedSchema["~standard"].vendor,f=Uu(Mu(m.requestedSchema),h),g=Sn(Va.shape.requestedSchema,f);if(!g.success)throw new Fe(a.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Hu(f,g.error.message)}`);let S=di(f,g.data);if(S.length>0)throw new Fe(a.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 Fe(a.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${_.join(", ")}`);return{...m,mode:"form",requestedSchema:g.data}}function xu(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 Ah=Object.assign(xu,{elicit(m){try{return{method:"elicitation/create",params:Fu(m)}}catch(h){throw h instanceof Fe?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 Pc=250;function wc(m,h){return`Multi-round-trip request '${m}' still required input after ${h} rounds (inputRequired.maxRounds)`}function Tc(m,h){return new Promise((f,g)=>{if(h?.aborted){g(h.reason instanceof Ye?h.reason:new Ye(Xe.RequestTimeout,String(h.reason)));return}let S=setTimeout(()=>{h?.removeEventListener("abort",_),f()},m),_=()=>{clearTimeout(S),g(h?.reason instanceof Ye?h.reason:new Ye(Xe.RequestTimeout,String(h?.reason)))};h?.addEventListener("abort",_,{once:!0})})}function Cc(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 Ku=["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"],Ju={IdJagTokenExchangeResponseSchema:ei,OAuthClientInformationFullSchema:ai,OAuthClientInformationSchema:cn,OAuthClientMetadataSchema:nn,OAuthClientRegistrationErrorSchema:ri,OAuthErrorResponseSchema:ti,OAuthMetadataSchema:on,OAuthProtectedResourceMetadataSchema:Zn,OAuthTokenRevocationRequestSchema:oi,OAuthTokensSchema:Qn,OpenIdProviderDiscoveryMetadataSchema:Xn,OpenIdProviderMetadataSchema:sn},qc={},jc={};function Nc(m,h){let f=m.slice(0,-6);qc[f]=h,jc[f]=(g)=>h.safeParse(g).success}for(let m of Ku)Nc(m,Eu[m]);for(let[m,h]of Object.entries(Ju))Nc(m,h);var Lh=Object.freeze(qc),Dh=Object.freeze(jc);function Gu(m){switch(m){case"initialize":case"notifications/initialized":return Xt(void 0);case"server/discover":return Xt(Zr);default:return}}var Bu=60000,Yu=[Ft,vr,xt,ma],Wu=["inputResponses","requestState"];function tc(m,h){let f=m.params;if(!Yr(f))return{message:m,lifted:{}};let g=f._meta,S=Yr(g)?Yu.filter((z)=>(z in g)):[],_=h==="request"?Wu.filter((z)=>(z in f)):[];if(S.length===0&&_.length===0)return{message:m,lifted:{}};let y={},w={...f};if(S.length>0&&Yr(g)){let z={},q={...g};for(let D of S)z[D]=g[D],delete q[D];if(y.envelope=z,Object.keys(q).length>0)w._meta=q;else delete w._meta}for(let z of _){if(z==="inputResponses")y.inputResponses=w[z];if(z==="requestState")y.requestState=w[z];delete w[z]}return{message:{...m,params:w},lifted:y}}function ac(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 Xr(m){return()=>m}var Zu=Xr(void 0);function Pi(m,h){return{...m,mcpReq:{...m.mcpReq,requestState:Xr(h)}}}var Ic;function he(m,h){Ic(m,h)}var Oc=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{Ic=(m,h)=>{m._negotiatedProtocolVersion=h}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(m){this._options=m,this._supportedProtocolVersions=m?.supportedProtocolVersions??wn,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 Ye(Xe.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 Ye(Xe.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,_),X(S)||oe(S))this._onresponse(S);else if(b(S))this._onrequest(S,_);else if(k(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 Ye(Xe.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}=tc(m,"notification"),g=this._negotiatedWireCodec();if(h?.classification===void 0&&this._shouldDropInbound(m)==="drop")return;if(h?.classification!==void 0){let y=Wi(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(ii(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}=tc(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=(W,V,C)=>{let K={jsonrpc:"2.0",id:f.id,error:{code:W,message:V,...C!==void 0&&{data:C}}};_?.send(K).catch((I)=>this._onerror(Error(`Failed to send an error response: ${I}`)))};if(h?.classification!==void 0){let W=Wi(h.classification);if(W!==S.era){this._onerror(Error(`Era mismatch on inbound request '${f.method}': classified as ${W} but this instance serves ${S.era}`));let V=h.classification.revision??W;y(a.UnsupportedProtocolVersion,`Unsupported protocol version: ${V}`,{supported:this._supportedProtocolVersions,requested:V});return}}if(ni(f.method)&&!S.hasRequestMethod(f.method)){y(a.MethodNotFound,"Method not found");return}let w=this._requestHandlers.get(f.method)??this.fallbackRequestHandler;if(w===void 0){y(a.MethodNotFound,"Method not found");return}let z=S.checkInboundEnvelope(g);if(z!==void 0){y(a.InvalidParams,z);return}let q=(W,V)=>this._notificationViaCodec(this._resolveOutboundCodec(W.method),W,{...V,relatedRequestId:f.id}),D=(W,V,C)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(W.method),W,V,{...C,relatedRequestId:f.id}),U=new AbortController;this._requestHandlerAbortControllers.set(f.id,U);let ne=g.inputResponses===void 0?void 0:Xu(g.inputResponses),me={sessionId:_?.sessionId,mcpReq:{id:f.id,method:f.method,_meta:f.params?._meta,...g.envelope!==void 0&&{envelope:g.envelope},...ne!==void 0&&{inputResponses:ne.accepted},...ne!==void 0&&ne.droppedKeys.length>0&&{droppedInputResponseKeys:ne.droppedKeys},requestState:g.requestState===void 0?Zu:Xr(g.requestState),signal:U.signal,send:(W,V,C)=>{let K=this._resolveOutboundCodec(W.method);if(this._assertOutboundRequestInEra(K,W.method),Fa(V))return D(W,V,C);let I=ac(K,W.method);if(I===void 0)throw TypeError(`'${W.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return D(W,I,V)},notify:q},http:h?.authInfo?{authInfo:h.authInfo}:void 0},B=this.buildContext(me,h);Promise.resolve().then(()=>w(f,B)).then(async(W)=>{if(U.signal.aborted)return;let V;try{V=S.encodeResult(f.method,W,this._outboundServerInfo())}catch(K){this._onerror(Error(`Failed to encode result for ${f.method}: ${K}`)),y(a.InternalError,"Internal error");return}let C={result:V,jsonrpc:"2.0",id:f.id};await _?.send(C)},async(W)=>{if(U.signal.aborted)return;let V=Number.isSafeInteger(W.code)?W.code:a.InternalError,C={jsonrpc:"2.0",id:f.id,error:{code:S.encodeErrorCode(V),message:W.message??"Internal error",...W.data!==void 0&&{data:W.data}}};await _?.send(C)}).catch((W)=>this._onerror(Error(`Failed to send response: ${W}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(f.id)===U)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(w){this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),_(w);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),X(m))f(m);else f(Fe.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),Fa(h))return this._requestWithSchemaViaCodec(g,m,h,f);let S=ac(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 Xt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(m){if(this._negotiatedProtocolVersion===void 0){let h=Gu(m);if(h)return h}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(m,h){if(ni(h)&&!m.hasRequestMethod(h))throw new Ye(Xe.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:w}=g??{},z=Date.now(),q,D;return new Promise((U,ne)=>{let me=(H)=>{ne(H)};if(!this._transport){me(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(h.method)}catch(H){me(H);return}if(g?.signal?.aborted){let H=g.signal.reason;throw H instanceof Ye?H:new Ye(Xe.RequestTimeout,String(H))}let B=m.era===Zr&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,W=this._requestMessageId++;D=W;let V={...h,jsonrpc:"2.0",id:W};if(g?.onprogress)this._progressHandlers.set(W,g.onprogress),V.params={...h.params,_meta:{...h.params?._meta,progressToken:W}};let C=this._envelopeOutbound(V),K=!1,I=(H)=>{if(K)return;if(this._progressHandlers.delete(W),B===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:W,reason:String(H)}}),{relatedRequestId:S,resumptionToken:_,onresumptiontoken:y}).catch((L)=>this._onerror(Error(`Failed to send cancellation: ${L}`)));else B.abort();ne(H instanceof Ye?H:new Ye(Xe.RequestTimeout,String(H)))};this._responseHandlers.set(W,(H)=>{if(g?.signal?.aborted)return;if(K=!0,H instanceof Error)return ne(H);let L;try{L=m.decodeResult(h.method,H.result)}catch(Ne){return ne(Ne instanceof Error?Ne:Error(String(Ne)))}if(L.kind==="invalid")return ne(L.error);if(L.kind==="input_required"){if(g?.allowInputRequired===!0)return U(Qu(L));let Ne={codec:m,request:h,resultSchema:f,options:g,flowStartedAt:z,retry:(Le,Ie)=>this._requestWithSchemaViaCodec(m,Le===void 0?{method:h.method}:{method:h.method,params:Le},f,Ie)};return U(this._resolveNonCompleteResult(L,Ne))}let ze=L.result;pa(f,ze).then((Ne)=>{if(Ne.success)U(Ne.data);else ne(new Ye(Xe.InvalidResult,`Invalid result for ${h.method}: ${Ne.error}`))},ne)}),q=()=>I(g?.signal?.reason),g?.signal?.addEventListener("abort",q,{once:!0});let Z=g?.timeout??Bu,pe=()=>I(new Ye(Xe.RequestTimeout,"Request timed out",{timeout:Z}));this._setupTimeout(W,Z,g?.maxTotalTimeout,pe,g?.resetTimeoutOnProgress??!1),this._transport.send(C,{relatedRequestId:S,resumptionToken:_,onresumptiontoken:y,headers:w,requestSignal:B?.signal}).catch((H)=>{this._progressHandlers.delete(W),ne(H)})}).finally(()=>{if(q)g?.signal?.removeEventListener("abort",q);if(D!==void 0)this._responseHandlers.delete(D),this._cleanupTimeout(D)})}async notification(m,h){return this._notificationViaCodec(this._resolveOutboundCodec(m.method),m,h)}async _notificationViaCodec(m,h,f){if(!this._transport)throw new Ye(Xe.NotConnected,"Not connected");if(ii(h.method)&&!m.hasNotificationMethod(h.method))throw new Ye(Xe.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(!ni(m))throw TypeError(`'${m}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);g=(S,_)=>{let y=this._negotiatedWireCodec(),w=y.validateRequest(m,S);if(!w.ok&&w.reason==="not-in-era")w=y.validateInputRequest(m,S);if(!w.ok){if(w.reason==="not-in-era")throw new Fe(a.InternalError,`No wire schema for ${m} in the resolved era`);throw Error(w.message)}return Promise.resolve(h(w.value,_))}}else if(f)g=async(S,_)=>{let y=await pa(h.params,{...S.params});if(!y.success)throw new Fe(a.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(!ii(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 Fe(a.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 pa(h.params,{...g.params});if(!S.success)throw new Fe(a.InvalidParams,`Invalid params for notification ${m}: ${S.error}`);await f(S.data,g)})}removeNotificationHandler(m){this._notificationHandlers.delete(m)}};function Yr(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function kc(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]=Yr(y)&&Yr(_)?{...y,..._}:_}return f}function rc(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function Xu(m){let h={},f=[];if(!rc(m))return{accepted:h,droppedKeys:f};for(let[g,S]of Object.entries(m)){if(!rc(S)||"method"in S||"result"in S){f.push(g);continue}h[g]=S}return{accepted:h,droppedKeys:f}}function Qu(m){return{resultType:"input_required",inputRequests:m.inputRequests,...m.requestState!==void 0&&{requestState:m.requestState}}}/*!
|
|
1
|
+
import{ce,v,le,ue,we,_e,P,j,de,Q,e,Re,ee,te,o,i,R,Ee,l,r,t,d,c,T,E,s,p,n,u,A,M}from"./cli/index.js";var{create:Sl,defineProperty:yo,getOwnPropertyDescriptor:_l,getOwnPropertyNames:yl,getPrototypeOf:vl}=Object,bl=Object.prototype.hasOwnProperty,ke=(m,h)=>()=>(h||m((h={exports:{}}).exports,h),h.exports),Ai=(m,h)=>{let f={};for(var g in m)yo(f,g,{get:m[g],enumerable:!0});if(h)yo(f,Symbol.toStringTag,{value:"Module"});return f},Rl=(m,h,f,g)=>{if(h&&typeof h==="object"||typeof h==="function"){for(var S=yl(h),_=0,y=S.length,w;_<y;_++)if(w=S[_],!bl.call(m,w)&&w!==f)yo(m,w,{get:((z)=>h[z]).bind(null,w),enumerable:!(g=_l(h,w))||g.enumerable})}return m},vo=(m,h,f)=>(f=m!=null?Sl(vl(m)):{},Rl(h||!m||!m.__esModule?yo(f,"default",{value:m,enumerable:!0}):f,m));var zl=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Li=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),$l=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),El=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Di(m){return typeof m==="string"&&Li.has(m.replace(/#$/,""))}function Vi(m,h){if(!("$schema"in m)||typeof m.$schema!=="string")return"2020-12";let f=m.$schema.replace(/#$/,"");if(zl.has(f))return"2020-12";if(Li.has(f))return"2019-09";if($l.has(f)||El.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 wl=()=>{let m={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function h(S){return m[S]??null}let f={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},g={nan:"NaN"};return(S)=>{switch(S.code){case"invalid_type":{let _=g[S.expected]??S.expected,y=we(S.input),w=g[y]??y;return`Invalid input: expected ${_}, received ${w}`}case"invalid_value":if(S.values.length===1)return`Invalid input: expected ${ue(S.values[0])}`;return`Invalid option: expected one of ${le(S.values,"|")}`;case"too_big":{let _=S.inclusive?"<=":"<",y=h(S.origin);if(y)return`Too big: expected ${S.origin??"value"} to have ${_}${S.maximum.toString()} ${y.unit??"elements"}`;return`Too big: expected ${S.origin??"value"} to be ${_}${S.maximum.toString()}`}case"too_small":{let _=S.inclusive?">=":">",y=h(S.origin);if(y)return`Too small: expected ${S.origin} to have ${_}${S.minimum.toString()} ${y.unit}`;return`Too small: expected ${S.origin} to be ${_}${S.minimum.toString()}`}case"invalid_format":{let _=S;if(_.format==="starts_with")return`Invalid string: must start with "${_.prefix}"`;if(_.format==="ends_with")return`Invalid string: must end with "${_.suffix}"`;if(_.format==="includes")return`Invalid string: must include "${_.includes}"`;if(_.format==="regex")return`Invalid string: must match pattern ${_.pattern}`;return`Invalid ${f[_.format]??S.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${S.divisor}`;case"unrecognized_keys":return`Unrecognized key${S.keys.length>1?"s":""}: ${le(S.keys,", ")}`;case"invalid_key":return`Invalid key in ${S.origin}`;case"invalid_union":if(S.options&&Array.isArray(S.options)&&S.options.length>0)return`Invalid discriminator value. Expected ${S.options.map((y)=>`'${y}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${S.origin}`;default:return"Invalid input"}}};function En(){return{localeError:wl()}}var Hi={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 Ui;(function(m){})(Ui||(Ui={}));function Cl(m){return _e(te,m)}v(En());var wa="2025-11-25";var wn=[wa,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Tn="io.modelcontextprotocol/related-task",Ft="io.modelcontextprotocol/protocolVersion",vr="io.modelcontextprotocol/clientInfo",kt="io.modelcontextprotocol/serverInfo",xt="io.modelcontextprotocol/clientCapabilities",Ta="io.modelcontextprotocol/subscriptionId",ma="io.modelcontextprotocol/logLevel";var Ca="2.0";var Ht=A(()=>c([e(),o(),i(),R(),s(e(),Ht),r(Ht)])),st=s(e(),Ht),Cn=r(Ht),br=c([e(),o().int()]),Rr=e(),bo=t({ttl:o().optional()}),Ro=t({taskId:e()}),zr=d({progressToken:br.optional(),[Tn]:Ro.optional()}),ft=t({_meta:zr.optional()}),ha=ft.extend({task:bo.optional()}),nt=t({method:e(),params:ft.loose().optional()}),yt=t({_meta:zr.optional()}),vt=t({method:e(),params:yt.loose().optional()}),$r=d({get[kt](){return Na.optional().catch(void 0)}}),it=d({_meta:$r.optional()}),Kt=c([e(),o().int()]),Er=t({jsonrpc:n(Ca),id:Kt,...nt.shape}).strict(),Pr=t({jsonrpc:n(Ca),...vt.shape}).strict(),qa=t({jsonrpc:n(Ca),id:Kt,result:it}).strict(),ja=t({jsonrpc:n(Ca),id:Kt.optional(),error:t({code:o().int(),message:e(),data:l().optional()})}).strict(),zo=c([Er,Pr,qa,ja]),qn=c([qa,ja]),wr=it.strict(),$o=yt.extend({requestId:Kt.optional(),reason:e().optional()}),Tr=vt.extend({method:n("notifications/cancelled"),params:$o}),Eo=t({src:e(),mimeType:e().optional(),sizes:r(e()).optional(),theme:p(["light","dark"]).optional()}),Jt=t({icons:r(Eo).optional()}),Ot=t({name:e(),title:e().optional()}),Na=Ot.extend({...Ot.shape,...Jt.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),jl=E(t({applyDefaults:i().optional()}),st),Nl=M((m)=>{if(m&&typeof m==="object"&&!Array.isArray(m)&&Object.keys(m).length===0)return{form:{}};return m},E(t({form:jl.optional(),url:st.optional()}),st.optional())),Po=d({list:st.optional(),cancel:st.optional(),requests:d({sampling:d({createMessage:st.optional()}).optional(),elicitation:d({create:st.optional()}).optional()}).optional()}),wo=d({list:st.optional(),cancel:st.optional(),requests:d({tools:d({call:st.optional()}).optional()}).optional()}),To=t({experimental:s(e(),st).optional(),sampling:t({context:st.optional(),tools:st.optional()}).optional(),elicitation:Nl.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:Po.optional(),extensions:s(e(),st).optional()}),Co=ft.extend({protocolVersion:e(),capabilities:To,clientInfo:Na}),qo=nt.extend({method:n("initialize"),params:Co}),Cr=t({experimental:s(e(),st).optional(),logging:st.optional(),completions:st.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:wo.optional(),extensions:s(e(),st).optional()}),jo=it.extend({protocolVersion:e(),capabilities:Cr,serverInfo:Na,instructions:e().optional()}),No=vt.extend({method:n("notifications/initialized"),params:yt.optional()}),Io=nt.extend({method:n("server/discover"),params:ft.optional()}),Oo=it.extend({supportedVersions:r(e()),capabilities:Cr,instructions:e().optional()}),qr=nt.extend({method:n("ping"),params:ft.optional()}),ko=t({progress:o(),total:u(o()),message:u(e())}),Mo=t({...yt.shape,...ko.shape,progressToken:br}),jr=vt.extend({method:n("notifications/progress"),params:Mo}),Ao=ft.extend({cursor:Rr.optional()}),Gt=nt.extend({params:Ao.optional()}),Bt=it.extend({nextCursor:Rr.optional()}),Nr=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),Ir=Nr.extend({text:e()}),jn=e().refine((m)=>{try{return atob(m),!0}catch{return!1}},{message:"Invalid Base64 string"}),Or=Nr.extend({blob:jn}),Yt=p(["user","assistant"]),Mt=t({audience:r(Yt).optional(),priority:o().min(0).max(1).optional(),lastModified:j({offset:!0}).optional()}),kr=t({...Ot.shape,...Jt.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:Mt.optional(),_meta:u(d({}))}),Lo=t({...Ot.shape,...Jt.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:Mt.optional(),_meta:u(d({}))}),Do=Gt.extend({method:n("resources/list")}),Vo=Bt.extend({resources:r(kr)}),Uo=Gt.extend({method:n("resources/templates/list")}),Ho=Bt.extend({resourceTemplates:r(Lo)}),Ia=ft.extend({uri:e()}),Fo=Ia,xo=nt.extend({method:n("resources/read"),params:Fo}),Ko=it.extend({contents:r(c([Ir,Or]))}),Jo=vt.extend({method:n("notifications/resources/list_changed"),params:yt.optional()}),Go=Ia,Bo=nt.extend({method:n("resources/subscribe"),params:Go}),Yo=Ia,Wo=nt.extend({method:n("resources/unsubscribe"),params:Yo}),Mr=t({toolsListChanged:i().optional(),promptsListChanged:i().optional(),resourcesListChanged:i().optional(),resourceSubscriptions:r(e()).optional()}),Zo=ft.extend({notifications:Mr}),Xo=nt.extend({method:n("subscriptions/listen"),params:Zo}),Qo=yt.extend({notifications:Mr}),es=vt.extend({method:n("notifications/subscriptions/acknowledged"),params:Qo}),ts=$r.extend({[Ta]:Kt}),as=it.extend({_meta:ts}),rs=yt.extend({uri:e()}),os=vt.extend({method:n("notifications/resources/updated"),params:rs}),ss=t({name:e(),description:u(e()),required:u(i())}),ns=t({...Ot.shape,...Jt.shape,description:u(e()),arguments:u(r(ss)),_meta:u(d({}))}),is=Gt.extend({method:n("prompts/list")}),cs=Bt.extend({prompts:r(ns)}),ls=ft.extend({name:e(),arguments:s(e(),e()).optional()}),us=nt.extend({method:n("prompts/get"),params:ls}),Oa=t({type:n("text"),text:e(),annotations:Mt.optional(),_meta:s(e(),l()).optional()}),ka=t({type:n("image"),data:jn,mimeType:e(),annotations:Mt.optional(),_meta:s(e(),l()).optional()}),Ma=t({type:n("audio"),data:jn,mimeType:e(),annotations:Mt.optional(),_meta:s(e(),l()).optional()}),ds=t({type:n("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),ms=t({type:n("resource"),resource:c([Ir,Or]),annotations:Mt.optional(),_meta:s(e(),l()).optional()}),hs=kr.extend({type:n("resource_link")}),Aa=c([Oa,ka,Ma,hs,ms]),ps=t({role:Yt,content:Aa}),fs=it.extend({description:e().optional(),messages:r(ps)}),gs=vt.extend({method:n("notifications/prompts/list_changed"),params:yt.optional()}),Ss=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),_s=t({taskSupport:p(["required","optional","forbidden"]).optional()}),Ar=t({...Ot.shape,...Jt.shape,description:e().optional(),inputSchema:t({type:n("object"),properties:s(e(),Ht).optional(),required:r(e()).optional()}).catchall(l()),outputSchema:d({$schema:e().optional()}).optional(),annotations:Ss.optional(),execution:_s.optional(),_meta:s(e(),l()).optional()}),ys=Gt.extend({method:n("tools/list")}),vs=Bt.extend({tools:r(Ar)}),Lr=it.extend({content:r(Aa).default([]),structuredContent:l().optional(),isError:i().optional()}),Nn=Lr.or(it.extend({toolResult:l()})),bs=ha.extend({name:e(),arguments:s(e(),l()).optional()}),Rs=nt.extend({method:n("tools/call"),params:bs}),zs=vt.extend({method:n("notifications/tools/list_changed"),params:yt.optional()}),In=t({autoRefresh:i().default(!0),debounceMs:o().int().nonnegative().default(300)}),Wt=p(["debug","info","notice","warning","error","critical","alert","emergency"]),$s=ft.extend({level:Wt}),Es=nt.extend({method:n("logging/setLevel"),params:$s}),Ps=yt.extend({level:Wt,logger:e().optional(),data:l()}),ws=vt.extend({method:n("notifications/message"),params:Ps}),Ts=t({name:e().optional()}),Cs=t({hints:r(Ts).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),qs=t({mode:p(["auto","required","none"]).optional()}),js=t({type:n("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:r(Aa),structuredContent:l().optional(),isError:i().optional(),_meta:s(e(),l()).optional()}),Ns=T("type",[Oa,ka,Ma]),da=T("type",[Oa,ka,Ma,ds,js]),Is=t({role:Yt,content:c([da,r(da)]),_meta:s(e(),l()).optional()}),Os=ha.extend({messages:r(Is),modelPreferences:Cs.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:r(e()).optional(),metadata:st.optional(),tools:r(Ar).optional(),toolChoice:qs.optional()}),ks=nt.extend({method:n("sampling/createMessage"),params:Os}),Ms=it.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens"]).or(e())),role:Yt,content:Ns}),As=it.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:Yt,content:c([da,r(da)])}),Dr=t({type:n("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),La=t({type:n("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),Da=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),Vr=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),default:e().optional()}),Ur=t({type:n("string"),title:e().optional(),description:e().optional(),oneOf:r(t({const:e(),title:e()})),default:e().optional()}),Hr=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),enumNames:r(e()).optional(),default:e().optional()}),Ls=c([Vr,Ur]),Fr=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:n("string"),enum:r(e())}),default:r(e()).optional()}),xr=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:r(t({const:e(),title:e()}))}),default:r(e()).optional()}),Ds=c([Fr,xr]),Vs=c([Hr,Ls,Ds]),Kr=c([Vs,Dr,La,Da]),Va=ha.extend({mode:n("form").optional(),message:e(),requestedSchema:t({type:n("object"),properties:s(e(),Kr),required:r(e()).optional()}).catchall(l())}),Us=ha.extend({mode:n("url"),message:e(),elicitationId:e(),url:e().url()}),Hs=c([Va,Us]),Fs=nt.extend({method:n("elicitation/create"),params:Hs}),xs=yt.extend({elicitationId:e()}),Ks=vt.extend({method:n("notifications/elicitation/complete"),params:xs}),Js=it.extend({action:p(["accept","decline","cancel"]),content:M((m)=>m===null?void 0:m,s(e(),c([e(),o(),i(),r(e())])).optional())}),Gs=t({type:n("ref/resource"),uri:e()}),Bs=t({type:n("ref/prompt"),name:e()}),Ys=ft.extend({ref:c([Bs,Gs]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),Ws=nt.extend({method:n("completion/complete"),params:Ys}),Zs=it.extend({completion:d({values:r(e()).max(100),total:u(o().int()),hasMore:u(i())})}),Xs=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),Qs=nt.extend({method:n("roots/list"),params:ft.optional()}),en=it.extend({roots:r(Xs)}),tn=vt.extend({method:n("notifications/roots/list_changed"),params:yt.optional()}),On=d({ttl:o().optional(),pollInterval:o().optional()}),an=p(["working","input_required","completed","failed","cancelled"]),Zt=t({taskId:e(),status:an,ttl:c([o(),R()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:u(o()),statusMessage:u(e())}),kn=it.extend({task:Zt}),rn=yt.merge(Zt),Mn=vt.extend({method:n("notifications/tasks/status"),params:rn}),An=nt.extend({method:n("tasks/get"),params:ft.extend({taskId:e()})}),Ln=it.merge(Zt),Dn=nt.extend({method:n("tasks/result"),params:ft.extend({taskId:e()})}),Vn=it.loose(),Un=Gt.extend({method:n("tasks/list")}),Hn=Bt.extend({tasks:r(Zt)}),Fn=nt.extend({method:n("tasks/cancel"),params:ft.extend({taskId:e()})}),xn=it.merge(Zt),Kn=c([qr,qo,Io,Ws,Es,us,is,Do,Uo,xo,Bo,Wo,Xo,Rs,ys]),Jn=c([Tr,jr,No,tn]),Gn=c([wr,Ms,As,Js,en]),Bn=c([qr,ks,Fs,Qs]),Yn=c([Tr,jr,ws,os,Jo,zs,gs,es,Ks]),Wn=c([wr,jo,Oo,Zs,fs,cs,Vo,Ho,Ko,Lr,vs,as]),pt=ee().superRefine((m,h)=>{if(!URL.canParse(m))return h.addIssue({code:Hi.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"}),Zn=d({resource:e().url(),authorization_servers:r(pt).optional(),jwks_uri:e().url().optional(),scopes_supported:r(e()).optional(),bearer_methods_supported:r(e()).optional(),resource_signing_alg_values_supported:r(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:i().optional(),authorization_details_types_supported:r(e()).optional(),dpop_signing_alg_values_supported:r(e()).optional(),dpop_bound_access_tokens_required:i().optional()}),on=d({issuer:e(),authorization_endpoint:pt,token_endpoint:pt,registration_endpoint:pt.optional(),scopes_supported:r(e()).optional(),response_types_supported:r(e()),response_modes_supported:r(e()).optional(),grant_types_supported:r(e()).optional(),token_endpoint_auth_methods_supported:r(e()).optional(),token_endpoint_auth_signing_alg_values_supported:r(e()).optional(),service_documentation:pt.optional(),revocation_endpoint:pt.optional(),revocation_endpoint_auth_methods_supported:r(e()).optional(),revocation_endpoint_auth_signing_alg_values_supported:r(e()).optional(),introspection_endpoint:e().optional(),introspection_endpoint_auth_methods_supported:r(e()).optional(),introspection_endpoint_auth_signing_alg_values_supported:r(e()).optional(),code_challenge_methods_supported:r(e()).optional(),client_id_metadata_document_supported:i().optional(),authorization_response_iss_parameter_supported:i().optional().catch(void 0)}),sn=d({issuer:e(),authorization_endpoint:pt,token_endpoint:pt,userinfo_endpoint:pt.optional(),jwks_uri:pt,registration_endpoint:pt.optional(),scopes_supported:r(e()).optional(),response_types_supported:r(e()),response_modes_supported:r(e()).optional(),grant_types_supported:r(e()).optional(),acr_values_supported:r(e()).optional(),subject_types_supported:r(e()),id_token_signing_alg_values_supported:r(e()),id_token_encryption_alg_values_supported:r(e()).optional(),id_token_encryption_enc_values_supported:r(e()).optional(),userinfo_signing_alg_values_supported:r(e()).optional(),userinfo_encryption_alg_values_supported:r(e()).optional(),userinfo_encryption_enc_values_supported:r(e()).optional(),request_object_signing_alg_values_supported:r(e()).optional(),request_object_encryption_alg_values_supported:r(e()).optional(),request_object_encryption_enc_values_supported:r(e()).optional(),token_endpoint_auth_methods_supported:r(e()).optional(),token_endpoint_auth_signing_alg_values_supported:r(e()).optional(),display_values_supported:r(e()).optional(),claim_types_supported:r(e()).optional(),claims_supported:r(e()).optional(),service_documentation:e().optional(),claims_locales_supported:r(e()).optional(),ui_locales_supported:r(e()).optional(),claims_parameter_supported:i().optional(),request_parameter_supported:i().optional(),request_uri_parameter_supported:i().optional(),require_request_uri_registration:i().optional(),op_policy_uri:pt.optional(),op_tos_uri:pt.optional(),client_id_metadata_document_supported:i().optional(),authorization_response_iss_parameter_supported:i().optional().catch(void 0)}),Xn=t({...sn.shape,...on.pick({code_challenge_methods_supported:!0}).shape}),Qn=t({access_token:e(),id_token:e().optional(),token_type:e(),expires_in:Cl().optional(),scope:e().optional(),refresh_token:e().optional()}).strip(),ei=t({issued_token_type:n("urn:ietf:params:oauth:token-type:id-jag"),access_token:e(),token_type:e().optional(),expires_in:o().optional(),scope:e().optional()}).strip(),ti=t({error:e(),error_description:e().optional(),error_uri:e().optional()}),Pn=pt.optional().or(n("").transform(()=>{return})),nn=t({redirect_uris:r(pt),token_endpoint_auth_method:e().optional(),grant_types:r(e()).optional(),response_types:r(e()).optional(),application_type:e().optional(),client_name:e().optional(),client_uri:pt.optional(),logo_uri:Pn,scope:e().optional(),contacts:r(e()).optional(),tos_uri:Pn,policy_uri:e().optional(),jwks_uri:pt.optional(),jwks:Ee().optional(),software_id:e().optional(),software_version:e().optional(),software_statement:e().optional()}).strip(),cn=t({client_id:e(),client_secret:e().optional(),client_id_issued_at:o().optional(),client_secret_expires_at:o().optional()}).strip(),ai=nn.merge(cn),ri=t({error:e(),error_description:e().optional()}).strip(),oi=t({token:e(),token_type_hint:e().optional()}).strip();var ci=Symbol.for("mcp.sdk.errorBrands");function mi(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,ci,{value:f,enumerable:!1,configurable:!0})}function Ha(m,h){try{if(typeof h==="object"&&h!==null&&Object.prototype.hasOwnProperty.call(m,"mcpBrand")&&typeof m.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(h,ci)){let f=h[ci];if(f&&typeof f.has==="function"&&f.has(m.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(m,h)}var Ch=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](h){return Ha(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 Ha(this,h)}constructor(h,f,g){super(f);this.code=h,this.errorUri=g,this.name="OAuthError",mi(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)}},Xe=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}({}),Ye=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](m){return Ha(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 Ha(this,m)}constructor(m,h,f){super(h);this.code=m,this.data=f,this.name="SdkError",mi(this,new.target)}},qh=class extends Ye{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 Ki(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Hl(m,h,f){return m==="elicitation"&&h==="form"&&f.form===void 0&&f.url===void 0}function oc(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 hi(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(Ki(S)&&Ki(_)){let y={};for(let[w,z]of Object.entries(S))if(z!==void 0&&_[w]===void 0&&!Hl(g,w,_))y[w]=z;if(Object.keys(y).length>0)f[g]=y}}return Object.keys(f).length>0?f:void 0}var sc="2026-07-28",x=[sc];function xa(m){return m>=sc}function nc(m){return m.filter((h)=>!xa(h))}function pi(m){return m.filter((h)=>xa(h))}function ic(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 cc=["task","inputRequests","requestState"];function fi(m){if(m===null||typeof m!=="object"||Array.isArray(m)||m.content!==void 0||cc.some((h)=>(h in m)))return m;return{...m,content:[]}}function Fl(){let m=A(()=>c([e(),o(),i(),R(),s(e(),m),r(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()}),w=t({_meta:y.optional()}),z=w.extend({task:S.optional()}),q=t({method:e(),params:w.loose().optional()}),D=t({_meta:y.optional()}),U=t({method:e(),params:D.loose().optional()}),ne=d({_meta:y.optional()}),me=c([e(),o().int()]),B=ne.strict(),W=D.extend({requestId:me.optional(),reason:e().optional()}),V=U.extend({method:n("notifications/cancelled"),params:W}),C=t({src:e(),mimeType:e().optional(),sizes:r(e()).optional(),theme:p(["light","dark"]).optional()}),K=t({icons:r(C).optional()}),I=t({name:e(),title:e().optional()}),Z=I.extend({...I.shape,...K.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),pe=E(t({applyDefaults:i().optional()}),h),H=M((_t)=>{if(_t&&typeof _t==="object"&&!Array.isArray(_t)&&Object.keys(_t).length===0)return{form:{}};return _t},E(t({form:pe.optional(),url:h.optional()}),h.optional())),L=d({list:h.optional(),cancel:h.optional(),requests:d({sampling:d({createMessage:h.optional()}).optional(),elicitation:d({create:h.optional()}).optional()}).optional()}),ze=d({list:h.optional(),cancel:h.optional(),requests:d({tools:d({call:h.optional()}).optional()}).optional()}),Ne=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:H.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:L.optional(),extensions:s(e(),h).optional()}),Le=w.extend({protocolVersion:e(),capabilities:Ne,clientInfo:Z}),Ie=q.extend({method:n("initialize"),params:Le}),Me=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:ze.optional(),extensions:s(e(),h).optional()}),Ue=ne.extend({protocolVersion:e(),capabilities:Me,serverInfo:Z,instructions:e().optional()}),Ve=U.extend({method:n("notifications/initialized"),params:D.optional()}),Ze=q.extend({method:n("ping"),params:w.optional()}),rt=t({progress:o(),total:u(o()),message:u(e())}),tt=t({...D.shape,...rt.shape,progressToken:f}),ut=U.extend({method:n("notifications/progress"),params:tt}),Qe=w.extend({cursor:g.optional()}),Te=q.extend({params:Qe.optional()}),qe=ne.extend({nextCursor:g.optional()}),Ae=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),re=Ae.extend({text:e()}),Pe=e().refine((_t)=>{try{return atob(_t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ce=Ae.extend({blob:Pe}),De=p(["user","assistant"]),He=t({audience:r(De).optional(),priority:o().min(0).max(1).optional(),lastModified:j({offset:!0}).optional()}),We=t({...I.shape,...K.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:He.optional(),_meta:u(d({}))}),Je=t({...I.shape,...K.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:He.optional(),_meta:u(d({}))}),at=Te.extend({method:n("resources/list")}),bt=qe.extend({resources:r(We)}),$e=Te.extend({method:n("resources/templates/list")}),je=qe.extend({resourceTemplates:r(Je)}),Oe=w.extend({uri:e()}),xe=Oe,Ke=q.extend({method:n("resources/read"),params:xe}),Be=ne.extend({contents:r(c([re,Ce]))}),ct=U.extend({method:n("notifications/resources/list_changed"),params:D.optional()}),mt=Oe,gt=q.extend({method:n("resources/subscribe"),params:mt}),dt=Oe,ot=q.extend({method:n("resources/unsubscribe"),params:dt}),Pt=D.extend({uri:e()}),ht=U.extend({method:n("notifications/resources/updated"),params:Pt}),Nt=t({name:e(),description:u(e()),required:u(i())}),Tt=t({...I.shape,...K.shape,description:u(e()),arguments:u(r(Nt)),_meta:u(d({}))}),It=Te.extend({method:n("prompts/list")}),At=qe.extend({prompts:r(Tt)}),Lt=w.extend({name:e(),arguments:s(e(),e()).optional()}),ta=q.extend({method:n("prompts/get"),params:Lt}),aa=t({type:n("text"),text:e(),annotations:He.optional(),_meta:s(e(),l()).optional()}),ra=t({type:n("image"),data:Pe,mimeType:e(),annotations:He.optional(),_meta:s(e(),l()).optional()}),oa=t({type:n("audio"),data:Pe,mimeType:e(),annotations:He.optional(),_meta:s(e(),l()).optional()}),Ga=t({type:n("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),Dt=t({type:n("resource"),resource:c([re,Ce]),annotations:He.optional(),_meta:s(e(),l()).optional()}),Ba=We.extend({type:n("resource_link")}),wt=c([aa,ra,oa,Ba,Dt]),ga=t({role:De,content:wt}),Sa=ne.extend({description:e().optional(),messages:r(ga)}),sa=U.extend({method:n("notifications/prompts/list_changed"),params:D.optional()}),Ya=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),_a=t({taskSupport:p(["required","optional","forbidden"]).optional()}),na=t({...I.shape,...K.shape,description:e().optional(),inputSchema:t({type:n("object"),properties:s(e(),m).optional(),required:r(e()).optional()}).catchall(l()),outputSchema:t({type:n("object"),properties:s(e(),m).optional(),required:r(e()).optional()}).catchall(l()).optional(),annotations:Ya.optional(),execution:_a.optional(),_meta:s(e(),l()).optional()}),ya=Te.extend({method:n("tools/list")}),va=qe.extend({tools:r(na)}),ba=ne.extend({content:r(wt),structuredContent:s(e(),l()).optional(),isError:i().optional()}),St=z.extend({name:e(),arguments:s(e(),l()).optional()}),Wa=q.extend({method:n("tools/call"),params:St}),to=U.extend({method:n("notifications/tools/list_changed"),params:D.optional()}),Ra=p(["debug","info","notice","warning","error","critical","alert","emergency"]),Za=w.extend({level:Ra}),Xa=q.extend({method:n("logging/setLevel"),params:Za}),Qa=D.extend({level:Ra,logger:e().optional(),data:l()}),er=U.extend({method:n("notifications/message"),params:Qa}),tr=t({name:e().optional()}),ar=t({hints:r(tr).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),rr=t({mode:p(["auto","required","none"]).optional()}),ao=t({type:n("tool_result"),toolUseId:e().describe("The unique identifier for the corresponding tool call."),content:r(wt),structuredContent:t({}).loose().optional(),isError:i().optional(),_meta:s(e(),l()).optional()}),or=T("type",[aa,ra,oa]),Vt=T("type",[aa,ra,oa,Ga,ao]),sr=t({role:De,content:c([Vt,r(Vt)]),_meta:s(e(),l()).optional()}),nr=z.extend({messages:r(sr),modelPreferences:ar.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:r(e()).optional(),metadata:h.optional(),tools:r(na).optional(),toolChoice:rr.optional()}),ir=q.extend({method:n("sampling/createMessage"),params:nr}),cr=ne.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens"]).or(e())),role:De,content:or}),lr=ne.extend({model:e(),stopReason:u(p(["endTurn","stopSequence","maxTokens","toolUse"]).or(e())),role:De,content:c([Vt,r(Vt)])}),ur=t({type:n("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),dr=t({type:n("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),mr=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),hr=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),default:e().optional()}),pr=t({type:n("string"),title:e().optional(),description:e().optional(),oneOf:r(t({const:e(),title:e()})),default:e().optional()}),fr=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),enumNames:r(e()).optional(),default:e().optional()}),gr=c([hr,pr]),ia=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:n("string"),enum:r(e())}),default:r(e()).optional()}),ca=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:r(t({const:e(),title:e()}))}),default:r(e()).optional()}),ro=c([ia,ca]),oo=c([fr,gr,ro]),$t=c([oo,ur,dr,mr]),Et=z.extend({mode:n("form").optional(),message:e(),requestedSchema:t({type:n("object"),properties:s(e(),$t),required:r(e()).optional()}).catchall(l())}),Sr=z.extend({mode:n("url"),message:e(),elicitationId:e(),url:e().url()}),Ct=c([Et,Sr]),so=q.extend({method:n("elicitation/create"),params:Ct}),no=D.extend({elicitationId:e()}),io=U.extend({method:n("notifications/elicitation/complete"),params:no}),co=ne.extend({action:p(["accept","decline","cancel"]),content:M((_t)=>_t===null?void 0:_t,s(e(),c([e(),o(),i(),r(e())])).optional())}),lo=t({type:n("ref/resource"),uri:e()}),uo=t({type:n("ref/prompt"),name:e()}),mo=w.extend({ref:c([uo,lo]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()}),_r=q.extend({method:n("completion/complete"),params:mo}),ho=ne.extend({completion:d({values:r(e()).max(100),total:u(o().int()),hasMore:u(i())})}),po=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),za=q.extend({method:n("roots/list"),params:w.optional()}),yr=ne.extend({roots:r(po)}),fo=U.extend({method:n("notifications/roots/list_changed"),params:D.optional()}),go=d({ttl:o().optional(),pollInterval:o().optional()}),So=p(["working","input_required","completed","failed","cancelled"]),Ut=t({taskId:e(),status:So,ttl:c([o(),R()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:u(o()),statusMessage:u(e())}),Rt=ne.extend({task:Ut}),_o=D.merge(Ut),la=U.extend({method:n("notifications/tasks/status"),params:_o}),$a=q.extend({method:n("tasks/get"),params:w.extend({taskId:e()})}),Ea=ne.merge(Ut),Pa=q.extend({method:n("tasks/result"),params:w.extend({taskId:e()})}),$n=ne.loose(),zt=Te.extend({method:n("tasks/list")}),lt=qe.extend({tasks:r(Ut)}),ua=q.extend({method:n("tasks/cancel"),params:w.extend({taskId:e()})});return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:f,CursorSchema:g,TaskMetadataSchema:S,RelatedTaskMetadataSchema:_,RequestMetaSchema:y,BaseRequestParamsSchema:w,TaskAugmentedRequestParamsSchema:z,RequestSchema:q,NotificationsParamsSchema:D,NotificationSchema:U,ResultSchema:ne,RequestIdSchema:me,EmptyResultSchema:B,CancelledNotificationParamsSchema:W,CancelledNotificationSchema:V,IconSchema:C,IconsSchema:K,BaseMetadataSchema:I,ImplementationSchema:Z,ClientTasksCapabilitySchema:L,ServerTasksCapabilitySchema:ze,ClientCapabilitiesSchema:Ne,InitializeRequestParamsSchema:Le,InitializeRequestSchema:Ie,ServerCapabilitiesSchema:Me,InitializeResultSchema:Ue,InitializedNotificationSchema:Ve,PingRequestSchema:Ze,ProgressSchema:rt,ProgressNotificationParamsSchema:tt,ProgressNotificationSchema:ut,PaginatedRequestParamsSchema:Qe,PaginatedRequestSchema:Te,PaginatedResultSchema:qe,ResourceContentsSchema:Ae,TextResourceContentsSchema:re,BlobResourceContentsSchema:Ce,RoleSchema:De,AnnotationsSchema:He,ResourceSchema:We,ResourceTemplateSchema:Je,ListResourcesRequestSchema:at,ListResourcesResultSchema:bt,ListResourceTemplatesRequestSchema:$e,ListResourceTemplatesResultSchema:je,ResourceRequestParamsSchema:Oe,ReadResourceRequestParamsSchema:xe,ReadResourceRequestSchema:Ke,ReadResourceResultSchema:Be,ResourceListChangedNotificationSchema:ct,SubscribeRequestParamsSchema:mt,SubscribeRequestSchema:gt,UnsubscribeRequestParamsSchema:dt,UnsubscribeRequestSchema:ot,ResourceUpdatedNotificationParamsSchema:Pt,ResourceUpdatedNotificationSchema:ht,PromptArgumentSchema:Nt,PromptSchema:Tt,ListPromptsRequestSchema:It,ListPromptsResultSchema:At,GetPromptRequestParamsSchema:Lt,GetPromptRequestSchema:ta,TextContentSchema:aa,ImageContentSchema:ra,AudioContentSchema:oa,ToolUseContentSchema:Ga,EmbeddedResourceSchema:Dt,ResourceLinkSchema:Ba,ContentBlockSchema:wt,PromptMessageSchema:ga,GetPromptResultSchema:Sa,PromptListChangedNotificationSchema:sa,ToolAnnotationsSchema:Ya,ToolExecutionSchema:_a,ToolSchema:na,ListToolsRequestSchema:ya,ListToolsResultSchema:va,CallToolResultSchema:ba,CallToolRequestParamsSchema:St,CallToolRequestSchema:Wa,ToolListChangedNotificationSchema:to,LoggingLevelSchema:Ra,SetLevelRequestParamsSchema:Za,SetLevelRequestSchema:Xa,LoggingMessageNotificationParamsSchema:Qa,LoggingMessageNotificationSchema:er,ModelHintSchema:tr,ModelPreferencesSchema:ar,ToolChoiceSchema:rr,ToolResultContentSchema:ao,SamplingContentSchema:or,SamplingMessageContentBlockSchema:Vt,SamplingMessageSchema:sr,CreateMessageRequestParamsSchema:nr,CreateMessageRequestSchema:ir,CreateMessageResultSchema:cr,CreateMessageResultWithToolsSchema:lr,BooleanSchemaSchema:ur,StringSchemaSchema:dr,NumberSchemaSchema:mr,UntitledSingleSelectEnumSchemaSchema:hr,TitledSingleSelectEnumSchemaSchema:pr,LegacyTitledEnumSchemaSchema:fr,SingleSelectEnumSchemaSchema:gr,UntitledMultiSelectEnumSchemaSchema:ia,TitledMultiSelectEnumSchemaSchema:ca,MultiSelectEnumSchemaSchema:ro,EnumSchemaSchema:oo,PrimitiveSchemaDefinitionSchema:$t,ElicitRequestFormParamsSchema:Et,ElicitRequestURLParamsSchema:Sr,ElicitRequestParamsSchema:Ct,ElicitRequestSchema:so,ElicitationCompleteNotificationParamsSchema:no,ElicitationCompleteNotificationSchema:io,ElicitResultSchema:co,ResourceTemplateReferenceSchema:lo,PromptReferenceSchema:uo,CompleteRequestParamsSchema:mo,CompleteRequestSchema:_r,CompleteResultSchema:ho,RootSchema:po,ListRootsRequestSchema:za,ListRootsResultSchema:yr,RootsListChangedNotificationSchema:fo,TaskCreationParamsSchema:go,TaskStatusSchema:So,TaskSchema:Ut,CreateTaskResultSchema:Rt,TaskStatusNotificationParamsSchema:_o,TaskStatusNotificationSchema:la,GetTaskRequestSchema:$a,GetTaskResultSchema:Ea,GetTaskPayloadRequestSchema:Pa,GetTaskPayloadResultSchema:$n,ListTasksRequestSchema:zt,ListTasksResultSchema:lt,CancelTaskRequestSchema:ua,CancelTaskResultSchema:ne.merge(Ut),ClientRequestSchema:c([Ze,Ie,_r,Xa,ta,It,at,$e,Ke,gt,ot,Wa,ya,$a,Pa,zt,ua]),ClientNotificationSchema:c([V,ut,Ve,fo,la]),ClientResultSchema:c([B,cr,lr,co,yr,Ea,lt,Rt]),ServerRequestSchema:c([Ze,ir,so,za,$a,Pa,zt,ua]),ServerNotificationSchema:c([V,ut,er,ht,ct,to,sa,la,io]),ServerResultSchema:c([B,Ue,ho,Sa,At,bt,je,Be,ba,va,Ea,lt,Rt]),CallToolResultWireSchema:l().superRefine((_t,gl)=>{if(typeof _t!=="object"||_t===null||Array.isArray(_t)||_t.content!==void 0)return;for(let Mi of cc)if(Mi in _t){gl.addIssue({code:"custom",message:`content is required when the body carries '${Mi}' — another result family cannot default into an empty tools/call success`});return}}).transform(fi).pipe(ba)}}var xl;function lc(){return xl??=Fl()}function uc(m){return m.type!=="object"}var Kl=new Set(["const","enum","default","examples"]),Jl=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Ji(m){return m!==void 0&&!(typeof m==="string"&&m.startsWith("#"))}function Gl(m){let h=typeof m.$schema==="string"?m.$schema:void 0;if(Ji(m.$id))return{...h!==void 0&&{$schema:h},type:"object",properties:{result:m},required:["result"]};let f=Di(m.$schema)&&m.$recursiveAnchor!==!0,g=(S,_)=>{if(Array.isArray(S))return S.map((z)=>g(z,!1));if(S===null||typeof S!=="object")return S;if(!_&&Ji(S.$id))return S;let y={},w=!1;for(let[z,q]of Object.entries(S))if(_)y[z]=g(q,!1);else if((z==="$ref"||z==="$dynamicRef")&&typeof q==="string")y[z]=q==="#"?"#/properties/result":q.startsWith("#/")?`#/properties/result${q.slice(1)}`:q;else if(z==="$recursiveRef"&&q==="#"&&f)w=!0;else if(Kl.has(z))y[z]=q;else if(Jl.has(z))y[z]=g(q,!0);else y[z]=g(q,!1);if(w)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 dc={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},mc={"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},Bl={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},ln;function gi(){if(ln)return ln;let m=lc();return ln={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}},ln}function hc(m){return Object.prototype.hasOwnProperty.call(dc,m)}function pc(m){return Object.prototype.hasOwnProperty.call(mc,m)}function Yl(m){return Object.prototype.hasOwnProperty.call(Bl,m)}function Wl(m){return Yl(m)?gi().resultSchemas[m]:void 0}function Zl(m){return hc(m)?gi().requestSchemas[m]:void 0}function Xl(m){return pc(m)?gi().notificationSchemas[m]:void 0}var jh=Object.keys(dc),Nh=Object.keys(mc);function li(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function un(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 Gi={ok:!1,reason:"not-in-era"};function Bi(m){return li(m)&&li(m.outputSchema)&&uc(m.outputSchema)}function Yi(m){return m}var Si={era:"2025-11-25",hasRequestMethod:hc,hasNotificationMethod:pc,validateRequest:(m,h)=>un(Zl(m),h),validateResult:(m,h)=>un(Wl(m),h),validateNotification:(m,h)=>un(Xl(m),h),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Gi,validateInputResponse:()=>Gi,samplingResultVariant:(m,h)=>{let f=lc();return un(m?f.CreateMessageResultWithToolsSchema:f.CreateMessageResultSchema,h)},outboundEnvelope:(m)=>{return},validateEnvelopeMeta:(m)=>[],projectCallToolResult(m,h){let f=ic(m),g=f.structuredContent;if(g===void 0)return f;let S=typeof g!=="object"||g===null||Array.isArray(g),_=h!==void 0&&uc(h);if(!S&&!_)return f;return{...f,structuredContent:{result:g}}},decodeResult(m,h){if(li(h)&&"resultType"in h){let f={...h};return delete f.resultType,{kind:"complete",result:Yi(f)}}return{kind:"complete",result:Yi(h)}},encodeResult(m,h){if(m!=="tools/list")return h;let f=h.tools;if(!Array.isArray(f)||!f.some((g)=>Bi(g)))return h;return{...h,tools:f.map((g)=>Bi(g)?{...g,outputSchema:Gl(g.outputSchema)}:g)}},encodeErrorCode:(m)=>m===-32002?-32602:m,checkInboundEnvelope:(m)=>{return}};function Ql(){let m=A(()=>c([e(),o(),i(),R(),s(e(),m),r(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"]),w=e().refine((lt)=>{try{return atob(lt),!0}catch{return!1}},{message:"Invalid Base64 string"}),z=t({ttl:o().optional()}),q=t({taskId:e()}),D=d({progressToken:f.optional(),"io.modelcontextprotocol/related-task":q.optional()}),U=t({_meta:D.optional()}),ne=U.extend({task:z.optional()}),me=t({_meta:D.optional()}),B=t({method:e(),params:me.loose().optional()}),W=t({src:e(),mimeType:e().optional(),sizes:r(e()).optional(),theme:p(["light","dark"]).optional()}),V=t({icons:r(W).optional()}),C=t({name:e(),title:e().optional()}),K=C.extend({...C.shape,...V.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),I=E(t({applyDefaults:i().optional()}),h),Z=M((lt)=>{if(lt&&typeof lt==="object"&&!Array.isArray(lt)&&Object.keys(lt).length===0)return{form:{}};return lt},E(t({form:I.optional(),url:h.optional()}),h.optional())),pe=d({list:h.optional(),cancel:h.optional(),requests:d({sampling:d({createMessage:h.optional()}).optional(),elicitation:d({create:h.optional()}).optional()}).optional()}),H=d({list:h.optional(),cancel:h.optional(),requests:d({tools:d({call:h.optional()}).optional()}).optional()}),L=t({experimental:s(e(),h).optional(),sampling:t({context:h.optional(),tools:h.optional()}).optional(),elicitation:Z.optional(),roots:t({listChanged:i().optional()}).optional(),tasks:pe.optional(),extensions:s(e(),h).optional()}),ze=t({experimental:s(e(),h).optional(),logging:h.optional(),completions:h.optional(),prompts:t({listChanged:i().optional()}).optional(),resources:t({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:t({listChanged:i().optional()}).optional(),tasks:H.optional(),extensions:s(e(),h).optional()}),Ne=t({progress:o(),total:u(o()),message:u(e())}),Le=t({...me.shape,...Ne.shape,progressToken:f}),Ie=B.extend({method:n("notifications/progress"),params:Le}),Me=me.extend({level:y,logger:e().optional(),data:l()}),Ue=B.extend({method:n("notifications/message"),params:Me}),Ve=t({uri:e(),mimeType:u(e()),_meta:s(e(),l()).optional()}),Ze=Ve.extend({text:e()}),rt=Ve.extend({blob:w}),tt=t({audience:r(_).optional(),priority:o().min(0).max(1).optional(),lastModified:j({offset:!0}).optional()}),ut=t({...C.shape,...V.shape,uri:e(),description:u(e()),mimeType:u(e()),size:u(o()),annotations:tt.optional(),_meta:u(d({}))}),Qe=t({...C.shape,...V.shape,uriTemplate:e(),description:u(e()),mimeType:u(e()),annotations:tt.optional(),_meta:u(d({}))}),Te=B.extend({method:n("notifications/resources/list_changed"),params:me.optional()}),qe=me.extend({uri:e()}),Ae=B.extend({method:n("notifications/resources/updated"),params:qe}),re=t({name:e(),description:u(e()),required:u(i())}),Pe=t({...C.shape,...V.shape,description:u(e()),arguments:u(r(re)),_meta:u(d({}))}),Ce=B.extend({method:n("notifications/prompts/list_changed"),params:me.optional()}),De=t({type:n("text"),text:e(),annotations:tt.optional(),_meta:s(e(),l()).optional()}),He=t({type:n("image"),data:w,mimeType:e(),annotations:tt.optional(),_meta:s(e(),l()).optional()}),We=t({type:n("audio"),data:w,mimeType:e(),annotations:tt.optional(),_meta:s(e(),l()).optional()}),Je=t({type:n("tool_use"),name:e(),id:e(),input:s(e(),l()),_meta:s(e(),l()).optional()}),at=t({type:n("resource"),resource:c([Ze,rt]),annotations:tt.optional(),_meta:s(e(),l()).optional()}),bt=ut.extend({type:n("resource_link")}),$e=c([De,He,We,bt,at]),je=t({role:_,content:$e}),Oe=t({title:e().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),xe=B.extend({method:n("notifications/tools/list_changed"),params:me.optional()}),Ke=t({name:e().optional()}),Be=t({hints:r(Ke).optional(),costPriority:o().min(0).max(1).optional(),speedPriority:o().min(0).max(1).optional(),intelligencePriority:o().min(0).max(1).optional()}),ct=t({mode:p(["auto","required","none"]).optional()}),mt=t({type:n("boolean"),title:e().optional(),description:e().optional(),default:i().optional()}),gt=t({type:n("string"),title:e().optional(),description:e().optional(),minLength:o().optional(),maxLength:o().optional(),format:p(["email","uri","date","date-time"]).optional(),default:e().optional()}),dt=t({type:p(["number","integer"]),title:e().optional(),description:e().optional(),minimum:o().optional(),maximum:o().optional(),default:o().optional()}),ot=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),default:e().optional()}),Pt=t({type:n("string"),title:e().optional(),description:e().optional(),oneOf:r(t({const:e(),title:e()})),default:e().optional()}),ht=t({type:n("string"),title:e().optional(),description:e().optional(),enum:r(e()),enumNames:r(e()).optional(),default:e().optional()}),Nt=c([ot,Pt]),Tt=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({type:n("string"),enum:r(e())}),default:r(e()).optional()}),It=t({type:n("array"),title:e().optional(),description:e().optional(),minItems:o().optional(),maxItems:o().optional(),items:t({anyOf:r(t({const:e(),title:e()}))}),default:r(e()).optional()}),At=c([Tt,It]),Lt=c([ht,Nt,At]),ta=c([Lt,mt,gt,dt]),aa=ne.extend({mode:n("form").optional(),message:e(),requestedSchema:t({type:n("object"),properties:s(e(),ta),required:r(e()).optional()}).catchall(l())}),ra=t({type:n("ref/resource"),uri:e()}),oa=t({type:n("ref/prompt"),name:e()}),Ga=t({uri:e().startsWith("file://"),name:e().optional(),_meta:s(e(),l()).optional()}),Dt=L.shape,Ba=t({experimental:Dt.experimental,sampling:Dt.sampling,elicitation:Dt.elicitation,roots:Dt.roots,extensions:Dt.extensions}),wt=ze.shape,ga=t({experimental:wt.experimental,logging:wt.logging,completions:wt.completions,prompts:wt.prompts,resources:wt.resources,tools:wt.tools,extensions:wt.extensions}),Sa=d({progressToken:f.optional(),[Ft]:e(),[vr]:K.optional(),[xt]:Ba,[ma]:y.optional()}),sa=t({...C.shape,...V.shape,description:e().optional(),inputSchema:d({$schema:e().optional(),type:n("object")}),outputSchema:d({$schema:e().optional()}).optional(),annotations:Oe.optional(),_meta:s(e(),l()).optional()}),Ya=t({type:n("tool_result"),toolUseId:e(),content:r($e),structuredContent:l().optional(),isError:i().optional(),_meta:s(e(),l()).optional()}),_a=c([De,He,We,Je,Ya]),na=t({role:_,content:c([_a,r(_a)]),_meta:s(e(),l()).optional()}),ya=e(),va=d({[kt]:K.optional().catch(void 0)}),ba=va.optional();function St(lt){return d({_meta:ba,resultType:ya.default("complete"),...lt})}let Wa=St({}),to=St({nextCursor:g.optional()}),Ra=St({content:r($e),structuredContent:l().optional(),isError:i().optional()}),Za=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),tools:r(sa),nextCursor:g.optional()}),Xa=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),prompts:r(Pe),nextCursor:g.optional()}),Qa=St({description:e().optional(),messages:r(je)}),er=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resources:r(ut),nextCursor:g.optional()}),tr=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resourceTemplates:r(Qe),nextCursor:g.optional()}),ar=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),contents:r(c([Ze,rt]))}),rr=St({completion:t({values:r(e()).max(100),total:o().int().optional(),hasMore:i().optional()}).loose()}),ao=St({ttlMs:o().int().min(0),cacheScope:p(["public","private"])}),or=St({ttlMs:o().int().min(0).catch(0),cacheScope:p(["public","private"]).catch("private"),supportedVersions:r(e()),capabilities:ga,instructions:e().optional()}),Vt=t({messages:r(na),modelPreferences:Be.optional(),systemPrompt:e().optional(),includeContext:p(["none","thisServer","allServers"]).optional(),temperature:o().optional(),maxTokens:o().int(),stopSequences:r(e()).optional(),metadata:h.optional(),tools:r(sa).optional(),toolChoice:ct.optional()}),sr=t({method:n("sampling/createMessage"),params:Vt}),nr=t({method:n("roots/list"),params:t({_meta:s(e(),l()).optional()}).optional()}),ir=t({...na.shape,model:e(),stopReason:e().optional()}),cr=t({roots:r(Ga)}),lr=t({action:p(["accept","decline","cancel"]),content:s(e(),c([e(),o(),i(),r(e())])).optional()}),ur=t({mode:n("url"),message:e(),url:e().url()}),dr=c([aa,ur]),mr=t({method:n("elicitation/create"),params:dr}),hr=c([sr,nr,mr]),pr=c([ir,cr,lr]),fr=s(e(),hr),gr=s(e(),pr),ia=St({inputRequests:fr.optional(),requestState:e().optional()}),ca={inputResponses:gr.optional(),requestState:e().optional()},ro=t({_meta:Sa,...ca}),oo=d({progressToken:f.optional()});function $t(lt,ua){return t({method:n(lt),params:t({_meta:Sa,...ua})})}function Et(lt,ua){return t({method:n(lt),params:t({_meta:oo.optional(),...ua}).optional()})}let Sr={name:e(),arguments:s(e(),l()).optional(),...ca},Ct={cursor:g.optional()},so=$t("tools/call",Sr),no=$t("tools/list",Ct),io=$t("prompts/list",Ct),co=$t("prompts/get",{name:e(),arguments:s(e(),e()).optional(),...ca}),lo=$t("resources/list",Ct),uo=$t("resources/templates/list",Ct),mo=$t("resources/read",{uri:e(),...ca}),_r={ref:c([oa,ra]),argument:t({name:e(),value:e()}),context:t({arguments:s(e(),e()).optional()}).optional()},ho=$t("completion/complete",_r),po=$t("server/discover",{}),za=t({toolsListChanged:i().optional(),promptsListChanged:i().optional(),resourcesListChanged:i().optional(),resourceSubscriptions:r(e()).optional()}),yr={notifications:za},fo=$t("subscriptions/listen",yr),go=va.extend({"io.modelcontextprotocol/subscriptionId":S}),So=d({_meta:go,resultType:ya.default("complete")}),Ut={"tools/call":Et("tools/call",Sr),"tools/list":Et("tools/list",Ct),"prompts/get":Et("prompts/get",{name:e(),arguments:s(e(),e()).optional()}),"prompts/list":Et("prompts/list",Ct),"resources/list":Et("resources/list",Ct),"resources/templates/list":Et("resources/templates/list",Ct),"resources/read":Et("resources/read",{uri:e()}),"completion/complete":Et("completion/complete",_r),"server/discover":Et("server/discover",{}),"subscriptions/listen":Et("subscriptions/listen",yr)};function Rt(lt){return d({_meta:ba,...lt})}let _o={"tools/call":Rt({content:r($e),structuredContent:l().optional(),isError:i().optional()}),"tools/list":Rt({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),tools:r(sa),nextCursor:g.optional()}),"prompts/get":Rt({description:e().optional(),messages:r(je)}),"prompts/list":Rt({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),prompts:r(Pe),nextCursor:g.optional()}),"resources/list":Rt({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resources:r(ut),nextCursor:g.optional()}),"resources/templates/list":Rt({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),resourceTemplates:r(Qe),nextCursor:g.optional()}),"resources/read":Rt({ttlMs:o().int().min(0),cacheScope:p(["public","private"]),contents:r(c([Ze,rt]))}),"completion/complete":Rt({completion:t({values:r(e()).max(100),total:o().int().optional(),hasMore:i().optional()}).loose()}),"server/discover":Rt({ttlMs:o().int().min(0).catch(0),cacheScope:p(["public","private"]).catch("private"),supportedVersions:r(e()),capabilities:ga,instructions:e().optional()}),"subscriptions/listen":Rt({})},la=d({"io.modelcontextprotocol/subscriptionId":S.optional()}),$a=t({method:n("notifications/subscriptions/acknowledged"),params:t({_meta:la.optional(),notifications:za})}),Ea=t({_meta:la.optional(),requestId:S,reason:e().optional()}),Pa=t({method:n("notifications/cancelled"),params:Ea}),$n={"notifications/cancelled":Pa,"notifications/progress":Ie,"notifications/message":Ue,"notifications/resources/updated":Ae,"notifications/resources/list_changed":Te,"notifications/tools/list_changed":xe,"notifications/prompts/list_changed":Ce,"notifications/subscriptions/acknowledged":$a},zt=(lt)=>t({jsonrpc:n("2.0"),id:c([e(),o().int()]),result:lt}).strict();return{JSONValueSchema:m,JSONObjectSchema:h,ProgressTokenSchema:f,CursorSchema:g,RequestIdSchema:S,RoleSchema:_,LoggingLevelSchema:y,TaskMetadataSchema:z,RelatedTaskMetadataSchema:q,RequestMetaSchema:D,BaseRequestParamsSchema:U,TaskAugmentedRequestParamsSchema:ne,NotificationsParamsSchema:me,NotificationSchema:B,IconSchema:W,IconsSchema:V,BaseMetadataSchema:C,ImplementationSchema:K,ClientTasksCapabilitySchema:pe,ServerTasksCapabilitySchema:H,ClientCapabilitiesSchema:L,ServerCapabilitiesSchema:ze,ProgressSchema:Ne,ProgressNotificationParamsSchema:Le,ProgressNotificationSchema:Ie,LoggingMessageNotificationParamsSchema:Me,LoggingMessageNotificationSchema:Ue,ResourceContentsSchema:Ve,TextResourceContentsSchema:Ze,BlobResourceContentsSchema:rt,AnnotationsSchema:tt,ResourceSchema:ut,ResourceTemplateSchema:Qe,ResourceListChangedNotificationSchema:Te,ResourceUpdatedNotificationParamsSchema:qe,ResourceUpdatedNotificationSchema:Ae,PromptArgumentSchema:re,PromptSchema:Pe,PromptListChangedNotificationSchema:Ce,TextContentSchema:De,ImageContentSchema:He,AudioContentSchema:We,ToolUseContentSchema:Je,EmbeddedResourceSchema:at,ResourceLinkSchema:bt,ContentBlockSchema:$e,PromptMessageSchema:je,ToolAnnotationsSchema:Oe,ToolListChangedNotificationSchema:xe,ModelHintSchema:Ke,ModelPreferencesSchema:Be,ToolChoiceSchema:ct,BooleanSchemaSchema:mt,StringSchemaSchema:gt,NumberSchemaSchema:dt,UntitledSingleSelectEnumSchemaSchema:ot,TitledSingleSelectEnumSchemaSchema:Pt,LegacyTitledEnumSchemaSchema:ht,SingleSelectEnumSchemaSchema:Nt,UntitledMultiSelectEnumSchemaSchema:Tt,TitledMultiSelectEnumSchemaSchema:It,MultiSelectEnumSchemaSchema:At,EnumSchemaSchema:Lt,PrimitiveSchemaDefinitionSchema:ta,ElicitRequestFormParamsSchema:aa,ResourceTemplateReferenceSchema:ra,PromptReferenceSchema:oa,RootSchema:Ga,ClientCapabilities2026Schema:Ba,ServerCapabilities2026Schema:ga,RequestMetaEnvelopeSchema:Sa,ToolSchema:sa,ToolResultContentSchema:Ya,SamplingMessageContentBlockSchema:_a,SamplingMessageSchema:na,ResultTypeSchema:ya,ResultMetaSchema:va,ResultSchema:Wa,PaginatedResultSchema:to,CallToolResultSchema:Ra,ListToolsResultSchema:Za,ListPromptsResultSchema:Xa,GetPromptResultSchema:Qa,ListResourcesResultSchema:er,ListResourceTemplatesResultSchema:tr,ReadResourceResultSchema:ar,CompleteResultSchema:rr,CacheableResultSchema:ao,DiscoverResultSchema:or,CreateMessageRequestParamsSchema:Vt,CreateMessageRequestSchema:sr,ListRootsRequestSchema:nr,CreateMessageResultSchema:ir,ListRootsResultSchema:cr,ElicitResultSchema:lr,ElicitRequestURLParamsSchema:ur,ElicitRequestParamsSchema:dr,ElicitRequestSchema:mr,InputRequestSchema:hr,InputResponseSchema:pr,InputRequestsSchema:fr,InputResponsesSchema:gr,InputRequiredResultSchema:ia,InputResponseRequestParamsSchema:ro,CallToolRequestSchema:so,ListToolsRequestSchema:no,ListPromptsRequestSchema:io,GetPromptRequestSchema:co,ListResourcesRequestSchema:lo,ListResourceTemplatesRequestSchema:uo,ReadResourceRequestSchema:mo,CompleteRequestSchema:ho,DiscoverRequestSchema:po,SubscriptionFilterSchema:za,SubscriptionsListenRequestSchema:fo,SubscriptionsListenResultMetaSchema:go,SubscriptionsListenResultSchema:So,dispatchRequestSchemas:Ut,dispatchResultSchemas:_o,NotificationMetaSchema:la,SubscriptionsAcknowledgedNotificationSchema:$a,CancelledNotificationParamsSchema:Ea,CancelledNotificationSchema:Pa,notificationSchemas2026:$n,JSONRPCResultResponseSchema:zt(Wa),CallToolResultResponseSchema:zt(c([Ra,ia])),ListToolsResultResponseSchema:zt(Za),ListPromptsResultResponseSchema:zt(Xa),GetPromptResultResponseSchema:zt(c([Qa,ia])),ListResourcesResultResponseSchema:zt(er),ListResourceTemplatesResultResponseSchema:zt(tr),ReadResourceResultResponseSchema:zt(c([ar,ia])),CompleteResultResponseSchema:zt(rr),DiscoverResultResponseSchema:zt(or)}}var eu;function fa(){return eu??=Ql()}var tu=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function au(m){return tu.includes(m)}var Ua=Symbol("modelcontextprotocol.resultCacheHintFallback");function gn(m,h){if(h===void 0)return m;let f=m[Ua];if(f===void 0)return{...m,[Ua]: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,[Ua]:g}}function ru(m){return m[Ua]}function _i(m){return typeof m==="number"&&Number.isSafeInteger(m)&&m>=0}function yi(m){return m==="public"||m==="private"}function vi(m,h){if(m.ttlMs!==void 0&&!_i(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&&!yi(m.cacheScope))throw RangeError(`Invalid cache hint for ${h}: cacheScope must be 'public' or 'private' (got ${String(m.cacheScope)})`)}var a=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}({}),Fe=class m extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](h){return Ha(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 Ha(this,h)}constructor(h,f,g){super(f);this.code=h,this.data=g,this.name="ProtocolError",mi(this,new.target)}static fromError(h,f,g){if(h===a.UrlElicitationRequired&&g){let S=g;if(S.elicitations)return new ou(S.elicitations,f)}if(h===a.UnsupportedProtocolVersion&&g){let S=g;if(Array.isArray(S.supported)&&typeof S.requested==="string")return new F({supported:S.supported,requested:S.requested},f)}if(h===a.InvalidParams||h===a.ResourceNotFound){let S=g;if(typeof S?.uri==="string"&&(h===a.ResourceNotFound||Object.keys(S).length===1))return new bi(S.uri,f)}if(h===a.MissingRequiredClientCapability&&g){let S=g;if(S.requiredCapabilities!==null&&typeof S.requiredCapabilities==="object"&&!Array.isArray(S.requiredCapabilities))return new Ri({requiredCapabilities:S.requiredCapabilities},f)}return new m(h,f,g)}},bi=class extends Fe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(m,h=`Resource not found: ${m}`){super(a.InvalidParams,h,{uri:m})}get uri(){return this.data.uri}},ou=class extends Fe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(m,h=`URL elicitation${m.length>1?"s":""} required`){super(a.UrlElicitationRequired,h,{elicitations:m})}get elicitations(){return this.data?.elicitations??[]}},F=class extends Fe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(m,h=`Unsupported protocol version: ${m.requested}`){super(a.UnsupportedProtocolVersion,h,m)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Ri=class extends Fe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(m,h=`Missing required client capabilities: ${Object.keys(m.requiredCapabilities).join(", ")}`){super(a.MissingRequiredClientCapability,h,m)}get requiredCapabilities(){return this.data.requiredCapabilities}},su=0,nu="private",iu=["tools/call","prompts/get","resources/read"];function cu(m,h){let f=h.resultType;if(f===void 0)return{...h,resultType:"complete"};if(f==="complete")return h;if(iu.includes(m))return h;throw new Fe(a.InternalError,`Handler for ${m} returned resultType '${String(f)}', but results of ${m} only support 'complete' on protocol revision 2026-07-28`)}function lu(m,h){let f=ru(h);if(h.resultType!=="complete"||!au(m))return f===void 0?h:pu(h);let g=h,S=_i(g.ttlMs)?g.ttlMs:mu(f),_=yi(g.cacheScope)?g.cacheScope:hu(f),y={...g,ttlMs:S,cacheScope:_};return delete y[Ua],y}function uu(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function du(m,h){if(h===void 0)return m;let f=m._meta;if(f===void 0)return{...m,_meta:{[kt]:h}};if(!uu(f))return m;if(f[kt]!==void 0)return m;return{...m,_meta:{...f,[kt]:h}}}function mu(m){return m!==void 0&&_i(m.ttlMs)?m.ttlMs:su}function hu(m){return m!==void 0&&yi(m.cacheScope)?m.cacheScope:nu}function pu(m){let h={...m};return delete h[Ua],h}var fu=["elicitation/create","sampling/createMessage","roots/list"],dn;function fc(){if(dn)return dn;let m=fa();return dn={request:{"elicitation/create":t({method:n("elicitation/create"),params:m.ElicitRequestParamsSchema}),"sampling/createMessage":t({method:n("sampling/createMessage"),params:m.CreateMessageRequestParamsSchema}),"roots/list":t({method:n("roots/list"),params:d({}).optional()})},response:{"elicitation/create":m.ElicitResultSchema,"sampling/createMessage":m.CreateMessageResultSchema,"roots/list":m.ListRootsResultSchema}},dn}function gc(m){return fu.includes(m)}function si(m){return gc(m)?fc().request[m]:void 0}function gu(m){return gc(m)?fc().response[m]:void 0}var zi={"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},Sc={"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 _c(m){return Object.prototype.hasOwnProperty.call(zi,m)}function yc(m){return Object.prototype.hasOwnProperty.call(Sc,m)}function Su(m){return Object.prototype.hasOwnProperty.call(zi,m)}function _u(m){return _c(m)?fa().dispatchRequestSchemas[m]:void 0}function yu(m){return Su(m)?fa().dispatchResultSchemas[m]:void 0}function vu(m){return yc(m)?fa().notificationSchemas2026[m]:void 0}var Ih=Object.keys(zi),Oh=Object.keys(Sc);function Br(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function Jr(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 bu={ok:!1,reason:"not-in-era"},Ru=[Ft,xt];function zu(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((w)=>Br(w)&&("execution"in w)))S().tools=_.map((w)=>{if(!Br(w)||!("execution"in w))return w;let z={...w};return delete z.execution,z});let y=h.capabilities;if(Br(y)&&"tasks"in y){let w={...y};delete w.tasks,S().capabilities=w}return f}var $i={era:"2026-07-28",hasRequestMethod:_c,hasNotificationMethod:yc,hasInputRequestMethod:(m)=>si(m)!==void 0,validateRequest:(m,h)=>Jr(_u(m),h),validateResult:(m,h)=>Jr(yu(m),h),validateNotification:(m,h)=>Jr(vu(m),h),validateInputRequest:(m,h)=>Jr(si(m),h),validateInputResponse:(m,h)=>Jr(gu(m),h),samplingResultVariant:()=>bu,outboundEnvelope(m){return{[Ft]:m.protocolVersion,[vr]:m.clientInfo,[xt]:m.clientCapabilities,...m.logLevel!==void 0&&{[ma]:m.logLevel}}},validateEnvelopeMeta(m){let h=[];for(let g of Ru)if(!(g in m))h.push({key:g,problem:"missing"});let f=fa().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)=>ic(m),inputRequestSchema:si,decodeResult(m,h){if(!Br(h))return{kind:"invalid",error:new Ye(Xe.InvalidResult,`Invalid result for ${m}: not an object`,{method:m})};let f=h.resultType;if(f===void 0)return{kind:"invalid",error:new Ye(Xe.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 Ye(Xe.InvalidResult,`Invalid result for ${m}: non-string resultType`,{method:m,resultType:f})};if(f==="input_required"){let y=h.inputRequests,w=Br(y)?y:{},z=h.requestState;if(Object.keys(w).length===0&&typeof z!=="string")return{kind:"invalid",error:new Ye(Xe.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:w,...typeof z==="string"&&{requestState:z}}}if(f!=="complete")return{kind:"invalid",error:new Ye(Xe.UnsupportedResultType,`Unsupported result type '${f}' for ${m}`,{resultType:f,method:m})};let g=$u(),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 Ye(Xe.InvalidResult,`Invalid result for ${m}: ${y.error}`,{method:m})}}let _={...h};return delete _.resultType,{kind:"complete",result:_}},encodeResult(m,h,f){return du(lu(m,cu(m,zu(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=fa().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("; ")}`}},mn;function $u(){if(mn)return mn;let m=fa();return mn={"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},mn}var Zr="2026-07-28";function Xt(m){return m!==void 0&&xa(m)?$i:Si}function Wi(m){if(m.revision!==void 0)return Xt(m.revision).era;return m.era==="modern"?$i.era:Si.era}function ni(m){return vc.some((h)=>h.hasRequestMethod(m))}function ii(m){return vc.some((h)=>h.hasNotificationMethod(m))}var vc=[Si,$i];function Zi(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function O(m){if(!Zi(m))return;let h=m._meta;return Zi(h)?h:void 0}function G(m){let h=O(m);return h!==void 0&&Ft in h}function J(m){let h=O(m)?.[Ft];return typeof h==="string"?h:void 0}function Y(m){return Xt(Zr).validateEnvelopeMeta(m)}var Eu=Ai({AnnotationsSchema:()=>Mt,AudioContentSchema:()=>Ma,BaseMetadataSchema:()=>Ot,BaseRequestParamsSchema:()=>ft,BlobResourceContentsSchema:()=>Or,BooleanSchemaSchema:()=>Dr,CallToolRequestParamsSchema:()=>bs,CallToolRequestSchema:()=>Rs,CallToolResultSchema:()=>Lr,CancelTaskRequestSchema:()=>Fn,CancelTaskResultSchema:()=>xn,CancelledNotificationParamsSchema:()=>$o,CancelledNotificationSchema:()=>Tr,ClientCapabilitiesSchema:()=>To,ClientNotificationSchema:()=>Jn,ClientRequestSchema:()=>Kn,ClientResultSchema:()=>Gn,ClientTasksCapabilitySchema:()=>Po,CompatibilityCallToolResultSchema:()=>Nn,CompleteRequestParamsSchema:()=>Ys,CompleteRequestSchema:()=>Ws,CompleteResultSchema:()=>Zs,ContentBlockSchema:()=>Aa,CreateMessageRequestParamsSchema:()=>Os,CreateMessageRequestSchema:()=>ks,CreateMessageResultSchema:()=>Ms,CreateMessageResultWithToolsSchema:()=>As,CreateTaskResultSchema:()=>kn,CursorSchema:()=>Rr,DiscoverRequestSchema:()=>Io,DiscoverResultSchema:()=>Oo,ElicitRequestFormParamsSchema:()=>Va,ElicitRequestParamsSchema:()=>Hs,ElicitRequestSchema:()=>Fs,ElicitRequestURLParamsSchema:()=>Us,ElicitResultSchema:()=>Js,ElicitationCompleteNotificationParamsSchema:()=>xs,ElicitationCompleteNotificationSchema:()=>Ks,EmbeddedResourceSchema:()=>ms,EmptyResultSchema:()=>wr,EnumSchemaSchema:()=>Vs,GetPromptRequestParamsSchema:()=>ls,GetPromptRequestSchema:()=>us,GetPromptResultSchema:()=>fs,GetTaskPayloadRequestSchema:()=>Dn,GetTaskPayloadResultSchema:()=>Vn,GetTaskRequestSchema:()=>An,GetTaskResultSchema:()=>Ln,IconSchema:()=>Eo,IconsSchema:()=>Jt,ImageContentSchema:()=>ka,ImplementationSchema:()=>Na,InitializeRequestParamsSchema:()=>Co,InitializeRequestSchema:()=>qo,InitializeResultSchema:()=>jo,InitializedNotificationSchema:()=>No,JSONArraySchema:()=>Cn,JSONObjectSchema:()=>st,JSONRPCErrorResponseSchema:()=>ja,JSONRPCMessageSchema:()=>zo,JSONRPCNotificationSchema:()=>Pr,JSONRPCRequestSchema:()=>Er,JSONRPCResponseSchema:()=>qn,JSONRPCResultResponseSchema:()=>qa,JSONValueSchema:()=>Ht,LegacyTitledEnumSchemaSchema:()=>Hr,ListChangedOptionsBaseSchema:()=>In,ListPromptsRequestSchema:()=>is,ListPromptsResultSchema:()=>cs,ListResourceTemplatesRequestSchema:()=>Uo,ListResourceTemplatesResultSchema:()=>Ho,ListResourcesRequestSchema:()=>Do,ListResourcesResultSchema:()=>Vo,ListRootsRequestSchema:()=>Qs,ListRootsResultSchema:()=>en,ListTasksRequestSchema:()=>Un,ListTasksResultSchema:()=>Hn,ListToolsRequestSchema:()=>ys,ListToolsResultSchema:()=>vs,LoggingLevelSchema:()=>Wt,LoggingMessageNotificationParamsSchema:()=>Ps,LoggingMessageNotificationSchema:()=>ws,ModelHintSchema:()=>Ts,ModelPreferencesSchema:()=>Cs,MultiSelectEnumSchemaSchema:()=>Ds,NotificationSchema:()=>vt,NotificationsParamsSchema:()=>yt,NumberSchemaSchema:()=>Da,PaginatedRequestParamsSchema:()=>Ao,PaginatedRequestSchema:()=>Gt,PaginatedResultSchema:()=>Bt,PingRequestSchema:()=>qr,PrimitiveSchemaDefinitionSchema:()=>Kr,ProgressNotificationParamsSchema:()=>Mo,ProgressNotificationSchema:()=>jr,ProgressSchema:()=>ko,ProgressTokenSchema:()=>br,PromptArgumentSchema:()=>ss,PromptListChangedNotificationSchema:()=>gs,PromptMessageSchema:()=>ps,PromptReferenceSchema:()=>Bs,PromptSchema:()=>ns,ReadResourceRequestParamsSchema:()=>Fo,ReadResourceRequestSchema:()=>xo,ReadResourceResultSchema:()=>Ko,RelatedTaskMetadataSchema:()=>Ro,RequestIdSchema:()=>Kt,RequestMetaSchema:()=>zr,RequestSchema:()=>nt,ResourceContentsSchema:()=>Nr,ResourceLinkSchema:()=>hs,ResourceListChangedNotificationSchema:()=>Jo,ResourceRequestParamsSchema:()=>Ia,ResourceSchema:()=>kr,ResourceTemplateReferenceSchema:()=>Gs,ResourceTemplateSchema:()=>Lo,ResourceUpdatedNotificationParamsSchema:()=>rs,ResourceUpdatedNotificationSchema:()=>os,ResultMetaObjectSchema:()=>$r,ResultSchema:()=>it,RoleSchema:()=>Yt,RootSchema:()=>Xs,RootsListChangedNotificationSchema:()=>tn,SamplingContentSchema:()=>Ns,SamplingMessageContentBlockSchema:()=>da,SamplingMessageSchema:()=>Is,ServerCapabilitiesSchema:()=>Cr,ServerNotificationSchema:()=>Yn,ServerRequestSchema:()=>Bn,ServerResultSchema:()=>Wn,ServerTasksCapabilitySchema:()=>wo,SetLevelRequestParamsSchema:()=>$s,SetLevelRequestSchema:()=>Es,SingleSelectEnumSchemaSchema:()=>Ls,StringSchemaSchema:()=>La,SubscribeRequestParamsSchema:()=>Go,SubscribeRequestSchema:()=>Bo,SubscriptionFilterSchema:()=>Mr,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Qo,SubscriptionsAcknowledgedNotificationSchema:()=>es,SubscriptionsListenRequestParamsSchema:()=>Zo,SubscriptionsListenRequestSchema:()=>Xo,SubscriptionsListenResultMetaSchema:()=>ts,SubscriptionsListenResultSchema:()=>as,TaskAugmentedRequestParamsSchema:()=>ha,TaskCreationParamsSchema:()=>On,TaskMetadataSchema:()=>bo,TaskSchema:()=>Zt,TaskStatusNotificationParamsSchema:()=>rn,TaskStatusNotificationSchema:()=>Mn,TaskStatusSchema:()=>an,TextContentSchema:()=>Oa,TextResourceContentsSchema:()=>Ir,TitledMultiSelectEnumSchemaSchema:()=>xr,TitledSingleSelectEnumSchemaSchema:()=>Ur,ToolAnnotationsSchema:()=>Ss,ToolChoiceSchema:()=>qs,ToolExecutionSchema:()=>_s,ToolListChangedNotificationSchema:()=>zs,ToolResultContentSchema:()=>js,ToolSchema:()=>Ar,ToolUseContentSchema:()=>ds,UnsubscribeRequestParamsSchema:()=>Yo,UnsubscribeRequestSchema:()=>Wo,UntitledMultiSelectEnumSchemaSchema:()=>Fr,UntitledSingleSelectEnumSchemaSchema:()=>Vr});var b=(m)=>Er.safeParse(m).success,k=(m)=>Pr.safeParse(m).success,X=(m)=>qa.safeParse(m).success,oe=(m)=>ja.safeParse(m).success;var Qt=(m)=>typeof m==="object"&&m!==null&&!Array.isArray(m)&&m.resultType==="input_required";function bc(m){if(m.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${m.params.ref.type}`)}function Rc(m){if(m.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${m.params.ref.type}`)}var Xi="x-mcp-header",Pu=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,wu=new Set(["string","integer","boolean","number"]);function zc(m){let h=[],f=new Map,g=(_,y,w)=>{if(_===null||typeof _!=="object")return;let z=_;if(Xi in z){if(!w||y.length===0)return`${hn(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 D=z[Xi];if(typeof D!=="string"||D.length===0)return`${hn(y)}: x-mcp-header MUST be a non-empty string`;if(!Pu.test(D))return`${hn(y)}: x-mcp-header '${D}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let U=typeof z.type==="string"?z.type:void 0;if(U===void 0||!wu.has(U))return`${hn(y)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${U??"<none>"}`;let ne=D.toLowerCase(),me=f.get(ne);if(me!==void 0)return`x-mcp-header '${D}' is not case-insensitively unique (also declared as '${me}')`;f.set(ne,D),h.push({path:y,headerName:D,type:U})}let q=z.properties;if(q!==null&&typeof q==="object")for(let[D,U]of Object.entries(q)){let ne=g(U,[...y,D],w);if(ne!==void 0)return ne}for(let D of Tu){let U=z[D];if(U===void 0)continue;let ne=Array.isArray(U)?U:U!==null&&typeof U==="object"&&Cu.has(D)?Object.values(U):[U];for(let me of ne){let B=g(me,[...y,`<${D}>`],!1);if(B!==void 0)return B}}},S=g(m,[],!0);return S===void 0?{valid:!0,declarations:h}:{valid:!1,reason:S}}var Tu=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Cu=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function hn(m){return m.length===0?"<root>":m.join(".")}var fn=-32020,kh=[{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:[a.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:[fn,a.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:[a.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:[a.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:[a.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:[fn],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:[a.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:[fn],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."}],Mh={[a.ParseError]:400,[a.InvalidRequest]:400,[a.MethodNotFound]:404,[a.UnsupportedProtocolVersion]:400,[a.MissingRequiredClientCapability]:400,[fn]:400};function pn(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 se(m){if(!G(m))return!1;let h=J(m);if(h===void 0||!xa(h))return!1;let f=O(m);return f!==void 0&&Y(f).length===0}function fe(m,h){switch(m.reason){case"http-method":return pn("http-method","modern-only-method-not-allowed",405,new Fe(-32000,"Method not allowed."),!0);case"batch":return pn("jsonrpc-shape","modern-only-batch-not-supported",400,new Fe(a.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return pn("jsonrpc-shape","modern-only-response-post",400,new Fe(a.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 pn("era-classification","modern-only-missing-envelope",400,f===void 0?new Fe(a.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...h]}):new F({supported:[...h],requested:f}),!0)}}}function Sn(m,h){return Q(m,h)}function Gr(m){return new Set(m.flatMap((h)=>Object.keys(h.shape)))}function Fa(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 Qi=!1,ui="draft-2020-12";function ea(m,h="input"){let f=m["~standard"],g;if(f.jsonSchema)g=f.jsonSchema[h]({target:ui});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(!Qi)Qi=!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=P(m,{target:ui,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 $c(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 $c(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"||$c(g)))}return!1}function qu(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 pa(m,h){let f=await m["~standard"].validate(h);if(f.issues&&f.issues.length>0)return{success:!1,error:f.issues.map((g)=>qu(g)).join(", ")};return{success:!0,data:f.value}}function ju(m){let h=P(m,{target:ui,io:"input"});return typeof h.pattern==="string"?h.pattern:void 0}var Nu=/\\\.\\d\{(\d+)\}/;function Iu(m){let h=Nu.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((_)=>j({local:g,offset:S,precision:_}))))}function Ou(m,h){let f;switch(m){case"email":f=[Re()];break;case"uri":f=[ee()];break;case"date":f=[de()];break;case"date-time":f=Iu(h);break}return new Set(f.map((g)=>ju(g)).filter((g)=>g!==void 0))}function ku(m,h,f){if(f!=="zod")return!0;return Ou(m,h).has(h)}function Ec(m){let h=ea(m,"input"),f=h.properties||{},g=h.required||[];return Object.entries(f).map(([S,_])=>({name:S,description:_?.description,required:g.includes(S)}))}function Wr(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function Mu(m){try{return ea(m,"input")}catch(h){let f=h instanceof Error?h.message:String(h);throw new Fe(a.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${f}`)}}var Au=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Ei(m){return Au.has(m)||m.startsWith("x-")}var Lu=new Set(["$schema",...Object.keys(Va.shape.requestedSchema.shape)]),ec={string:Gr([La,Vr,Ur,Hr]),number:Gr([Da]),integer:Gr([Da]),boolean:Gr([Dr]),array:Gr([Fr,xr])},Du=new Set(La.shape.format.unwrap().options);function Vu(m,h,f,g){if(!Wr(m))return m;let S=typeof m.type==="string"&&Object.hasOwn(ec,m.type)?ec[m.type]:void 0;if(S===void 0)return m;let _={};for(let[y,w]of Object.entries(m))if(S.has(y)||Ei(y))_[y]=w;else if(y==="pattern"&&m.type==="string"&&typeof m.format==="string"){if(!Du.has(m.format))_[y]=w;else if(typeof w!=="string"||!ku(m.format,w,f))g.push(`${h}.${y}`)}else g.push(`${h}.${y}`);return _}function Uu(m,h){let f={},g=[];for(let[S,_]of Object.entries(m))if(S==="properties"&&Wr(_))f[S]=Object.fromEntries(Object.entries(_).map(([y,w])=>[y,Vu(w,`properties.${y}`,h,g)]));else if(Lu.has(S))f[S]=_;else if(!Ei(S))g.push(S);if(g.length>0)throw new Fe(a.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${g.join(", ")}`);return f}function Hu(m,h){if(!Wr(m.properties))return h;let f=Object.entries(m.properties).filter(([,g])=>!Sn(Kr,g).success).map(([g])=>`properties.${g}`);return f.length>0?f.join(", "):h}function di(m,h,f=""){if(Array.isArray(m)&&Array.isArray(h))return m.flatMap((g,S)=>di(g,h[S],`${f}[${S}]`));if(!Wr(m)||!Wr(h))return[];return Object.entries(m).flatMap(([g,S])=>{let _=f?`${f}.${g}`:g;if(!Object.prototype.hasOwnProperty.call(h,g))return Ei(g)?[]:[_];return di(S,h[g],_)})}function Fu(m){if(!Fa(m.requestedSchema))return{...m,mode:"form",requestedSchema:m.requestedSchema};let h=m.requestedSchema["~standard"].vendor,f=Uu(Mu(m.requestedSchema),h),g=Sn(Va.shape.requestedSchema,f);if(!g.success)throw new Fe(a.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Hu(f,g.error.message)}`);let S=di(f,g.data);if(S.length>0)throw new Fe(a.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 Fe(a.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${_.join(", ")}`);return{...m,mode:"form",requestedSchema:g.data}}function xu(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 Ah=Object.assign(xu,{elicit(m){try{return{method:"elicitation/create",params:Fu(m)}}catch(h){throw h instanceof Fe?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 Pc=250;function wc(m,h){return`Multi-round-trip request '${m}' still required input after ${h} rounds (inputRequired.maxRounds)`}function Tc(m,h){return new Promise((f,g)=>{if(h?.aborted){g(h.reason instanceof Ye?h.reason:new Ye(Xe.RequestTimeout,String(h.reason)));return}let S=setTimeout(()=>{h?.removeEventListener("abort",_),f()},m),_=()=>{clearTimeout(S),g(h?.reason instanceof Ye?h.reason:new Ye(Xe.RequestTimeout,String(h?.reason)))};h?.addEventListener("abort",_,{once:!0})})}function Cc(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 Ku=["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"],Ju={IdJagTokenExchangeResponseSchema:ei,OAuthClientInformationFullSchema:ai,OAuthClientInformationSchema:cn,OAuthClientMetadataSchema:nn,OAuthClientRegistrationErrorSchema:ri,OAuthErrorResponseSchema:ti,OAuthMetadataSchema:on,OAuthProtectedResourceMetadataSchema:Zn,OAuthTokenRevocationRequestSchema:oi,OAuthTokensSchema:Qn,OpenIdProviderDiscoveryMetadataSchema:Xn,OpenIdProviderMetadataSchema:sn},qc={},jc={};function Nc(m,h){let f=m.slice(0,-6);qc[f]=h,jc[f]=(g)=>h.safeParse(g).success}for(let m of Ku)Nc(m,Eu[m]);for(let[m,h]of Object.entries(Ju))Nc(m,h);var Lh=Object.freeze(qc),Dh=Object.freeze(jc);function Gu(m){switch(m){case"initialize":case"notifications/initialized":return Xt(void 0);case"server/discover":return Xt(Zr);default:return}}var Bu=60000,Yu=[Ft,vr,xt,ma],Wu=["inputResponses","requestState"];function tc(m,h){let f=m.params;if(!Yr(f))return{message:m,lifted:{}};let g=f._meta,S=Yr(g)?Yu.filter((z)=>(z in g)):[],_=h==="request"?Wu.filter((z)=>(z in f)):[];if(S.length===0&&_.length===0)return{message:m,lifted:{}};let y={},w={...f};if(S.length>0&&Yr(g)){let z={},q={...g};for(let D of S)z[D]=g[D],delete q[D];if(y.envelope=z,Object.keys(q).length>0)w._meta=q;else delete w._meta}for(let z of _){if(z==="inputResponses")y.inputResponses=w[z];if(z==="requestState")y.requestState=w[z];delete w[z]}return{message:{...m,params:w},lifted:y}}function ac(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 Xr(m){return()=>m}var Zu=Xr(void 0);function Pi(m,h){return{...m,mcpReq:{...m.mcpReq,requestState:Xr(h)}}}var Ic;function he(m,h){Ic(m,h)}var Oc=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{Ic=(m,h)=>{m._negotiatedProtocolVersion=h}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(m){this._options=m,this._supportedProtocolVersions=m?.supportedProtocolVersions??wn,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 Ye(Xe.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 Ye(Xe.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,_),X(S)||oe(S))this._onresponse(S);else if(b(S))this._onrequest(S,_);else if(k(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 Ye(Xe.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}=tc(m,"notification"),g=this._negotiatedWireCodec();if(h?.classification===void 0&&this._shouldDropInbound(m)==="drop")return;if(h?.classification!==void 0){let y=Wi(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(ii(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}=tc(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=(W,V,C)=>{let K={jsonrpc:"2.0",id:f.id,error:{code:W,message:V,...C!==void 0&&{data:C}}};_?.send(K).catch((I)=>this._onerror(Error(`Failed to send an error response: ${I}`)))};if(h?.classification!==void 0){let W=Wi(h.classification);if(W!==S.era){this._onerror(Error(`Era mismatch on inbound request '${f.method}': classified as ${W} but this instance serves ${S.era}`));let V=h.classification.revision??W;y(a.UnsupportedProtocolVersion,`Unsupported protocol version: ${V}`,{supported:this._supportedProtocolVersions,requested:V});return}}if(ni(f.method)&&!S.hasRequestMethod(f.method)){y(a.MethodNotFound,"Method not found");return}let w=this._requestHandlers.get(f.method)??this.fallbackRequestHandler;if(w===void 0){y(a.MethodNotFound,"Method not found");return}let z=S.checkInboundEnvelope(g);if(z!==void 0){y(a.InvalidParams,z);return}let q=(W,V)=>this._notificationViaCodec(this._resolveOutboundCodec(W.method),W,{...V,relatedRequestId:f.id}),D=(W,V,C)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(W.method),W,V,{...C,relatedRequestId:f.id}),U=new AbortController;this._requestHandlerAbortControllers.set(f.id,U);let ne=g.inputResponses===void 0?void 0:Xu(g.inputResponses),me={sessionId:_?.sessionId,mcpReq:{id:f.id,method:f.method,_meta:f.params?._meta,...g.envelope!==void 0&&{envelope:g.envelope},...ne!==void 0&&{inputResponses:ne.accepted},...ne!==void 0&&ne.droppedKeys.length>0&&{droppedInputResponseKeys:ne.droppedKeys},requestState:g.requestState===void 0?Zu:Xr(g.requestState),signal:U.signal,send:(W,V,C)=>{let K=this._resolveOutboundCodec(W.method);if(this._assertOutboundRequestInEra(K,W.method),Fa(V))return D(W,V,C);let I=ac(K,W.method);if(I===void 0)throw TypeError(`'${W.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return D(W,I,V)},notify:q},http:h?.authInfo?{authInfo:h.authInfo}:void 0},B=this.buildContext(me,h);Promise.resolve().then(()=>w(f,B)).then(async(W)=>{if(U.signal.aborted)return;let V;try{V=S.encodeResult(f.method,W,this._outboundServerInfo())}catch(K){this._onerror(Error(`Failed to encode result for ${f.method}: ${K}`)),y(a.InternalError,"Internal error");return}let C={result:V,jsonrpc:"2.0",id:f.id};await _?.send(C)},async(W)=>{if(U.signal.aborted)return;let V=Number.isSafeInteger(W.code)?W.code:a.InternalError,C={jsonrpc:"2.0",id:f.id,error:{code:S.encodeErrorCode(V),message:W.message??"Internal error",...W.data!==void 0&&{data:W.data}}};await _?.send(C)}).catch((W)=>this._onerror(Error(`Failed to send response: ${W}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(f.id)===U)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(w){this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),_(w);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),X(m))f(m);else f(Fe.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),Fa(h))return this._requestWithSchemaViaCodec(g,m,h,f);let S=ac(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 Xt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(m){if(this._negotiatedProtocolVersion===void 0){let h=Gu(m);if(h)return h}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(m,h){if(ni(h)&&!m.hasRequestMethod(h))throw new Ye(Xe.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:w}=g??{},z=Date.now(),q,D;return new Promise((U,ne)=>{let me=(H)=>{ne(H)};if(!this._transport){me(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(h.method)}catch(H){me(H);return}if(g?.signal?.aborted){let H=g.signal.reason;throw H instanceof Ye?H:new Ye(Xe.RequestTimeout,String(H))}let B=m.era===Zr&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,W=this._requestMessageId++;D=W;let V={...h,jsonrpc:"2.0",id:W};if(g?.onprogress)this._progressHandlers.set(W,g.onprogress),V.params={...h.params,_meta:{...h.params?._meta,progressToken:W}};let C=this._envelopeOutbound(V),K=!1,I=(H)=>{if(K)return;if(this._progressHandlers.delete(W),B===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:W,reason:String(H)}}),{relatedRequestId:S,resumptionToken:_,onresumptiontoken:y}).catch((L)=>this._onerror(Error(`Failed to send cancellation: ${L}`)));else B.abort();ne(H instanceof Ye?H:new Ye(Xe.RequestTimeout,String(H)))};this._responseHandlers.set(W,(H)=>{if(g?.signal?.aborted)return;if(K=!0,H instanceof Error)return ne(H);let L;try{L=m.decodeResult(h.method,H.result)}catch(Ne){return ne(Ne instanceof Error?Ne:Error(String(Ne)))}if(L.kind==="invalid")return ne(L.error);if(L.kind==="input_required"){if(g?.allowInputRequired===!0)return U(Qu(L));let Ne={codec:m,request:h,resultSchema:f,options:g,flowStartedAt:z,retry:(Le,Ie)=>this._requestWithSchemaViaCodec(m,Le===void 0?{method:h.method}:{method:h.method,params:Le},f,Ie)};return U(this._resolveNonCompleteResult(L,Ne))}let ze=L.result;pa(f,ze).then((Ne)=>{if(Ne.success)U(Ne.data);else ne(new Ye(Xe.InvalidResult,`Invalid result for ${h.method}: ${Ne.error}`))},ne)}),q=()=>I(g?.signal?.reason),g?.signal?.addEventListener("abort",q,{once:!0});let Z=g?.timeout??Bu,pe=()=>I(new Ye(Xe.RequestTimeout,"Request timed out",{timeout:Z}));this._setupTimeout(W,Z,g?.maxTotalTimeout,pe,g?.resetTimeoutOnProgress??!1),this._transport.send(C,{relatedRequestId:S,resumptionToken:_,onresumptiontoken:y,headers:w,requestSignal:B?.signal}).catch((H)=>{this._progressHandlers.delete(W),ne(H)})}).finally(()=>{if(q)g?.signal?.removeEventListener("abort",q);if(D!==void 0)this._responseHandlers.delete(D),this._cleanupTimeout(D)})}async notification(m,h){return this._notificationViaCodec(this._resolveOutboundCodec(m.method),m,h)}async _notificationViaCodec(m,h,f){if(!this._transport)throw new Ye(Xe.NotConnected,"Not connected");if(ii(h.method)&&!m.hasNotificationMethod(h.method))throw new Ye(Xe.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(!ni(m))throw TypeError(`'${m}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);g=(S,_)=>{let y=this._negotiatedWireCodec(),w=y.validateRequest(m,S);if(!w.ok&&w.reason==="not-in-era")w=y.validateInputRequest(m,S);if(!w.ok){if(w.reason==="not-in-era")throw new Fe(a.InternalError,`No wire schema for ${m} in the resolved era`);throw Error(w.message)}return Promise.resolve(h(w.value,_))}}else if(f)g=async(S,_)=>{let y=await pa(h.params,{...S.params});if(!y.success)throw new Fe(a.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(!ii(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 Fe(a.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 pa(h.params,{...g.params});if(!S.success)throw new Fe(a.InvalidParams,`Invalid params for notification ${m}: ${S.error}`);await f(S.data,g)})}removeNotificationHandler(m){this._notificationHandlers.delete(m)}};function Yr(m){return m!==null&&typeof m==="object"&&!Array.isArray(m)}function kc(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]=Yr(y)&&Yr(_)?{...y,..._}:_}return f}function rc(m){return typeof m==="object"&&m!==null&&!Array.isArray(m)}function Xu(m){let h={},f=[];if(!rc(m))return{accepted:h,droppedKeys:f};for(let[g,S]of Object.entries(m)){if(!rc(S)||"method"in S||"result"in S){f.push(g);continue}h[g]=S}return{accepted:h,droppedKeys:f}}function Qu(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
|