@sequenzy/mcp 0.0.10 → 0.0.11
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/dist/index.js +2 -2
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var Xz=Object.create;var{getPrototypeOf:Yz,defineProperty:e4,getOwnPropertyNames
|
|
|
27
27
|
|
|
28
28
|
`)}L.write("payload.value = newResult;"),L.write("return payload;");let T=L.compile();return(E,v)=>T(U,E,v)},J,$=G1,z=!S6.jitless,B=z&&WQ.value,K=X.catchall,D;Q._zod.parse=(U,L)=>{D??(D=W.value);let O=U.value;if(!$(O))return U.issues.push({expected:"object",code:"invalid_type",input:O,inst:Q}),U;if(z&&B&&L?.async===!1&&L.jitless!==!0){if(!J)J=G(X.shape);if(U=J(U,L),!K)return U;return LY([],O,U,L,D,Q)}return Y(U,L)}});function C8(Q,X,Y,W){for(let J of Q)if(J.issues.length===0)return X.value=J.value,X;let G=Q.filter((J)=>!d0(J));if(G.length===1)return X.value=G[0].value,G[0];return X.issues.push({code:"invalid_union",input:X.value,inst:Y,errors:Q.map((J)=>J.issues.map(($)=>j0($,W,M0())))}),X}var LQ=F("$ZodUnion",(Q,X)=>{p.init(Q,X),l(Q._zod,"optin",()=>X.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),l(Q._zod,"optout",()=>X.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),l(Q._zod,"values",()=>{if(X.options.every((G)=>G._zod.values))return new Set(X.options.flatMap((G)=>Array.from(G._zod.values)));return}),l(Q._zod,"pattern",()=>{if(X.options.every((G)=>G._zod.pattern)){let G=X.options.map((J)=>J._zod.pattern);return new RegExp(`^(${G.map((J)=>g1(J.source)).join("|")})$`)}return});let Y=X.options.length===1,W=X.options[0]._zod.run;Q._zod.parse=(G,J)=>{if(Y)return W(G,J);let $=!1,z=[];for(let H of X.options){let B=H._zod.run({value:G.value,issues:[]},J);if(B instanceof Promise)z.push(B),$=!0;else{if(B.issues.length===0)return B;z.push(B)}}if(!$)return C8(z,G,Q,J);return Promise.all(z).then((H)=>{return C8(H,G,Q,J)})}}),MY=F("$ZodDiscriminatedUnion",(Q,X)=>{LQ.init(Q,X);let Y=Q._zod.parse;l(Q._zod,"propValues",()=>{let G={};for(let J of X.options){let $=J._zod.propValues;if(!$||Object.keys($).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(J)}"`);for(let[z,H]of Object.entries($)){if(!G[z])G[z]=new Set;for(let B of H)G[z].add(B)}}return G});let W=U1(()=>{let G=X.options,J=new Map;for(let $ of G){let z=$._zod.propValues?.[X.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf($)}"`);for(let H of z){if(J.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);J.set(H,$)}}return J});Q._zod.parse=(G,J)=>{let $=G.value;if(!G1($))return G.issues.push({code:"invalid_type",expected:"object",input:$,inst:Q}),G;let z=W.value.get($?.[X.discriminator]);if(z)return z._zod.run(G,J);if(X.unionFallback)return Y(G,J);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,input:$,path:[X.discriminator],inst:Q}),G}}),VY=F("$ZodIntersection",(Q,X)=>{p.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value,J=X.left._zod.run({value:G,issues:[]},W),$=X.right._zod.run({value:G,issues:[]},W);if(J instanceof Promise||$ instanceof Promise)return Promise.all([J,$]).then(([H,B])=>{return k8(Y,H,B)});return k8(Y,J,$)}});function FQ(Q,X){if(Q===X)return{valid:!0,data:Q};if(Q instanceof Date&&X instanceof Date&&+Q===+X)return{valid:!0,data:Q};if(n0(Q)&&n0(X)){let Y=Object.keys(X),W=Object.keys(Q).filter((J)=>Y.indexOf(J)!==-1),G={...Q,...X};for(let J of W){let $=FQ(Q[J],X[J]);if(!$.valid)return{valid:!1,mergeErrorPath:[J,...$.mergeErrorPath]};G[J]=$.data}return{valid:!0,data:G}}if(Array.isArray(Q)&&Array.isArray(X)){if(Q.length!==X.length)return{valid:!1,mergeErrorPath:[]};let Y=[];for(let W=0;W<Q.length;W++){let G=Q[W],J=X[W],$=FQ(G,J);if(!$.valid)return{valid:!1,mergeErrorPath:[W,...$.mergeErrorPath]};Y.push($.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function k8(Q,X,Y){if(X.issues.length)Q.issues.push(...X.issues);if(Y.issues.length)Q.issues.push(...Y.issues);if(d0(Q))return Q;let W=FQ(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var ZY=F("$ZodRecord",(Q,X)=>{p.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value;if(!n0(G))return Y.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),Y;let J=[];if(X.keyType._zod.values){let $=X.keyType._zod.values;Y.value={};for(let H of $)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let B=X.valueType._zod.run({value:G[H],issues:[]},W);if(B instanceof Promise)J.push(B.then((K)=>{if(K.issues.length)Y.issues.push(...g0(H,K.issues));Y.value[H]=K.value}));else{if(B.issues.length)Y.issues.push(...g0(H,B.issues));Y.value[H]=B.value}}let z;for(let H in G)if(!$.has(H))z=z??[],z.push(H);if(z&&z.length>0)Y.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:z})}else{Y.value={};for(let $ of Reflect.ownKeys(G)){if($==="__proto__")continue;let z=X.keyType._zod.run({value:$,issues:[]},W);if(z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(z.issues.length){Y.issues.push({code:"invalid_key",origin:"record",issues:z.issues.map((B)=>j0(B,W,M0())),input:$,path:[$],inst:Q}),Y.value[z.value]=z.value;continue}let H=X.valueType._zod.run({value:G[$],issues:[]},W);if(H instanceof Promise)J.push(H.then((B)=>{if(B.issues.length)Y.issues.push(...g0($,B.issues));Y.value[z.value]=B.value}));else{if(H.issues.length)Y.issues.push(...g0($,H.issues));Y.value[z.value]=H.value}}}if(J.length)return Promise.all(J).then(()=>Y);return Y}});var NY=F("$ZodEnum",(Q,X)=>{p.init(Q,X);let Y=XQ(X.entries),W=new Set(Y);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${Y.filter((G)=>GQ.has(typeof G)).map((G)=>typeof G==="string"?y0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,J)=>{let $=G.value;if(W.has($))return G;return G.issues.push({code:"invalid_value",values:Y,input:$,inst:Q}),G}}),qY=F("$ZodLiteral",(Q,X)=>{if(p.init(Q,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");Q._zod.values=new Set(X.values),Q._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?y0(Y):Y?y0(Y.toString()):String(Y)).join("|")})$`),Q._zod.parse=(Y,W)=>{let G=Y.value;if(Q._zod.values.has(G))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:G,inst:Q}),Y}});var wY=F("$ZodTransform",(Q,X)=>{p.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new x1(Q.constructor.name);let G=X.transform(Y.value,Y);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then(($)=>{return Y.value=$,Y});if(G instanceof Promise)throw new _0;return Y.value=G,Y}});function v8(Q,X){if(Q.issues.length&&X===void 0)return{issues:[],value:void 0};return Q}var jY=F("$ZodOptional",(Q,X)=>{p.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",l(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),l(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${g1(Y.source)})?$`):void 0}),Q._zod.parse=(Y,W)=>{if(X.innerType._zod.optin==="optional"){let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>v8(J,Y.value));return v8(G,Y.value)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),PY=F("$ZodNullable",(Q,X)=>{p.init(Q,X),l(Q._zod,"optin",()=>X.innerType._zod.optin),l(Q._zod,"optout",()=>X.innerType._zod.optout),l(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${g1(Y.source)}|null)$`):void 0}),l(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),Q._zod.parse=(Y,W)=>{if(Y.value===null)return Y;return X.innerType._zod.run(Y,W)}}),bY=F("$ZodDefault",(Q,X)=>{p.init(Q,X),Q._zod.optin="optional",l(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);if(Y.value===void 0)return Y.value=X.defaultValue,Y;let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>x8(J,X));return x8(G,X)}});function x8(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var EY=F("$ZodPrefault",(Q,X)=>{p.init(Q,X),Q._zod.optin="optional",l(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);if(Y.value===void 0)Y.value=X.defaultValue;return X.innerType._zod.run(Y,W)}}),IY=F("$ZodNonOptional",(Q,X)=>{p.init(Q,X),l(Q._zod,"values",()=>{let Y=X.innerType._zod.values;return Y?new Set([...Y].filter((W)=>W!==void 0)):void 0}),Q._zod.parse=(Y,W)=>{let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>_8(J,Q));return _8(G,Q)}});function _8(Q,X){if(!Q.issues.length&&Q.value===void 0)Q.issues.push({code:"invalid_type",expected:"nonoptional",input:Q.value,inst:X});return Q}var TY=F("$ZodCatch",(Q,X)=>{p.init(Q,X),l(Q._zod,"optin",()=>X.innerType._zod.optin),l(Q._zod,"optout",()=>X.innerType._zod.optout),l(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>{if(Y.value=J.value,J.issues.length)Y.value=X.catchValue({...Y,error:{issues:J.issues.map(($)=>j0($,W,M0()))},input:Y.value}),Y.issues=[];return Y});if(Y.value=G.value,G.issues.length)Y.value=X.catchValue({...Y,error:{issues:G.issues.map((J)=>j0(J,W,M0()))},input:Y.value}),Y.issues=[];return Y}});var SY=F("$ZodPipe",(Q,X)=>{p.init(Q,X),l(Q._zod,"values",()=>X.in._zod.values),l(Q._zod,"optin",()=>X.in._zod.optin),l(Q._zod,"optout",()=>X.out._zod.optout),l(Q._zod,"propValues",()=>X.in._zod.propValues),Q._zod.parse=(Y,W)=>{if(W.direction==="backward"){let J=X.out._zod.run(Y,W);if(J instanceof Promise)return J.then(($)=>u6($,X.in,W));return u6(J,X.in,W)}let G=X.in._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>u6(J,X.out,W));return u6(G,X.out,W)}});function u6(Q,X,Y){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues},Y)}var RY=F("$ZodReadonly",(Q,X)=>{p.init(Q,X),l(Q._zod,"propValues",()=>X.innerType._zod.propValues),l(Q._zod,"values",()=>X.innerType._zod.values),l(Q._zod,"optin",()=>X.innerType._zod.optin),l(Q._zod,"optout",()=>X.innerType._zod.optout),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then(y8);return y8(G)}});function y8(Q){return Q.value=Object.freeze(Q.value),Q}var CY=F("$ZodCustom",(Q,X)=>{Q0.init(Q,X),p.init(Q,X),Q._zod.parse=(Y,W)=>{return Y},Q._zod.check=(Y)=>{let W=Y.value,G=X.fn(W);if(G instanceof Promise)return G.then((J)=>g8(J,Y,W,Q));g8(G,Y,W,Q);return}});function g8(Q,X,Y,W){if(!Q){let G={code:"custom",input:Y,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)G.params=W._zod.def.params;X.issues.push(L1(G))}}var lz=(Q)=>{let X=typeof Q;switch(X){case"number":return Number.isNaN(Q)?"NaN":"number";case"object":{if(Array.isArray(Q))return"array";if(Q===null)return"null";if(Object.getPrototypeOf(Q)!==Object.prototype&&Q.constructor)return Q.constructor.name}}return X},mz=()=>{let Q={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function X(W){return Q[W]??null}let Y={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",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"};return(W)=>{switch(W.code){case"invalid_type":return`Invalid input: expected ${W.expected}, received ${lz(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${v6(W.values[0])}`;return`Invalid option: expected one of ${R6(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",J=X(W.origin);if(J)return`Too big: expected ${W.origin??"value"} to have ${G}${W.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${G}${W.maximum.toString()}`}case"too_small":{let G=W.inclusive?">=":">",J=X(W.origin);if(J)return`Too small: expected ${W.origin} to have ${G}${W.minimum.toString()} ${J.unit}`;return`Too small: expected ${W.origin} to be ${G}${W.minimum.toString()}`}case"invalid_format":{let G=W;if(G.format==="starts_with")return`Invalid string: must start with "${G.prefix}"`;if(G.format==="ends_with")return`Invalid string: must end with "${G.suffix}"`;if(G.format==="includes")return`Invalid string: must include "${G.includes}"`;if(G.format==="regex")return`Invalid string: must match pattern ${G.pattern}`;return`Invalid ${Y[G.format]??W.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${W.divisor}`;case"unrecognized_keys":return`Unrecognized key${W.keys.length>1?"s":""}: ${R6(W.keys,", ")}`;case"invalid_key":return`Invalid key in ${W.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${W.origin}`;default:return"Invalid input"}}};function OQ(){return{localeError:mz()}}var HV=Symbol("ZodOutput"),BV=Symbol("ZodInput");class kY{constructor(){this._map=new WeakMap,this._idmap=new Map}add(Q,...X){let Y=X[0];if(this._map.set(Q,Y),Y&&typeof Y==="object"&&"id"in Y){if(this._idmap.has(Y.id))throw Error(`ID ${Y.id} already exists in the registry`);this._idmap.set(Y.id,Q)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(Q){let X=this._map.get(Q);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete(Q),this}get(Q){let X=Q._zod.parent;if(X){let Y={...this.get(X)??{}};delete Y.id;let W={...Y,...this._map.get(Q)};return Object.keys(W).length?W:void 0}return this._map.get(Q)}has(Q){return this._map.has(Q)}}function cz(){return new kY}var c1=cz();function vY(Q,X){return new Q({type:"string",...b(X)})}function xY(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...b(X)})}function MQ(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...b(X)})}function _Y(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...b(X)})}function yY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(X)})}function gY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(X)})}function hY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(X)})}function uY(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...b(X)})}function fY(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...b(X)})}function lY(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(X)})}function mY(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...b(X)})}function cY(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(X)})}function pY(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...b(X)})}function iY(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...b(X)})}function nY(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(X)})}function dY(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(X)})}function rY(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(X)})}function oY(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(X)})}function tY(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(X)})}function aY(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...b(X)})}function sY(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...b(X)})}function eY(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...b(X)})}function QW(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...b(X)})}function XW(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(X)})}function YW(Q,X){return new Q({type:"string",format:"date",check:"string_format",...b(X)})}function WW(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...b(X)})}function GW(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...b(X)})}function JW(Q,X){return new Q({type:"number",checks:[],...b(X)})}function $W(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...b(X)})}function zW(Q,X){return new Q({type:"boolean",...b(X)})}function HW(Q,X){return new Q({type:"null",...b(X)})}function BW(Q){return new Q({type:"unknown"})}function KW(Q,X){return new Q({type:"never",...b(X)})}function m6(Q,X){return new KQ({check:"less_than",...b(X),value:Q,inclusive:!1})}function p1(Q,X){return new KQ({check:"less_than",...b(X),value:Q,inclusive:!0})}function c6(Q,X){return new DQ({check:"greater_than",...b(X),value:Q,inclusive:!1})}function i1(Q,X){return new DQ({check:"greater_than",...b(X),value:Q,inclusive:!0})}function p6(Q,X){return new O8({check:"multiple_of",...b(X),value:Q})}function i6(Q,X){return new V8({check:"max_length",...b(X),maximum:Q})}function O1(Q,X){return new Z8({check:"min_length",...b(X),minimum:Q})}function n6(Q,X){return new N8({check:"length_equals",...b(X),length:Q})}function VQ(Q,X){return new q8({check:"string_format",format:"regex",...b(X),pattern:Q})}function ZQ(Q){return new w8({check:"string_format",format:"lowercase",...b(Q)})}function NQ(Q){return new j8({check:"string_format",format:"uppercase",...b(Q)})}function qQ(Q,X){return new P8({check:"string_format",format:"includes",...b(X),includes:Q})}function wQ(Q,X){return new b8({check:"string_format",format:"starts_with",...b(X),prefix:Q})}function jQ(Q,X){return new E8({check:"string_format",format:"ends_with",...b(X),suffix:Q})}function J1(Q){return new I8({check:"overwrite",tx:Q})}function PQ(Q){return J1((X)=>X.normalize(Q))}function bQ(){return J1((Q)=>Q.trim())}function EQ(){return J1((Q)=>Q.toLowerCase())}function IQ(){return J1((Q)=>Q.toUpperCase())}function DW(Q,X,Y){return new Q({type:"array",element:X,...b(Y)})}function AW(Q,X,Y){let W=b(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function FW(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...b(Y)})}function UW(Q){let X=pz((Y)=>{return Y.addIssue=(W)=>{if(typeof W==="string")Y.issues.push(L1(W,Y.value,X._zod.def));else{let G=W;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=Y.value),G.inst??(G.inst=X),G.continue??(G.continue=!X._zod.def.abort),Y.issues.push(L1(G))}},Q(Y.value,Y)});return X}function pz(Q,X){let Y=new Q0({check:"custom",...b(X)});return Y._zod.check=Q,Y}function M1(Q){return!!Q._zod}function r0(Q,X){if(M1(Q))return f1(Q,X);return Q.safeParse(X)}function d6(Q){if(!Q)return;let X;if(M1(Q))X=Q._zod?.def?.shape;else X=Q.shape;if(!X)return;if(typeof X==="function")try{return X()}catch{return}return X}function LW(Q){if(M1(Q)){let J=Q._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let Y=Q._def;if(Y){if(Y.value!==void 0)return Y.value;if(Array.isArray(Y.values)&&Y.values.length>0)return Y.values[0]}let W=Q.value;if(W!==void 0)return W;return}var d1={};NX(d1,{time:()=>RQ,duration:()=>CQ,datetime:()=>TQ,date:()=>SQ,ZodISOTime:()=>VW,ZodISODuration:()=>ZW,ZodISODateTime:()=>OW,ZodISODate:()=>MW});var OW=F("ZodISODateTime",(Q,X)=>{o8.init(Q,X),d.init(Q,X)});function TQ(Q){return XW(OW,Q)}var MW=F("ZodISODate",(Q,X)=>{t8.init(Q,X),d.init(Q,X)});function SQ(Q){return YW(MW,Q)}var VW=F("ZodISOTime",(Q,X)=>{a8.init(Q,X),d.init(Q,X)});function RQ(Q){return WW(VW,Q)}var ZW=F("ZodISODuration",(Q,X)=>{s8.init(Q,X),d.init(Q,X)});function CQ(Q){return GW(ZW,Q)}var NW=(Q,X)=>{x6.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>CX(Q,Y)},flatten:{value:(Y)=>RX(Q,Y)},addIssue:{value:(Y)=>{Q.issues.push(Y),Q.message=JSON.stringify(Q.issues,F1,2)}},addIssues:{value:(Y)=>{Q.issues.push(...Y),Q.message=JSON.stringify(Q.issues,F1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},rV=F("ZodError",NW),L0=F("ZodError",NW,{Parent:Error});var qW=_6(L0),wW=y6(L0),jW=u1(L0),PW=l1(L0),bW=kX(L0),EW=vX(L0),IW=xX(L0),TW=_X(L0),SW=yX(L0),RW=gX(L0),CW=hX(L0),kW=uX(L0);var a=F("ZodType",(Q,X)=>{return p.init(Q,X),Q.def=X,Q.type=X.type,Object.defineProperty(Q,"_def",{value:X}),Q.check=(...Y)=>{return Q.clone(h.mergeDefs(X,{checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(Y,W)=>w0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q},Q.parse=(Y,W)=>qW(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>jW(Q,Y,W),Q.parseAsync=async(Y,W)=>wW(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>PW(Q,Y,W),Q.spa=Q.safeParseAsync,Q.encode=(Y,W)=>bW(Q,Y,W),Q.decode=(Y,W)=>EW(Q,Y,W),Q.encodeAsync=async(Y,W)=>IW(Q,Y,W),Q.decodeAsync=async(Y,W)=>TW(Q,Y,W),Q.safeEncode=(Y,W)=>SW(Q,Y,W),Q.safeDecode=(Y,W)=>RW(Q,Y,W),Q.safeEncodeAsync=async(Y,W)=>CW(Q,Y,W),Q.safeDecodeAsync=async(Y,W)=>kW(Q,Y,W),Q.refine=(Y,W)=>Q.check(fH(Y,W)),Q.superRefine=(Y)=>Q.check(lH(Y)),Q.overwrite=(Y)=>Q.check(J1(Y)),Q.optional=()=>t(Q),Q.nullable=()=>_W(Q),Q.nullish=()=>t(_W(Q)),Q.nonoptional=(Y)=>xH(Q,Y),Q.array=()=>x(Q),Q.or=(Y)=>c([Q,Y]),Q.and=(Y)=>o6(Q,Y),Q.transform=(Y)=>vQ(Q,fW(Y)),Q.default=(Y)=>CH(Q,Y),Q.prefault=(Y)=>vH(Q,Y),Q.catch=(Y)=>yH(Q,Y),Q.pipe=(Y)=>vQ(Q,Y),Q.readonly=()=>uH(Q),Q.describe=(Y)=>{let W=Q.clone();return c1.add(W,{description:Y}),W},Object.defineProperty(Q,"description",{get(){return c1.get(Q)?.description},configurable:!0}),Q.meta=(...Y)=>{if(Y.length===0)return c1.get(Q);let W=Q.clone();return c1.add(W,Y[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),yW=F("_ZodString",(Q,X)=>{l6.init(Q,X),a.init(Q,X);let Y=Q._zod.bag;Q.format=Y.format??null,Q.minLength=Y.minimum??null,Q.maxLength=Y.maximum??null,Q.regex=(...W)=>Q.check(VQ(...W)),Q.includes=(...W)=>Q.check(qQ(...W)),Q.startsWith=(...W)=>Q.check(wQ(...W)),Q.endsWith=(...W)=>Q.check(jQ(...W)),Q.min=(...W)=>Q.check(O1(...W)),Q.max=(...W)=>Q.check(i6(...W)),Q.length=(...W)=>Q.check(n6(...W)),Q.nonempty=(...W)=>Q.check(O1(1,...W)),Q.lowercase=(W)=>Q.check(ZQ(W)),Q.uppercase=(W)=>Q.check(NQ(W)),Q.trim=()=>Q.check(bQ()),Q.normalize=(...W)=>Q.check(PQ(...W)),Q.toLowerCase=()=>Q.check(EQ()),Q.toUpperCase=()=>Q.check(IQ())}),ez=F("ZodString",(Q,X)=>{l6.init(Q,X),yW.init(Q,X),Q.email=(Y)=>Q.check(xY(QH,Y)),Q.url=(Y)=>Q.check(uY(XH,Y)),Q.jwt=(Y)=>Q.check(QW(OH,Y)),Q.emoji=(Y)=>Q.check(fY(YH,Y)),Q.guid=(Y)=>Q.check(MQ(vW,Y)),Q.uuid=(Y)=>Q.check(_Y(r6,Y)),Q.uuidv4=(Y)=>Q.check(yY(r6,Y)),Q.uuidv6=(Y)=>Q.check(gY(r6,Y)),Q.uuidv7=(Y)=>Q.check(hY(r6,Y)),Q.nanoid=(Y)=>Q.check(lY(WH,Y)),Q.guid=(Y)=>Q.check(MQ(vW,Y)),Q.cuid=(Y)=>Q.check(mY(GH,Y)),Q.cuid2=(Y)=>Q.check(cY(JH,Y)),Q.ulid=(Y)=>Q.check(pY($H,Y)),Q.base64=(Y)=>Q.check(aY(FH,Y)),Q.base64url=(Y)=>Q.check(sY(UH,Y)),Q.xid=(Y)=>Q.check(iY(zH,Y)),Q.ksuid=(Y)=>Q.check(nY(HH,Y)),Q.ipv4=(Y)=>Q.check(dY(BH,Y)),Q.ipv6=(Y)=>Q.check(rY(KH,Y)),Q.cidrv4=(Y)=>Q.check(oY(DH,Y)),Q.cidrv6=(Y)=>Q.check(tY(AH,Y)),Q.e164=(Y)=>Q.check(eY(LH,Y)),Q.datetime=(Y)=>Q.check(TQ(Y)),Q.date=(Y)=>Q.check(SQ(Y)),Q.time=(Y)=>Q.check(RQ(Y)),Q.duration=(Y)=>Q.check(CQ(Y))});function A(Q){return vY(ez,Q)}var d=F("ZodStringFormat",(Q,X)=>{i.init(Q,X),yW.init(Q,X)}),QH=F("ZodEmail",(Q,X)=>{f8.init(Q,X),d.init(Q,X)});var vW=F("ZodGUID",(Q,X)=>{h8.init(Q,X),d.init(Q,X)});var r6=F("ZodUUID",(Q,X)=>{u8.init(Q,X),d.init(Q,X)});var XH=F("ZodURL",(Q,X)=>{l8.init(Q,X),d.init(Q,X)});var YH=F("ZodEmoji",(Q,X)=>{m8.init(Q,X),d.init(Q,X)});var WH=F("ZodNanoID",(Q,X)=>{c8.init(Q,X),d.init(Q,X)});var GH=F("ZodCUID",(Q,X)=>{p8.init(Q,X),d.init(Q,X)});var JH=F("ZodCUID2",(Q,X)=>{i8.init(Q,X),d.init(Q,X)});var $H=F("ZodULID",(Q,X)=>{n8.init(Q,X),d.init(Q,X)});var zH=F("ZodXID",(Q,X)=>{d8.init(Q,X),d.init(Q,X)});var HH=F("ZodKSUID",(Q,X)=>{r8.init(Q,X),d.init(Q,X)});var BH=F("ZodIPv4",(Q,X)=>{e8.init(Q,X),d.init(Q,X)});var KH=F("ZodIPv6",(Q,X)=>{QY.init(Q,X),d.init(Q,X)});var DH=F("ZodCIDRv4",(Q,X)=>{XY.init(Q,X),d.init(Q,X)});var AH=F("ZodCIDRv6",(Q,X)=>{YY.init(Q,X),d.init(Q,X)});var FH=F("ZodBase64",(Q,X)=>{GY.init(Q,X),d.init(Q,X)});var UH=F("ZodBase64URL",(Q,X)=>{JY.init(Q,X),d.init(Q,X)});var LH=F("ZodE164",(Q,X)=>{$Y.init(Q,X),d.init(Q,X)});var OH=F("ZodJWT",(Q,X)=>{zY.init(Q,X),d.init(Q,X)});var gW=F("ZodNumber",(Q,X)=>{UQ.init(Q,X),a.init(Q,X),Q.gt=(W,G)=>Q.check(c6(W,G)),Q.gte=(W,G)=>Q.check(i1(W,G)),Q.min=(W,G)=>Q.check(i1(W,G)),Q.lt=(W,G)=>Q.check(m6(W,G)),Q.lte=(W,G)=>Q.check(p1(W,G)),Q.max=(W,G)=>Q.check(p1(W,G)),Q.int=(W)=>Q.check(xW(W)),Q.safe=(W)=>Q.check(xW(W)),Q.positive=(W)=>Q.check(c6(0,W)),Q.nonnegative=(W)=>Q.check(i1(0,W)),Q.negative=(W)=>Q.check(m6(0,W)),Q.nonpositive=(W)=>Q.check(p1(0,W)),Q.multipleOf=(W,G)=>Q.check(p6(W,G)),Q.step=(W,G)=>Q.check(p6(W,G)),Q.finite=()=>Q;let Y=Q._zod.bag;Q.minValue=Math.max(Y.minimum??Number.NEGATIVE_INFINITY,Y.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(Y.maximum??Number.POSITIVE_INFINITY,Y.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(Y.format??"").includes("int")||Number.isSafeInteger(Y.multipleOf??0.5),Q.isFinite=!0,Q.format=Y.format??null});function f(Q){return JW(gW,Q)}var MH=F("ZodNumberFormat",(Q,X)=>{HY.init(Q,X),gW.init(Q,X)});function xW(Q){return $W(MH,Q)}var VH=F("ZodBoolean",(Q,X)=>{BY.init(Q,X),a.init(Q,X)});function e(Q){return zW(VH,Q)}var ZH=F("ZodNull",(Q,X)=>{KY.init(Q,X),a.init(Q,X)});function xQ(Q){return HW(ZH,Q)}var NH=F("ZodUnknown",(Q,X)=>{DY.init(Q,X),a.init(Q,X)});function r(){return BW(NH)}var qH=F("ZodNever",(Q,X)=>{AY.init(Q,X),a.init(Q,X)});function wH(Q){return KW(qH,Q)}var jH=F("ZodArray",(Q,X)=>{FY.init(Q,X),a.init(Q,X),Q.element=X.element,Q.min=(Y,W)=>Q.check(O1(Y,W)),Q.nonempty=(Y)=>Q.check(O1(1,Y)),Q.max=(Y,W)=>Q.check(i6(Y,W)),Q.length=(Y,W)=>Q.check(n6(Y,W)),Q.unwrap=()=>Q.element});function x(Q,X){return DW(jH,Q,X)}var hW=F("ZodObject",(Q,X)=>{OY.init(Q,X),a.init(Q,X),h.defineLazy(Q,"shape",()=>{return X.shape}),Q.keyof=()=>K0(Object.keys(Q._zod.def.shape)),Q.catchall=(Y)=>Q.clone({...Q._zod.def,catchall:Y}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:r()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:r()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:wH()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(Y)=>{return h.extend(Q,Y)},Q.safeExtend=(Y)=>{return h.safeExtend(Q,Y)},Q.merge=(Y)=>h.merge(Q,Y),Q.pick=(Y)=>h.pick(Q,Y),Q.omit=(Y)=>h.omit(Q,Y),Q.partial=(...Y)=>h.partial(lW,Q,Y[0]),Q.required=(...Y)=>h.required(mW,Q,Y[0])});function q(Q,X){let Y={type:"object",shape:Q??{},...h.normalizeParams(X)};return new hW(Y)}function z0(Q,X){return new hW({type:"object",shape:Q,catchall:r(),...h.normalizeParams(X)})}var uW=F("ZodUnion",(Q,X)=>{LQ.init(Q,X),a.init(Q,X),Q.options=X.options});function c(Q,X){return new uW({type:"union",options:Q,...h.normalizeParams(X)})}var PH=F("ZodDiscriminatedUnion",(Q,X)=>{uW.init(Q,X),MY.init(Q,X)});function _Q(Q,X,Y){return new PH({type:"union",options:X,discriminator:Q,...h.normalizeParams(Y)})}var bH=F("ZodIntersection",(Q,X)=>{VY.init(Q,X),a.init(Q,X)});function o6(Q,X){return new bH({type:"intersection",left:Q,right:X})}var EH=F("ZodRecord",(Q,X)=>{ZY.init(Q,X),a.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function o(Q,X,Y){return new EH({type:"record",keyType:Q,valueType:X,...h.normalizeParams(Y)})}var kQ=F("ZodEnum",(Q,X)=>{NY.init(Q,X),a.init(Q,X),Q.enum=X.entries,Q.options=Object.values(X.entries);let Y=new Set(Object.keys(X.entries));Q.extract=(W,G)=>{let J={};for(let $ of W)if(Y.has($))J[$]=X.entries[$];else throw Error(`Key ${$} not found in enum`);return new kQ({...X,checks:[],...h.normalizeParams(G),entries:J})},Q.exclude=(W,G)=>{let J={...X.entries};for(let $ of W)if(Y.has($))delete J[$];else throw Error(`Key ${$} not found in enum`);return new kQ({...X,checks:[],...h.normalizeParams(G),entries:J})}});function K0(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new kQ({type:"enum",entries:Y,...h.normalizeParams(X)})}var IH=F("ZodLiteral",(Q,X)=>{qY.init(Q,X),a.init(Q,X),Q.values=new Set(X.values),Object.defineProperty(Q,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function j(Q,X){return new IH({type:"literal",values:Array.isArray(Q)?Q:[Q],...h.normalizeParams(X)})}var TH=F("ZodTransform",(Q,X)=>{wY.init(Q,X),a.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new x1(Q.constructor.name);Y.addIssue=(J)=>{if(typeof J==="string")Y.issues.push(h.issue(J,Y.value,X));else{let $=J;if($.fatal)$.continue=!1;$.code??($.code="custom"),$.input??($.input=Y.value),$.inst??($.inst=Q),Y.issues.push(h.issue($))}};let G=X.transform(Y.value,Y);if(G instanceof Promise)return G.then((J)=>{return Y.value=J,Y});return Y.value=G,Y}});function fW(Q){return new TH({type:"transform",transform:Q})}var lW=F("ZodOptional",(Q,X)=>{jY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function t(Q){return new lW({type:"optional",innerType:Q})}var SH=F("ZodNullable",(Q,X)=>{PY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function _W(Q){return new SH({type:"nullable",innerType:Q})}var RH=F("ZodDefault",(Q,X)=>{bY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function CH(Q,X){return new RH({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var kH=F("ZodPrefault",(Q,X)=>{EY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function vH(Q,X){return new kH({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var mW=F("ZodNonOptional",(Q,X)=>{IY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function xH(Q,X){return new mW({type:"nonoptional",innerType:Q,...h.normalizeParams(X)})}var _H=F("ZodCatch",(Q,X)=>{TY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function yH(Q,X){return new _H({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var gH=F("ZodPipe",(Q,X)=>{SY.init(Q,X),a.init(Q,X),Q.in=X.in,Q.out=X.out});function vQ(Q,X){return new gH({type:"pipe",in:Q,out:X})}var hH=F("ZodReadonly",(Q,X)=>{RY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function uH(Q){return new hH({type:"readonly",innerType:Q})}var cW=F("ZodCustom",(Q,X)=>{CY.init(Q,X),a.init(Q,X)});function pW(Q,X){return AW(cW,Q??(()=>!0),X)}function fH(Q,X={}){return FW(cW,Q,X)}function lH(Q){return UW(Q)}function yQ(Q,X){return vQ(fW(Q),X)}M0(OQ());var gQ="2025-11-25";var iW=[gQ,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],o0="io.modelcontextprotocol/related-task",a6="2.0",X0=pW((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),nW=c([A(),f().int()]),dW=A(),cZ=z0({ttl:c([f(),xQ()]).optional(),pollInterval:f().optional()}),mH=q({ttl:f().optional()}),cH=q({taskId:A()}),hQ=z0({progressToken:nW.optional(),[o0]:cH.optional()}),O0=q({_meta:hQ.optional()}),r1=O0.extend({task:mH.optional()}),rW=(Q)=>r1.safeParse(Q).success,Y0=q({method:A(),params:O0.loose().optional()}),V0=q({_meta:hQ.optional()}),Z0=q({method:A(),params:V0.loose().optional()}),W0=z0({_meta:hQ.optional()}),s6=c([A(),f().int()]),oW=q({jsonrpc:j(a6),id:s6,...Y0.shape}).strict(),uQ=(Q)=>oW.safeParse(Q).success,tW=q({jsonrpc:j(a6),...Z0.shape}).strict(),aW=(Q)=>tW.safeParse(Q).success,fQ=q({jsonrpc:j(a6),id:s6,result:W0}).strict(),o1=(Q)=>fQ.safeParse(Q).success;var _;(function(Q){Q[Q.ConnectionClosed=-32000]="ConnectionClosed",Q[Q.RequestTimeout=-32001]="RequestTimeout",Q[Q.ParseError=-32700]="ParseError",Q[Q.InvalidRequest=-32600]="InvalidRequest",Q[Q.MethodNotFound=-32601]="MethodNotFound",Q[Q.InvalidParams=-32602]="InvalidParams",Q[Q.InternalError=-32603]="InternalError",Q[Q.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(_||(_={}));var lQ=q({jsonrpc:j(a6),id:s6.optional(),error:q({code:f().int(),message:A(),data:r().optional()})}).strict();var sW=(Q)=>lQ.safeParse(Q).success;var eW=c([oW,tW,fQ,lQ]),pZ=c([fQ,lQ]),e6=W0.strict(),pH=V0.extend({requestId:s6.optional(),reason:A().optional()}),Q4=Z0.extend({method:j("notifications/cancelled"),params:pH}),iH=q({src:A(),mimeType:A().optional(),sizes:x(A()).optional(),theme:K0(["light","dark"]).optional()}),t1=q({icons:x(iH).optional()}),V1=q({name:A(),title:A().optional()}),QG=V1.extend({...V1.shape,...t1.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),nH=o6(q({applyDefaults:e().optional()}),o(A(),r())),dH=yQ((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},o6(q({form:nH.optional(),url:X0.optional()}),o(A(),r()).optional())),rH=z0({list:X0.optional(),cancel:X0.optional(),requests:z0({sampling:z0({createMessage:X0.optional()}).optional(),elicitation:z0({create:X0.optional()}).optional()}).optional()}),oH=z0({list:X0.optional(),cancel:X0.optional(),requests:z0({tools:z0({call:X0.optional()}).optional()}).optional()}),tH=q({experimental:o(A(),X0).optional(),sampling:q({context:X0.optional(),tools:X0.optional()}).optional(),elicitation:dH.optional(),roots:q({listChanged:e().optional()}).optional(),tasks:rH.optional()}),aH=O0.extend({protocolVersion:A(),capabilities:tH,clientInfo:QG}),mQ=Y0.extend({method:j("initialize"),params:aH});var sH=q({experimental:o(A(),X0).optional(),logging:X0.optional(),completions:X0.optional(),prompts:q({listChanged:e().optional()}).optional(),resources:q({subscribe:e().optional(),listChanged:e().optional()}).optional(),tools:q({listChanged:e().optional()}).optional(),tasks:oH.optional()}),eH=W0.extend({protocolVersion:A(),capabilities:sH,serverInfo:QG,instructions:A().optional()}),cQ=Z0.extend({method:j("notifications/initialized"),params:V0.optional()});var X4=Y0.extend({method:j("ping"),params:O0.optional()}),Q3=q({progress:f(),total:t(f()),message:t(A())}),X3=q({...V0.shape,...Q3.shape,progressToken:nW}),Y4=Z0.extend({method:j("notifications/progress"),params:X3}),Y3=O0.extend({cursor:dW.optional()}),a1=Y0.extend({params:Y3.optional()}),s1=W0.extend({nextCursor:dW.optional()}),W3=K0(["working","input_required","completed","failed","cancelled"]),e1=q({taskId:A(),status:W3,ttl:c([f(),xQ()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:t(f()),statusMessage:t(A())}),Z1=W0.extend({task:e1}),G3=V0.merge(e1),Q6=Z0.extend({method:j("notifications/tasks/status"),params:G3}),W4=Y0.extend({method:j("tasks/get"),params:O0.extend({taskId:A()})}),G4=W0.merge(e1),J4=Y0.extend({method:j("tasks/result"),params:O0.extend({taskId:A()})}),iZ=W0.loose(),$4=a1.extend({method:j("tasks/list")}),z4=s1.extend({tasks:x(e1)}),H4=Y0.extend({method:j("tasks/cancel"),params:O0.extend({taskId:A()})}),XG=W0.merge(e1),YG=q({uri:A(),mimeType:t(A()),_meta:o(A(),r()).optional()}),WG=YG.extend({text:A()}),pQ=A().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),GG=YG.extend({blob:pQ}),X6=K0(["user","assistant"]),N1=q({audience:x(X6).optional(),priority:f().min(0).max(1).optional(),lastModified:d1.datetime({offset:!0}).optional()}),JG=q({...V1.shape,...t1.shape,uri:A(),description:t(A()),mimeType:t(A()),annotations:N1.optional(),_meta:t(z0({}))}),J3=q({...V1.shape,...t1.shape,uriTemplate:A(),description:t(A()),mimeType:t(A()),annotations:N1.optional(),_meta:t(z0({}))}),iQ=a1.extend({method:j("resources/list")}),$3=s1.extend({resources:x(JG)}),z3=a1.extend({method:j("resources/templates/list")}),H3=s1.extend({resourceTemplates:x(J3)}),nQ=O0.extend({uri:A()}),B3=nQ,dQ=Y0.extend({method:j("resources/read"),params:B3}),K3=W0.extend({contents:x(c([WG,GG]))}),D3=Z0.extend({method:j("notifications/resources/list_changed"),params:V0.optional()}),A3=nQ,F3=Y0.extend({method:j("resources/subscribe"),params:A3}),U3=nQ,L3=Y0.extend({method:j("resources/unsubscribe"),params:U3}),O3=V0.extend({uri:A()}),M3=Z0.extend({method:j("notifications/resources/updated"),params:O3}),V3=q({name:A(),description:t(A()),required:t(e())}),Z3=q({...V1.shape,...t1.shape,description:t(A()),arguments:t(x(V3)),_meta:t(z0({}))}),N3=a1.extend({method:j("prompts/list")}),q3=s1.extend({prompts:x(Z3)}),w3=O0.extend({name:A(),arguments:o(A(),A()).optional()}),j3=Y0.extend({method:j("prompts/get"),params:w3}),rQ=q({type:j("text"),text:A(),annotations:N1.optional(),_meta:o(A(),r()).optional()}),oQ=q({type:j("image"),data:pQ,mimeType:A(),annotations:N1.optional(),_meta:o(A(),r()).optional()}),tQ=q({type:j("audio"),data:pQ,mimeType:A(),annotations:N1.optional(),_meta:o(A(),r()).optional()}),P3=q({type:j("tool_use"),name:A(),id:A(),input:o(A(),r()),_meta:o(A(),r()).optional()}),b3=q({type:j("resource"),resource:c([WG,GG]),annotations:N1.optional(),_meta:o(A(),r()).optional()}),E3=JG.extend({type:j("resource_link")}),aQ=c([rQ,oQ,tQ,E3,b3]),I3=q({role:X6,content:aQ}),T3=W0.extend({description:A().optional(),messages:x(I3)}),S3=Z0.extend({method:j("notifications/prompts/list_changed"),params:V0.optional()}),R3=q({title:A().optional(),readOnlyHint:e().optional(),destructiveHint:e().optional(),idempotentHint:e().optional(),openWorldHint:e().optional()}),C3=q({taskSupport:K0(["required","optional","forbidden"]).optional()}),$G=q({...V1.shape,...t1.shape,description:A().optional(),inputSchema:q({type:j("object"),properties:o(A(),X0).optional(),required:x(A()).optional()}).catchall(r()),outputSchema:q({type:j("object"),properties:o(A(),X0).optional(),required:x(A()).optional()}).catchall(r()).optional(),annotations:R3.optional(),execution:C3.optional(),_meta:o(A(),r()).optional()}),sQ=a1.extend({method:j("tools/list")}),k3=s1.extend({tools:x($G)}),B4=W0.extend({content:x(aQ).default([]),structuredContent:o(A(),r()).optional(),isError:e().optional()}),nZ=B4.or(W0.extend({toolResult:r()})),v3=r1.extend({name:A(),arguments:o(A(),r()).optional()}),Y6=Y0.extend({method:j("tools/call"),params:v3}),x3=Z0.extend({method:j("notifications/tools/list_changed"),params:V0.optional()}),dZ=q({autoRefresh:e().default(!0),debounceMs:f().int().nonnegative().default(300)}),W6=K0(["debug","info","notice","warning","error","critical","alert","emergency"]),_3=O0.extend({level:W6}),eQ=Y0.extend({method:j("logging/setLevel"),params:_3}),y3=V0.extend({level:W6,logger:A().optional(),data:r()}),g3=Z0.extend({method:j("notifications/message"),params:y3}),h3=q({name:A().optional()}),u3=q({hints:x(h3).optional(),costPriority:f().min(0).max(1).optional(),speedPriority:f().min(0).max(1).optional(),intelligencePriority:f().min(0).max(1).optional()}),f3=q({mode:K0(["auto","required","none"]).optional()}),l3=q({type:j("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:x(aQ).default([]),structuredContent:q({}).loose().optional(),isError:e().optional(),_meta:o(A(),r()).optional()}),m3=_Q("type",[rQ,oQ,tQ]),t6=_Q("type",[rQ,oQ,tQ,P3,l3]),c3=q({role:X6,content:c([t6,x(t6)]),_meta:o(A(),r()).optional()}),p3=r1.extend({messages:x(c3),modelPreferences:u3.optional(),systemPrompt:A().optional(),includeContext:K0(["none","thisServer","allServers"]).optional(),temperature:f().optional(),maxTokens:f().int(),stopSequences:x(A()).optional(),metadata:X0.optional(),tools:x($G).optional(),toolChoice:f3.optional()}),i3=Y0.extend({method:j("sampling/createMessage"),params:p3}),Q9=W0.extend({model:A(),stopReason:t(K0(["endTurn","stopSequence","maxTokens"]).or(A())),role:X6,content:m3}),X9=W0.extend({model:A(),stopReason:t(K0(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:X6,content:c([t6,x(t6)])}),n3=q({type:j("boolean"),title:A().optional(),description:A().optional(),default:e().optional()}),d3=q({type:j("string"),title:A().optional(),description:A().optional(),minLength:f().optional(),maxLength:f().optional(),format:K0(["email","uri","date","date-time"]).optional(),default:A().optional()}),r3=q({type:K0(["number","integer"]),title:A().optional(),description:A().optional(),minimum:f().optional(),maximum:f().optional(),default:f().optional()}),o3=q({type:j("string"),title:A().optional(),description:A().optional(),enum:x(A()),default:A().optional()}),t3=q({type:j("string"),title:A().optional(),description:A().optional(),oneOf:x(q({const:A(),title:A()})),default:A().optional()}),a3=q({type:j("string"),title:A().optional(),description:A().optional(),enum:x(A()),enumNames:x(A()).optional(),default:A().optional()}),s3=c([o3,t3]),e3=q({type:j("array"),title:A().optional(),description:A().optional(),minItems:f().optional(),maxItems:f().optional(),items:q({type:j("string"),enum:x(A())}),default:x(A()).optional()}),QB=q({type:j("array"),title:A().optional(),description:A().optional(),minItems:f().optional(),maxItems:f().optional(),items:q({anyOf:x(q({const:A(),title:A()}))}),default:x(A()).optional()}),XB=c([e3,QB]),YB=c([a3,s3,XB]),WB=c([YB,n3,d3,r3]),GB=r1.extend({mode:j("form").optional(),message:A(),requestedSchema:q({type:j("object"),properties:o(A(),WB),required:x(A()).optional()})}),JB=r1.extend({mode:j("url"),message:A(),elicitationId:A(),url:A().url()}),$B=c([GB,JB]),zB=Y0.extend({method:j("elicitation/create"),params:$B}),HB=V0.extend({elicitationId:A()}),BB=Z0.extend({method:j("notifications/elicitation/complete"),params:HB}),K4=W0.extend({action:K0(["accept","decline","cancel"]),content:yQ((Q)=>Q===null?void 0:Q,o(A(),c([A(),f(),e(),x(A())])).optional())}),KB=q({type:j("ref/resource"),uri:A()});var DB=q({type:j("ref/prompt"),name:A()}),AB=O0.extend({ref:c([DB,KB]),argument:q({name:A(),value:A()}),context:q({arguments:o(A(),A()).optional()}).optional()}),FB=Y0.extend({method:j("completion/complete"),params:AB});var UB=W0.extend({completion:z0({values:x(A()).max(100),total:t(f().int()),hasMore:t(e())})}),LB=q({uri:A().startsWith("file://"),name:A().optional(),_meta:o(A(),r()).optional()}),OB=Y0.extend({method:j("roots/list"),params:O0.optional()}),Y9=W0.extend({roots:x(LB)}),MB=Z0.extend({method:j("notifications/roots/list_changed"),params:V0.optional()}),rZ=c([X4,mQ,FB,eQ,j3,N3,iQ,z3,dQ,F3,L3,Y6,sQ,W4,J4,$4,H4]),oZ=c([Q4,Y4,cQ,MB,Q6]),tZ=c([e6,Q9,X9,K4,Y9,G4,z4,Z1]),aZ=c([X4,i3,zB,OB,W4,J4,$4,H4]),sZ=c([Q4,Y4,g3,M3,D3,x3,S3,Q6,BB]),eZ=c([e6,eH,UB,T3,q3,$3,H3,K3,B4,k3,G4,z4,Z1]);class C extends Error{constructor(Q,X,Y){super(`MCP error ${Q}: ${X}`);this.code=Q,this.data=Y,this.name="McpError"}static fromError(Q,X,Y){if(Q===_.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new zG(W.elicitations,X)}return new C(Q,X,Y)}}class zG extends C{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(_.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function t0(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var VB=Symbol("Let zodToJsonSchema decide on which parser to use");var kN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function W9(Q){let Y=d6(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=LW(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function G9(Q,X){let Y=r0(Q,X);if(!Y.success)throw Y.error;return Y.data}var PB=60000;class J9{constructor(Q){if(this._options=Q,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Q4,(X)=>{this._oncancel(X)}),this.setNotificationHandler(Y4,(X)=>{this._onprogress(X)}),this.setRequestHandler(X4,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(W4,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(_.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(J4,async(X,Y)=>{let W=async()=>{let G=X.params.taskId;if(this._taskMessageQueue){let $;while($=await this._taskMessageQueue.dequeue(G,Y.sessionId)){if($.type==="response"||$.type==="error"){let z=$.message,H=z.id,B=this._requestResolvers.get(H);if(B)if(this._requestResolvers.delete(H),$.type==="response")B(z);else{let K=z,D=new C(K.error.code,K.error.message,K.error.data);B(D)}else{let K=$.type==="response"?"Response":"Error";this._onerror(Error(`${K} handler missing for request ${H}`))}continue}await this._transport?.send($.message,{relatedRequestId:Y.requestId})}}let J=await this._taskStore.getTask(G,Y.sessionId);if(!J)throw new C(_.InvalidParams,`Task not found: ${G}`);if(!t0(J.status))return await this._waitForTaskUpdate(G,Y.signal),await W();if(t0(J.status)){let $=await this._taskStore.getTaskResult(G,Y.sessionId);return this._clearTaskQueue(G),{...$,_meta:{...$._meta,[o0]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler($4,async(X,Y)=>{try{let{tasks:W,nextCursor:G}=await this._taskStore.listTasks(X.params?.cursor,Y.sessionId);return{tasks:W,nextCursor:G,_meta:{}}}catch(W){throw new C(_.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(H4,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(_.InvalidParams,`Task not found: ${X.params.taskId}`);if(t0(W.status))throw new C(_.InvalidParams,`Cannot cancel task in terminal status: ${W.status}`);await this._taskStore.updateTaskStatus(X.params.taskId,"cancelled","Client cancelled task execution.",Y.sessionId),this._clearTaskQueue(X.params.taskId);let G=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!G)throw new C(_.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof C)throw W;throw new C(_.InvalidRequest,`Failed to cancel task: ${W instanceof Error?W.message:String(W)}`)}})}async _oncancel(Q){if(!Q.params.requestId)return;this._requestHandlerAbortControllers.get(Q.params.requestId)?.abort(Q.params.reason)}_setupTimeout(Q,X,Y,W,G=!1){this._timeoutInfo.set(Q,{timeoutId:setTimeout(W,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Y,resetTimeoutOnProgress:G,onTimeout:W})}_resetTimeout(Q){let X=this._timeoutInfo.get(Q);if(!X)return!1;let Y=Date.now()-X.startTime;if(X.maxTotalTimeout&&Y>=X.maxTotalTimeout)throw this._timeoutInfo.delete(Q),C.fromError(_.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:Y});return clearTimeout(X.timeoutId),X.timeoutId=setTimeout(X.onTimeout,X.timeout),!0}_cleanupTimeout(Q){let X=this._timeoutInfo.get(Q);if(X)clearTimeout(X.timeoutId),this._timeoutInfo.delete(Q)}async connect(Q){this._transport=Q;let X=this.transport?.onclose;this._transport.onclose=()=>{X?.(),this._onclose()};let Y=this.transport?.onerror;this._transport.onerror=(G)=>{Y?.(G),this._onerror(G)};let W=this._transport?.onmessage;this._transport.onmessage=(G,J)=>{if(W?.(G,J),o1(G)||sW(G))this._onresponse(G);else if(uQ(G))this._onrequest(G,J);else if(aW(G))this._onnotification(G);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},await this._transport.start()}_onclose(){let Q=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let X=C.fromError(_.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let Y of Q.values())Y(X)}_onerror(Q){this.onerror?.(Q)}_onnotification(Q){let X=this._notificationHandlers.get(Q.method)??this.fallbackNotificationHandler;if(X===void 0)return;Promise.resolve().then(()=>X(Q)).catch((Y)=>this._onerror(Error(`Uncaught error in notification handler: ${Y}`)))}_onrequest(Q,X){let Y=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler,W=this._transport,G=Q.params?._meta?.[o0]?.taskId;if(Y===void 0){let B={jsonrpc:"2.0",id:Q.id,error:{code:_.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:B,timestamp:Date.now()},W?.sessionId).catch((K)=>this._onerror(Error(`Failed to enqueue error response: ${K}`)));else W?.send(B).catch((K)=>this._onerror(Error(`Failed to send an error response: ${K}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let $=rW(Q.params)?Q.params.task:void 0,z=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,H={signal:J.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(B)=>{let K={relatedRequestId:Q.id};if(G)K.relatedTask={taskId:G};await this.notification(B,K)},sendRequest:async(B,K,D)=>{let U={...D,relatedRequestId:Q.id};if(G&&!U.relatedTask)U.relatedTask={taskId:G};let L=U.relatedTask?.taskId??G;if(L&&z)await z.updateTaskStatus(L,"input_required");return await this.request(B,K,U)},authInfo:X?.authInfo,requestId:Q.id,requestInfo:X?.requestInfo,taskId:G,taskStore:z,taskRequestedTtl:$?.ttl,closeSSEStream:X?.closeSSEStream,closeStandaloneSSEStream:X?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if($)this.assertTaskHandlerCapability(Q.method)}).then(()=>Y(Q,H)).then(async(B)=>{if(J.signal.aborted)return;let K={result:B,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:K,timestamp:Date.now()},W?.sessionId);else await W?.send(K)},async(B)=>{if(J.signal.aborted)return;let K={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(B.code)?B.code:_.InternalError,message:B.message??"Internal error",...B.data!==void 0&&{data:B.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:K,timestamp:Date.now()},W?.sessionId);else await W?.send(K)}).catch((B)=>this._onerror(Error(`Failed to send response: ${B}`))).finally(()=>{this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(Q){let{progressToken:X,...Y}=Q.params,W=Number(X),G=this._progressHandlers.get(W);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(Q)}`));return}let J=this._responseHandlers.get(W),$=this._timeoutInfo.get(W);if($&&J&&$.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(z){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),J(z);return}G(Y)}_onresponse(Q){let X=Number(Q.id),Y=this._requestResolvers.get(X);if(Y){if(this._requestResolvers.delete(X),o1(Q))Y(Q);else{let J=new C(Q.error.code,Q.error.message,Q.error.data);Y(J)}return}let W=this._responseHandlers.get(X);if(W===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(Q)}`));return}this._responseHandlers.delete(X),this._cleanupTimeout(X);let G=!1;if(o1(Q)&&Q.result&&typeof Q.result==="object"){let J=Q.result;if(J.task&&typeof J.task==="object"){let $=J.task;if(typeof $.taskId==="string")G=!0,this._taskProgressTokens.set($.taskId,X)}}if(!G)this._progressHandlers.delete(X);if(o1(Q))W(Q);else{let J=C.fromError(Q.error.code,Q.error.message,Q.error.data);W(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(Q,X,Y){let{task:W}=Y??{};if(!W){try{yield{type:"result",result:await this.request(Q,X,Y)}}catch(J){yield{type:"error",error:J instanceof C?J:new C(_.InternalError,String(J))}}return}let G;try{let J=await this.request(Q,Z1,Y);if(J.task)G=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new C(_.InternalError,"Task creation did not return a task");while(!0){let $=await this.getTask({taskId:G},Y);if(yield{type:"taskStatus",task:$},t0($.status)){if($.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};else if($.status==="failed")yield{type:"error",error:new C(_.InternalError,`Task ${G} failed`)};else if($.status==="cancelled")yield{type:"error",error:new C(_.InternalError,`Task ${G} was cancelled`)};return}if($.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};return}let z=$.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((H)=>setTimeout(H,z)),Y?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof C?J:new C(_.InternalError,String(J))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J,task:$,relatedTask:z}=Y??{};return new Promise((H,B)=>{let K=(V)=>{B(V)};if(!this._transport){K(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),$)this.assertTaskCapability(Q.method)}catch(V){K(V);return}Y?.signal?.throwIfAborted();let D=this._requestMessageId++,U={...Q,jsonrpc:"2.0",id:D};if(Y?.onprogress)this._progressHandlers.set(D,Y.onprogress),U.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:D}};if($)U.params={...U.params,task:$};if(z)U.params={...U.params,_meta:{...U.params?._meta||{},[o0]:z}};let L=(V)=>{this._responseHandlers.delete(D),this._progressHandlers.delete(D),this._cleanupTimeout(D),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:D,reason:String(V)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let T=V instanceof C?V:new C(_.RequestTimeout,String(V));B(T)};this._responseHandlers.set(D,(V)=>{if(Y?.signal?.aborted)return;if(V instanceof Error)return B(V);try{let T=r0(X,V.result);if(!T.success)B(T.error);else H(T.data)}catch(T){B(T)}}),Y?.signal?.addEventListener("abort",()=>{L(Y?.signal?.reason)});let O=Y?.timeout??PB,M=()=>L(C.fromError(_.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(D,O,Y?.maxTotalTimeout,M,Y?.resetTimeoutOnProgress??!1);let Z=z?.taskId;if(Z){let V=(T)=>{let E=this._responseHandlers.get(D);if(E)E(T);else this._onerror(Error(`Response handler missing for side-channeled request ${D}`))};this._requestResolvers.set(D,V),this._enqueueTaskMessage(Z,{type:"request",message:U,timestamp:Date.now()}).catch((T)=>{this._cleanupTimeout(D),B(T)})}else this._transport.send(U,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((V)=>{this._cleanupTimeout(D),B(V)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},G4,X)}async getTaskResult(Q,X,Y){return this.request({method:"tasks/result",params:Q},X,Y)}async listTasks(Q,X){return this.request({method:"tasks/list",params:Q},z4,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},XG,X)}async notification(Q,X){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let Y=X?.relatedTask?.taskId;if(Y){let $={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[o0]:X.relatedTask}}};await this._enqueueTaskMessage(Y,{type:"notification",message:$,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!X?.relatedRequestId&&!X?.relatedTask){if(this._pendingDebouncedNotifications.has(Q.method))return;this._pendingDebouncedNotifications.add(Q.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(Q.method),!this._transport)return;let $={...Q,jsonrpc:"2.0"};if(X?.relatedTask)$={...$,params:{...$.params,_meta:{...$.params?._meta||{},[o0]:X.relatedTask}}};this._transport?.send($,X).catch((z)=>this._onerror(z))});return}let J={...Q,jsonrpc:"2.0"};if(X?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[o0]:X.relatedTask}}};await this._transport.send(J,X)}setRequestHandler(Q,X){let Y=W9(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,G)=>{let J=G9(Q,W);return Promise.resolve(X(J,G))})}removeRequestHandler(Q){this._requestHandlers.delete(Q)}assertCanSetRequestHandler(Q){if(this._requestHandlers.has(Q))throw Error(`A request handler for ${Q} already exists, which would be overridden`)}setNotificationHandler(Q,X){let Y=W9(Q);this._notificationHandlers.set(Y,(W)=>{let G=G9(Q,W);return Promise.resolve(X(G))})}removeNotificationHandler(Q){this._notificationHandlers.delete(Q)}_cleanupTaskProgressHandler(Q){let X=this._taskProgressTokens.get(Q);if(X!==void 0)this._progressHandlers.delete(X),this._taskProgressTokens.delete(Q)}async _enqueueTaskMessage(Q,X,Y){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let W=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(Q,X,Y,W)}async _clearTaskQueue(Q,X){if(this._taskMessageQueue){let Y=await this._taskMessageQueue.dequeueAll(Q,X);for(let W of Y)if(W.type==="request"&&uQ(W.message)){let G=W.message.id,J=this._requestResolvers.get(G);if(J)J(new C(_.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(G);else this._onerror(Error(`Resolver missing for request ${G} during task ${Q} cleanup`))}}}async _waitForTaskUpdate(Q,X){let Y=this._options?.defaultTaskPollInterval??1000;try{let W=await this._taskStore?.getTask(Q);if(W?.pollInterval)Y=W.pollInterval}catch{}return new Promise((W,G)=>{if(X.aborted){G(new C(_.InvalidRequest,"Request cancelled"));return}let J=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout(J),G(new C(_.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(Q,X){let Y=this._taskStore;if(!Y)throw Error("No task store configured");return{createTask:async(W)=>{if(!Q)throw Error("No request provided");return await Y.createTask(W,Q.id,{method:Q.method,params:Q.params},X)},getTask:async(W)=>{let G=await Y.getTask(W,X);if(!G)throw new C(_.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,J)=>{await Y.storeTaskResult(W,G,J,X);let $=await Y.getTask(W,X);if($){let z=Q6.parse({method:"notifications/tasks/status",params:$});if(await this.notification(z),t0($.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return Y.getTaskResult(W,X)},updateTaskStatus:async(W,G,J)=>{let $=await Y.getTask(W,X);if(!$)throw new C(_.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(t0($.status))throw new C(_.InvalidParams,`Cannot update task "${W}" from terminal status "${$.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await Y.updateTaskStatus(W,G,J,X);let z=await Y.getTask(W,X);if(z){let H=Q6.parse({method:"notifications/tasks/status",params:z});if(await this.notification(H),t0(z.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function HG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function BG(Q,X){let Y={...Q};for(let W in X){let G=W,J=X[G];if(J===void 0)continue;let $=Y[G];if(HG($)&&HG(J))Y[G]={...$,...J};else Y[G]=J}return Y}var f$=ZX(e9(),1),l$=ZX(u$(),1);function vM(){let Q=new f$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return l$.default(Q),Q}class BX{constructor(Q){this._ajv=Q??vM()}getValidator(Q){let X="$id"in Q&&typeof Q.$id==="string"?this._ajv.getSchema(Q.$id)??this._ajv.compile(Q):this._ajv.compile(Q);return(Y)=>{if(X(Y))return{valid:!0,data:Y,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(X.errors)}}}}class KX{constructor(Q){this._server=Q}requestStream(Q,X,Y){return this._server.requestStream(Q,X,Y)}async getTask(Q,X){return this._server.getTask({taskId:Q},X)}async getTaskResult(Q,X,Y){return this._server.getTaskResult({taskId:Q},X,Y)}async listTasks(Q,X){return this._server.listTasks(Q?{cursor:Q}:void 0,X)}async cancelTask(Q,X){return this._server.cancelTask({taskId:Q},X)}}function m$(Q,X,Y){if(!Q)throw Error(`${Y} does not support task creation (required for ${X})`);switch(X){case"tools/call":if(!Q.tools?.call)throw Error(`${Y} does not support task creation for tools/call (required for ${X})`);break;default:break}}function c$(Q,X,Y){if(!Q)throw Error(`${Y} does not support task creation (required for ${X})`);switch(X){case"sampling/createMessage":if(!Q.sampling?.createMessage)throw Error(`${Y} does not support task creation for sampling/createMessage (required for ${X})`);break;case"elicitation/create":if(!Q.elicitation?.create)throw Error(`${Y} does not support task creation for elicitation/create (required for ${X})`);break;default:break}}class DX extends J9{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(W6.options.map((Y,W)=>[Y,W])),this.isMessageIgnored=(Y,W)=>{let G=this._loggingLevels.get(W);return G?this.LOG_LEVEL_SEVERITY.get(Y)<this.LOG_LEVEL_SEVERITY.get(G):!1},this._capabilities=X?.capabilities??{},this._instructions=X?.instructions,this._jsonSchemaValidator=X?.jsonSchemaValidator??new BX,this.setRequestHandler(mQ,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(cQ,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(eQ,async(Y,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=Y.params,$=W6.safeParse(J);if($.success)this._loggingLevels.set(G,$.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new KX(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=BG(this._capabilities,Q)}setRequestHandler(Q,X){let W=d6(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(M1(W)){let $=W;G=$._zod?.def?.value??$.value}else{let $=W;G=$._def?.value??$.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let $=async(z,H)=>{let B=r0(Y6,z);if(!B.success){let L=B.error instanceof Error?B.error.message:String(B.error);throw new C(_.InvalidParams,`Invalid tools/call request: ${L}`)}let{params:K}=B.data,D=await Promise.resolve(X(z,H));if(K.task){let L=r0(Z1,D);if(!L.success){let O=L.error instanceof Error?L.error.message:String(L.error);throw new C(_.InvalidParams,`Invalid task creation result: ${O}`)}return L.data}let U=r0(B4,D);if(!U.success){let L=U.error instanceof Error?U.error.message:String(U.error);throw new C(_.InvalidParams,`Invalid tools/call result: ${L}`)}return U.data};return super.setRequestHandler(Q,$)}return super.setRequestHandler(Q,X)}assertCapabilityForMethod(Q){switch(Q){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${Q})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${Q})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${Q})`);break;case"ping":break}}assertNotificationCapability(Q){switch(Q){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${Q})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${Q})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${Q})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${Q})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${Q})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(Q){if(!this._capabilities)return;switch(Q){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${Q})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${Q})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${Q})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${Q})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${Q})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${Q})`);break;case"ping":case"initialize":break}}assertTaskCapability(Q){c$(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;m$(this._capabilities.tasks?.requests,Q,"Server")}async _oninitialize(Q){let X=Q.params.protocolVersion;return this._clientCapabilities=Q.params.capabilities,this._clientVersion=Q.params.clientInfo,{protocolVersion:iW.includes(X)?X:gQ,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},e6)}async createMessage(Q,X){if(Q.tools||Q.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(Q.messages.length>0){let Y=Q.messages[Q.messages.length-1],W=Array.isArray(Y.content)?Y.content:[Y.content],G=W.some((H)=>H.type==="tool_result"),J=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,$=J?Array.isArray(J.content)?J.content:[J.content]:[],z=$.some((H)=>H.type==="tool_use");if(G){if(W.some((H)=>H.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!z)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(z){let H=new Set($.filter((K)=>K.type==="tool_use").map((K)=>K.id)),B=new Set(W.filter((K)=>K.type==="tool_result").map((K)=>K.toolUseId));if(H.size!==B.size||![...H].every((K)=>B.has(K)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(Q.tools)return this.request({method:"sampling/createMessage",params:Q},X9,X);return this.request({method:"sampling/createMessage",params:Q},Q9,X)}async elicitInput(Q,X){switch(Q.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let W=Q;return this.request({method:"elicitation/create",params:W},K4,X)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let W=Q.mode==="form"?Q:{...Q,mode:"form"},G=await this.request({method:"elicitation/create",params:W},K4,X);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let $=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!$.valid)throw new C(_.InvalidParams,`Elicitation response content does not match requested schema: ${$.errorMessage}`)}catch(J){if(J instanceof C)throw J;throw new C(_.InternalError,`Error validating elicitation response: ${J instanceof Error?J.message:String(J)}`)}return G}}}createElicitationCompletionNotifier(Q,X){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:Q}},X)}async listRoots(Q,X){return this.request({method:"roots/list",params:Q},Y9,X)}async sendLoggingMessage(Q,X){if(this._capabilities.logging){if(!this.isMessageIgnored(Q.level,X))return this.notification({method:"notifications/message",params:Q})}}async sendResourceUpdated(Q){return this.notification({method:"notifications/resources/updated",params:Q})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import i$ from"node:process";class AX{append(Q){this._buffer=this._buffer?Buffer.concat([this._buffer,Q]):Q}readMessage(){if(!this._buffer)return null;let Q=this._buffer.indexOf(`
|
|
29
29
|
`);if(Q===-1)return null;let X=this._buffer.toString("utf8",0,Q).replace(/\r$/,"");return this._buffer=this._buffer.subarray(Q+1),xM(X)}clear(){this._buffer=void 0}}function xM(Q){return eW.parse(JSON.parse(Q))}function p$(Q){return JSON.stringify(Q)+`
|
|
30
|
-
`}class FX{constructor(Q=i$.stdin,X=i$.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new AX,this._started=!1,this._ondata=(Y)=>{this._readBuffer.append(Y),this.processReadBuffer()},this._onerror=(Y)=>{this.onerror?.(Y)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let Q=this._readBuffer.readMessage();if(Q===null)break;this.onmessage?.(Q)}catch(Q){this.onerror?.(Q)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(Q){return new Promise((X)=>{let Y=p$(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var n$={name:"@sequenzy/mcp",version:"0.0.
|
|
30
|
+
`}class FX{constructor(Q=i$.stdin,X=i$.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new AX,this._started=!1,this._ondata=(Y)=>{this._readBuffer.append(Y),this.processReadBuffer()},this._onerror=(Y)=>{this.onerror?.(Y)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let Q=this._readBuffer.readMessage();if(Q===null)break;this.onmessage?.(Q)}catch(Q){this.onerror?.(Q)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(Q){return new Promise((X)=>{let Y=p$(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var n$={name:"@sequenzy/mcp",version:"0.0.11",mcpName:"io.github.polnikale/sequenzy-mcp",description:"Sequenzy MCP server for AI-powered email marketing automation",type:"module",bin:{"sequenzy-mcp":"dist/index.js"},main:"./dist/index.js",exports:{".":"./dist/index.js","./server.json":"./server.json"},scripts:{dev:"bun --watch src/index.ts",build:"bun build src/index.ts --outdir dist --target node --minify",start:"node dist/index.js","type-check":"tsc --noEmit",test:"bun test","test:watch":"bun test --watch",prepublishOnly:"bun run build"},dependencies:{"@modelcontextprotocol/sdk":"^1.0.0"},devDependencies:{"@types/bun":"latest","@types/node":"^22.0.0","bun-types":"latest",typescript:"^5.8.0"},files:["dist","server.json"],keywords:["sequenzy","email","mcp","ai","claude","automation"],license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/sequenzy/sequenzy.git"}};class k1 extends Error{statusCode;rawDetails;code;constructor(Q,X,Y,W){super(Q);this.statusCode=X;this.rawDetails=Y;this.code=W;this.name="McpApiError"}}function yM(Q){if(Q instanceof k1)return{message:Q.message,statusCode:Q.statusCode,code:Q.code,rawDetails:Q.rawDetails};if(Q instanceof Error)return{message:Q.message};return{message:String(Q)}}function gM(Q){let X=yM(Q),Y=X.message.trim()||"Unknown error",W=Y.toLowerCase(),G=X.rawDetails?.trim()||Y;if(X.code==="MCP_AUTH_REQUIRED"||W.includes("sequenzy_api_key environment variable is required"))return{title:"Missing MCP API key",description:"The MCP server started without a Sequenzy API key, so it cannot authenticate any tool or resource request.",howToFix:"Add `SEQUENZY_API_KEY` to the MCP server environment, or run `npx @sequenzy/setup` to configure the integration automatically.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===401||X.code==="UNAUTHORIZED")return{title:"Authentication failed",description:"The MCP server reached Sequenzy, but the current API key was rejected.",howToFix:"Replace `SEQUENZY_API_KEY` with a valid personal API key, then restart the MCP client so it reconnects with fresh credentials.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(X.statusCode===403||W.includes("access denied"))return{title:"Access denied",description:"The current API key is valid, but it does not have permission to access the requested company or action.",howToFix:"Use an API key that belongs to the right account, or select a company the key can access before retrying the tool call.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(W.includes("no company available")||W.includes("company not found"))return{title:"Company selection required",description:"The MCP server could not resolve a company for this request.",howToFix:"Call `get_account` to inspect available companies, then call `select_company`, or pass `companyId` explicitly in the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===404||W.includes("not found"))return{title:"Requested resource not found",description:"Sequenzy could not find the requested campaign, template, sequence, company, or subscriber.",howToFix:"List or fetch the resource collection first, then retry the tool with a confirmed ID or email value.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===429||W.includes("rate limit"))return{title:"Rate limited",description:"Sequenzy temporarily slowed this MCP request because too many requests were sent too quickly.",howToFix:"Wait briefly before retrying. If the client is looping, reduce retries or add backoff before the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.code==="NETWORK_ERROR"||W.includes("fetch failed"))return{title:"Network or configuration error",description:"The MCP server could not reach the Sequenzy API from this environment.",howToFix:"Check connectivity and verify `SEQUENZY_API_URL` if you override it in the MCP environment.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("unknown tool")||W.includes("unknown resource"))return{title:"Unsupported MCP request",description:"The client asked for a tool or resource name that this Sequenzy MCP server does not expose.",howToFix:"Refresh the client's tool list and call only the names returned by `list_tools` or `list_resources`.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("is required")||W.includes("invalid"))return{title:"Invalid MCP input",description:"The tool call was missing a required field or included an invalid value.",howToFix:"Review the tool schema, supply the missing argument, and retry the request with corrected input.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode&&X.statusCode>=500)return{title:"Sequenzy server error",description:"The request reached Sequenzy, but the server could not complete it successfully.",howToFix:"Retry once. If it still fails, keep the details below and consult the docs before escalating.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};return{title:"Tool execution failed",description:"The MCP server could not complete the requested operation.",howToFix:"Review the details below, adjust the tool input or credentials, and retry.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G}}function A1(Q){let X=gM(Q);return[`Sequenzy MCP error: ${X.title}`,`Description: ${X.description}`,`How to fix: ${X.howToFix}`,`Docs: ${X.docsUrl}`,`Details: ${X.details}`].join(`
|
|
31
31
|
`)}var d$=[{uri:"sequenzy://dashboard",name:"Dashboard Overview",description:"Live overview stats for the last 7 days",mimeType:"application/json"},{uri:"sequenzy://company",name:"Current Company",description:"The currently selected company, including localization settings",mimeType:"application/json"},{uri:"sequenzy://campaigns/recent",name:"Recent Campaigns",description:"Last 10 campaigns with status and basic stats",mimeType:"application/json"},{uri:"sequenzy://subscribers/recent",name:"Recent Subscribers",description:"Most recently added subscribers",mimeType:"application/json"},{uri:"sequenzy://subscribers/engaged",name:"Engaged Subscribers",description:"Most active/engaged subscribers",mimeType:"application/json"},{uri:"sequenzy://sequences",name:"Sequences",description:"All email sequences with status",mimeType:"application/json"},{uri:"sequenzy://templates",name:"Templates",description:"All available email templates with localization status",mimeType:"application/json"},{uri:"sequenzy://segments",name:"Segments",description:"All defined segments with subscriber counts",mimeType:"application/json"},{uri:"sequenzy://tags",name:"Tags",description:"All tags with usage counts",mimeType:"application/json"},{uri:"sequenzy://health",name:"Deliverability Health",description:"Email deliverability metrics and health status",mimeType:"application/json"}];async function r$(Q){try{let X;switch(Q){case"sequenzy://dashboard":X=await w("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let Y=await w("GET","/api/v1/account"),W=o4()??Y.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");X=await w("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":X=await w("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":X=await w("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":X=await w("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":X=await w("GET","/api/v1/sequences");break;case"sequenzy://templates":X=await w("GET","/api/v1/templates");break;case"sequenzy://segments":X=await w("GET","/api/v1/segments");break;case"sequenzy://tags":X=await w("GET","/api/v1/tags");break;case"sequenzy://health":X=await w("GET","/api/v1/health/deliverability");break;default:throw Error(`Unknown resource: ${Q}`)}return{contents:[{uri:Q,mimeType:"application/json",text:JSON.stringify(X,null,2)}]}}catch(X){return{contents:[{uri:Q,mimeType:"text/plain",text:A1(X)}]}}}var hM={type:"object",properties:{id:{type:"string",description:"Optional filter ID. Any stable string works; one will be generated if omitted."},field:{type:"string",enum:["status","tag","email","added","firstName","lastName","list","emailSent","emailOpened","emailClicked","emailBounced","emailComplained","attribute","stripeProduct"],description:"Filter field. Use `stripeProduct` for Stripe purchase-based segments."},operator:{type:"string",enum:["is","is_not","contains","not_contains","less_than","more_than","at_least","less_than_count","gte","lte","gt","lt"],description:"Filter operator. For `stripeProduct`, use `is` or `is_not` with a raw product ID, and `at_least` or `less_than_count` with `productId:count`."},value:{type:"string",description:"Filter value. Stripe product examples: `prod_123` for bought/didn't buy, `prod_123:3` for payment thresholds."}},required:["field","operator","value"],additionalProperties:!1};function uM(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(typeof X!=="object"||X===null)return X;let Y=X;if(typeof Y.id==="string"&&Y.id.trim()!=="")return Y;return{...Y,id:crypto.randomUUID()}})}function fM(Q){if(!Q||typeof Q!=="object")return null;let X=Q;if(X.success!==!1)return null;if(typeof X.error==="string")return Error(X.error);if(X.error&&typeof X.error==="object"&&typeof X.error.message==="string")return Error(X.error.message);if(typeof X.message==="string")return Error(X.message);return Error("The tool returned an unsuccessful response.")}function o$(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function t$(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function lM(Q){let X=new URLSearchParams;if(typeof Q.query==="string"&&Q.query.trim()!=="")X.set("query",Q.query.trim());if(Array.isArray(Q.tags)&&Q.tags.length>0)X.set("tags",Q.tags.filter((Y)=>typeof Y==="string"&&Y.trim()!=="").join(","));if(typeof Q.segmentId==="string"&&Q.segmentId.trim()!=="")X.set("segmentId",Q.segmentId);return X.set("page",String(Q.page)),X.set("limit",String(Q.pageSize)),X}async function mM(Q,X){let Y=typeof Q.limit==="number"&&Number.isFinite(Q.limit)?Math.max(1,Math.trunc(Q.limit)):void 0,W=Math.min(100,Math.max(1,Y??100)),G=[],J=1,$=0,z=0,H=0;while(!0){let K=lM({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,page:J,pageSize:W}),D=await w("GET",`/api/v1/subscribers?${K.toString()}`,void 0,X);$=D.pagination?.total??D.subscribers.length,z=D.pagination?.totalPages??1,H+=1,G.push(...D.subscribers??[]);let U=Y!==void 0&&G.length>=Y,L=D.pagination?J>=D.pagination.totalPages:(D.subscribers??[]).length<W;if(U||L)break;J+=1}let B=Y!==void 0?G.slice(0,Y):G;return{success:!0,subscribers:B,pagination:{page:1,limit:W,total:$,totalPages:z,fetchedPages:H},returned:B.length,truncated:Y!==void 0&&$>0&&B.length<$}}async function UX(Q,X){return w("GET",`/api/v1/subscribers/${encodeURIComponent(Q)}`,void 0,X)}var a$=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
|
|
32
32
|
1. Call select_company first to choose which company to work with, OR
|
|
33
33
|
2. Pass companyId explicitly in each tool call
|
|
@@ -45,7 +45,7 @@ Use cases:
|
|
|
45
45
|
- 'subscribe_form': Adding subscribers from signup forms
|
|
46
46
|
- 'event_tracking': Tracking CUSTOM events only (not payment events - those come from the integration)
|
|
47
47
|
|
|
48
|
-
Before implementing, use create_api_key to generate an API key and save it to .env as SEQUENZY_API_KEY.`,inputSchema:{type:"object",properties:{framework:{type:"string",description:"Framework/language (nextjs, express, python, etc.)"},use_case:{type:"string",description:"Use case: 'transactional' (sending emails), 'subscribe_form' (adding subscribers), 'event_tracking' (tracking CUSTOM events only - payment events should come from Stripe/Polar/etc integration)"}}}},{name:"add_subscriber",description:"Add a new subscriber to your list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to add subscriber to. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Custom attributes (name, plan, etc.)"},tags:{type:"array",items:{type:"string"},description:"Tags to apply to the subscriber"},listIds:{type:"array",items:{type:"string"},description:"List IDs to add subscriber to"}},required:["email"]}},{name:"update_subscriber",description:"Update an existing subscriber's attributes or tags",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Attributes to update"},addTags:{type:"array",items:{type:"string"},description:"Tags to add"},removeTags:{type:"array",items:{type:"string"},description:"Tags to remove"}},required:["email"]}},{name:"remove_subscriber",description:"Unsubscribe or delete a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},hardDelete:{type:"boolean",description:"If true, permanently deletes. If false, just unsubscribes."}},required:["email"]}},{name:"get_subscriber",description:"Get the full subscriber profile, including tags, list memberships, sequence enrollments, email stats, and recent activity",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"}},required:["email"]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, or segment. If you omit limit, the tool fetches all pages and returns every match.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},query:{type:"string",description:"Search query (email or name)"},tags:{type:"array",items:{type:"string"},description:"Filter by tags"},segmentId:{type:"string",description:"Filter by segment ID"},limit:{type:"number",description:"Maximum results to return. If omitted, the tool returns all matches across pages."}}}},{name:"list_tags",description:"List all tags in the account",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list tags for. If not provided, uses the currently selected company."}}}},{name:"list_lists",description:"List all subscriber lists",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list lists for. If not provided, uses the currently selected company."}}}},{name:"create_list",description:"Create a new subscriber list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the list in. If not provided, uses the currently selected company."},name:{type:"string",description:"List name"},description:{type:"string",description:"List description"}},required:["name"]}},{name:"list_segments",description:"List all segments",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list segments for. If not provided, uses the currently selected company."}}}},{name:"create_segment",description:'Create a new segment from explicit filter rules. Supports Stripe product purchase filters via `field: "stripeProduct"` with values like `prod_123` or `prod_123:3`.',inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the segment in. If not provided, uses the currently selected company."},name:{type:"string",description:"Segment name"},filters:{type:"array",items:hM,minItems:1,description:'Array of segment filters. Example Stripe purchase filter: [{"id":"filter-1","field":"stripeProduct","operator":"is","value":"prod_123"}]. Example threshold filter: [{"id":"filter-1","field":"stripeProduct","operator":"at_least","value":"prod_123:3"}].'}},required:["name","filters"]}},{name:"get_segment_count",description:"Get the number of subscribers in a segment",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID"}},required:["segmentId"]}},{name:"list_templates",description:"List all email templates, including per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_template",description:"Get a template's details, content, and all localized variants with sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"create_template",description:"Create a new email template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content"}},required:["name","subject","html"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, or `html` is required, and only those update fields are accepted.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Use this field for content updates instead of `blocks`."}},required:["templateId"],additionalProperties:!1}},{name:"delete_template",description:"Delete a template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"list_campaigns",description:"List all campaigns",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list campaigns for. If not provided, uses the currently selected company."},status:{type:"string",description:"Filter by status (draft, scheduled, sent)"}}}},{name:"get_campaign",description:"Get campaign details and stats",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"create_campaign",description:"Create a new campaign (as draft)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the campaign in. If not provided, uses the currently selected company."},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content"},templateId:{type:"string",description:"Use a template instead of html"},segmentId:{type:"string",description:"Target segment ID"}},required:["name","subject"]}},{name:"update_campaign",description:"Update a draft campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content"},replyTo:{type:"string",description:"Set reply-to using an existing reply profile email address for this company."},replyProfileId:{type:"string",description:"Set reply-to using a reply profile ID for this company."}},required:["campaignId"],additionalProperties:!1}},{name:"send_test_email",description:"Send a test email to a single address",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID to test"},to:{type:"string",description:"Email address to send test to"}},required:["campaignId","to"]}},{name:"list_sequences",description:"List all email sequences (automations)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list sequences for. If not provided, uses the currently selected company."}}}},{name:"get_sequence",description:"Get sequence details plus editable step content. The response includes sequence.emails with each step's nodeId, linked emailId, subject, previewText, and blocks.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"create_sequence",description:`Create a new email sequence. Sequenzy will automatically generate the email content using AI based on your company's brand and the goal you specify. The tool polls until emails are generated (typically 30-60 seconds).
|
|
48
|
+
Before implementing, use create_api_key to generate an API key and save it to .env as SEQUENZY_API_KEY.`,inputSchema:{type:"object",properties:{framework:{type:"string",description:"Framework/language (nextjs, express, python, etc.)"},use_case:{type:"string",description:"Use case: 'transactional' (sending emails), 'subscribe_form' (adding subscribers), 'event_tracking' (tracking CUSTOM events only - payment events should come from Stripe/Polar/etc integration)"}}}},{name:"add_subscriber",description:"Add a new subscriber to your list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to add subscriber to. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Custom attributes (name, plan, etc.)"},tags:{type:"array",items:{type:"string"},description:"Tags to apply to the subscriber"},listIds:{type:"array",items:{type:"string"},description:"List IDs to add subscriber to"}},required:["email"]}},{name:"update_subscriber",description:"Update an existing subscriber's attributes or tags",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Attributes to update"},addTags:{type:"array",items:{type:"string"},description:"Tags to add"},removeTags:{type:"array",items:{type:"string"},description:"Tags to remove"}},required:["email"]}},{name:"remove_subscriber",description:"Unsubscribe or delete a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},hardDelete:{type:"boolean",description:"If true, permanently deletes. If false, just unsubscribes."}},required:["email"]}},{name:"get_subscriber",description:"Get the full subscriber profile, including tags, list memberships, sequence enrollments, email stats, and recent activity",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"}},required:["email"]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, or segment. If you omit limit, the tool fetches all pages and returns every match.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},query:{type:"string",description:"Search query (email or name)"},tags:{type:"array",items:{type:"string"},description:"Filter by tags"},segmentId:{type:"string",description:"Filter by segment ID"},limit:{type:"number",description:"Maximum results to return. If omitted, the tool returns all matches across pages."}}}},{name:"list_tags",description:"List all tags in the account",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list tags for. If not provided, uses the currently selected company."}}}},{name:"list_lists",description:"List all subscriber lists",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list lists for. If not provided, uses the currently selected company."}}}},{name:"create_list",description:"Create a new subscriber list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the list in. If not provided, uses the currently selected company."},name:{type:"string",description:"List name"},description:{type:"string",description:"List description"}},required:["name"]}},{name:"list_segments",description:"List all segments",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list segments for. If not provided, uses the currently selected company."}}}},{name:"create_segment",description:'Create a new segment from explicit filter rules. Supports Stripe product purchase filters via `field: "stripeProduct"` with values like `prod_123` or `prod_123:3`.',inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the segment in. If not provided, uses the currently selected company."},name:{type:"string",description:"Segment name"},filterJoinOperator:{type:"string",enum:["and","or"],description:'How top-level filters combine. Use `"and"` to require every filter or `"or"` to match any filter.'},filters:{type:"array",items:hM,minItems:1,description:'Array of segment filters. Example Stripe purchase filter: [{"id":"filter-1","field":"stripeProduct","operator":"is","value":"prod_123"}]. Example threshold filter: [{"id":"filter-1","field":"stripeProduct","operator":"at_least","value":"prod_123:3"}]. Combine them with `filterJoinOperator: "or"` to match any filter.'}},required:["name","filters"]}},{name:"get_segment_count",description:"Get the number of subscribers in a segment",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID"}},required:["segmentId"]}},{name:"list_templates",description:"List all email templates, including per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_template",description:"Get a template's details, content, and all localized variants with sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"create_template",description:"Create a new email template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content"}},required:["name","subject","html"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, or `html` is required, and only those update fields are accepted.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Use this field for content updates instead of `blocks`."}},required:["templateId"],additionalProperties:!1}},{name:"delete_template",description:"Delete a template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"list_campaigns",description:"List all campaigns",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list campaigns for. If not provided, uses the currently selected company."},status:{type:"string",description:"Filter by status (draft, scheduled, sent)"}}}},{name:"get_campaign",description:"Get campaign details and stats",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"create_campaign",description:"Create a new campaign (as draft)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the campaign in. If not provided, uses the currently selected company."},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content"},templateId:{type:"string",description:"Use a template instead of html"},segmentId:{type:"string",description:"Target segment ID"}},required:["name","subject"]}},{name:"update_campaign",description:"Update a draft campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content"},replyTo:{type:"string",description:"Set reply-to using an existing reply profile email address for this company."},replyProfileId:{type:"string",description:"Set reply-to using a reply profile ID for this company."}},required:["campaignId"],additionalProperties:!1}},{name:"send_test_email",description:"Send a test email to a single address",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID to test"},to:{type:"string",description:"Email address to send test to"}},required:["campaignId","to"]}},{name:"list_sequences",description:"List all email sequences (automations)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list sequences for. If not provided, uses the currently selected company."}}}},{name:"get_sequence",description:"Get sequence details plus editable step content. The response includes sequence.emails with each step's nodeId, linked emailId, subject, previewText, and blocks.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"create_sequence",description:`Create a new email sequence. Sequenzy will automatically generate the email content using AI based on your company's brand and the goal you specify. The tool polls until emails are generated (typically 30-60 seconds).
|
|
49
49
|
|
|
50
50
|
IMPORTANT GUIDELINES:
|
|
51
51
|
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"source": "github",
|
|
8
8
|
"subfolder": "packages/mcp"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.0.
|
|
10
|
+
"version": "0.0.11",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "@sequenzy/mcp",
|
|
15
|
-
"version": "0.0.
|
|
15
|
+
"version": "0.0.11",
|
|
16
16
|
"runtime": "node",
|
|
17
17
|
"transport": {
|
|
18
18
|
"type": "stdio"
|