@sequenzy/mcp 0.0.12 → 0.0.13
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 +3 -3
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27,8 +27,8 @@ var Yz=Object.create;var{getPrototypeOf:Wz,defineProperty:QQ,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,K=z&&GQ.value,B=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&&K&&L?.async===!1&&L.jitless!==!0){if(!J)J=G(X.shape);if(U=J(U,L),!B)return U;return OY([],O,U,L,D,Q)}return Y(U,L)}});function k8(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 OQ=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)=>h1(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 K=H._zod.run({value:G.value,issues:[]},J);if(K instanceof Promise)z.push(K),$=!0;else{if(K.issues.length===0)return K;z.push(K)}}if(!$)return k8(z,G,Q,J);return Promise.all(z).then((H)=>{return k8(H,G,Q,J)})}}),VY=F("$ZodDiscriminatedUnion",(Q,X)=>{OQ.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 K of H)G[z].add(K)}}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}}),ZY=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,K])=>{return v8(Y,H,K)});return v8(Y,J,$)}});function UQ(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 $=UQ(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],$=UQ(G,J);if(!$.valid)return{valid:!1,mergeErrorPath:[W,...$.mergeErrorPath]};Y.push($.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function v8(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=UQ(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var NY=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 K=X.valueType._zod.run({value:G[H],issues:[]},W);if(K instanceof Promise)J.push(K.then((B)=>{if(B.issues.length)Y.issues.push(...h0(H,B.issues));Y.value[H]=B.value}));else{if(K.issues.length)Y.issues.push(...h0(H,K.issues));Y.value[H]=K.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((K)=>j0(K,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((K)=>{if(K.issues.length)Y.issues.push(...h0($,K.issues));Y.value[z.value]=K.value}));else{if(H.issues.length)Y.issues.push(...h0($,H.issues));Y.value[z.value]=H.value}}}if(J.length)return Promise.all(J).then(()=>Y);return Y}});var qY=F("$ZodEnum",(Q,X)=>{p.init(Q,X);let Y=YQ(X.entries),W=new Set(Y);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${Y.filter((G)=>JQ.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}}),wY=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 jY=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 x8(Q,X){if(Q.issues.length&&X===void 0)return{issues:[],value:void 0};return Q}var PY=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(`^(${h1(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)=>x8(J,Y.value));return x8(G,Y.value)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),bY=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(`^(${h1(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)}}),EY=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)=>_8(J,X));return _8(G,X)}});function _8(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var IY=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)}}),TY=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)=>y8(J,Q));return y8(G,Q)}});function y8(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 SY=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 RY=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 CY=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(h8);return h8(G)}});function h8(Q){return Q.value=Object.freeze(Q.value),Q}var kY=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 mz=(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},cz=()=>{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 ${mz(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 MQ(){return{localeError:cz()}}var KV=Symbol("ZodOutput"),BV=Symbol("ZodInput");class vY{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 pz(){return new vY}var c1=pz();function xY(Q,X){return new Q({type:"string",...b(X)})}function _Y(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...b(X)})}function VQ(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...b(X)})}function yY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...b(X)})}function hY(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 uY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(X)})}function fY(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...b(X)})}function lY(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...b(X)})}function mY(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(X)})}function cY(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...b(X)})}function pY(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(X)})}function iY(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...b(X)})}function nY(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...b(X)})}function dY(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(X)})}function rY(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(X)})}function oY(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(X)})}function tY(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(X)})}function aY(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(X)})}function sY(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...b(X)})}function eY(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...b(X)})}function QW(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...b(X)})}function XW(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...b(X)})}function YW(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(X)})}function WW(Q,X){return new Q({type:"string",format:"date",check:"string_format",...b(X)})}function GW(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...b(X)})}function JW(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...b(X)})}function $W(Q,X){return new Q({type:"number",checks:[],...b(X)})}function zW(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...b(X)})}function HW(Q,X){return new Q({type:"boolean",...b(X)})}function KW(Q,X){return new Q({type:"null",...b(X)})}function BW(Q){return new Q({type:"unknown"})}function DW(Q,X){return new Q({type:"never",...b(X)})}function m6(Q,X){return new DQ({check:"less_than",...b(X),value:Q,inclusive:!1})}function p1(Q,X){return new DQ({check:"less_than",...b(X),value:Q,inclusive:!0})}function c6(Q,X){return new AQ({check:"greater_than",...b(X),value:Q,inclusive:!1})}function i1(Q,X){return new AQ({check:"greater_than",...b(X),value:Q,inclusive:!0})}function p6(Q,X){return new M8({check:"multiple_of",...b(X),value:Q})}function i6(Q,X){return new Z8({check:"max_length",...b(X),maximum:Q})}function O1(Q,X){return new N8({check:"min_length",...b(X),minimum:Q})}function n6(Q,X){return new q8({check:"length_equals",...b(X),length:Q})}function ZQ(Q,X){return new w8({check:"string_format",format:"regex",...b(X),pattern:Q})}function NQ(Q){return new j8({check:"string_format",format:"lowercase",...b(Q)})}function qQ(Q){return new P8({check:"string_format",format:"uppercase",...b(Q)})}function wQ(Q,X){return new b8({check:"string_format",format:"includes",...b(X),includes:Q})}function jQ(Q,X){return new E8({check:"string_format",format:"starts_with",...b(X),prefix:Q})}function PQ(Q,X){return new I8({check:"string_format",format:"ends_with",...b(X),suffix:Q})}function J1(Q){return new T8({check:"overwrite",tx:Q})}function bQ(Q){return J1((X)=>X.normalize(Q))}function EQ(){return J1((Q)=>Q.trim())}function IQ(){return J1((Q)=>Q.toLowerCase())}function TQ(){return J1((Q)=>Q.toUpperCase())}function AW(Q,X,Y){return new Q({type:"array",element:X,...b(Y)})}function FW(Q,X,Y){let W=b(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function UW(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...b(Y)})}function LW(Q){let X=iz((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 iz(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 OW(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={};qX(d1,{time:()=>CQ,duration:()=>kQ,datetime:()=>SQ,date:()=>RQ,ZodISOTime:()=>ZW,ZodISODuration:()=>NW,ZodISODateTime:()=>MW,ZodISODate:()=>VW});var MW=F("ZodISODateTime",(Q,X)=>{t8.init(Q,X),d.init(Q,X)});function SQ(Q){return YW(MW,Q)}var VW=F("ZodISODate",(Q,X)=>{a8.init(Q,X),d.init(Q,X)});function RQ(Q){return WW(VW,Q)}var ZW=F("ZodISOTime",(Q,X)=>{s8.init(Q,X),d.init(Q,X)});function CQ(Q){return GW(ZW,Q)}var NW=F("ZodISODuration",(Q,X)=>{e8.init(Q,X),d.init(Q,X)});function kQ(Q){return JW(NW,Q)}var qW=(Q,X)=>{x6.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>kX(Q,Y)},flatten:{value:(Y)=>CX(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}}})},oV=F("ZodError",qW),L0=F("ZodError",qW,{Parent:Error});var wW=_6(L0),jW=y6(L0),PW=u1(L0),bW=l1(L0),EW=vX(L0),IW=xX(L0),TW=_X(L0),SW=yX(L0),RW=hX(L0),CW=gX(L0),kW=uX(L0),vW=fX(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(g.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)=>wW(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>PW(Q,Y,W),Q.parseAsync=async(Y,W)=>jW(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>bW(Q,Y,W),Q.spa=Q.safeParseAsync,Q.encode=(Y,W)=>EW(Q,Y,W),Q.decode=(Y,W)=>IW(Q,Y,W),Q.encodeAsync=async(Y,W)=>TW(Q,Y,W),Q.decodeAsync=async(Y,W)=>SW(Q,Y,W),Q.safeEncode=(Y,W)=>RW(Q,Y,W),Q.safeDecode=(Y,W)=>CW(Q,Y,W),Q.safeEncodeAsync=async(Y,W)=>kW(Q,Y,W),Q.safeDecodeAsync=async(Y,W)=>vW(Q,Y,W),Q.refine=(Y,W)=>Q.check(lH(Y,W)),Q.superRefine=(Y)=>Q.check(mH(Y)),Q.overwrite=(Y)=>Q.check(J1(Y)),Q.optional=()=>t(Q),Q.nullable=()=>yW(Q),Q.nullish=()=>t(yW(Q)),Q.nonoptional=(Y)=>_H(Q,Y),Q.array=()=>x(Q),Q.or=(Y)=>c([Q,Y]),Q.and=(Y)=>o6(Q,Y),Q.transform=(Y)=>xQ(Q,lW(Y)),Q.default=(Y)=>kH(Q,Y),Q.prefault=(Y)=>xH(Q,Y),Q.catch=(Y)=>hH(Q,Y),Q.pipe=(Y)=>xQ(Q,Y),Q.readonly=()=>fH(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}),hW=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(ZQ(...W)),Q.includes=(...W)=>Q.check(wQ(...W)),Q.startsWith=(...W)=>Q.check(jQ(...W)),Q.endsWith=(...W)=>Q.check(PQ(...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(NQ(W)),Q.uppercase=(W)=>Q.check(qQ(W)),Q.trim=()=>Q.check(EQ()),Q.normalize=(...W)=>Q.check(bQ(...W)),Q.toLowerCase=()=>Q.check(IQ()),Q.toUpperCase=()=>Q.check(TQ())}),QH=F("ZodString",(Q,X)=>{l6.init(Q,X),hW.init(Q,X),Q.email=(Y)=>Q.check(_Y(XH,Y)),Q.url=(Y)=>Q.check(fY(YH,Y)),Q.jwt=(Y)=>Q.check(XW(MH,Y)),Q.emoji=(Y)=>Q.check(lY(WH,Y)),Q.guid=(Y)=>Q.check(VQ(xW,Y)),Q.uuid=(Y)=>Q.check(yY(r6,Y)),Q.uuidv4=(Y)=>Q.check(hY(r6,Y)),Q.uuidv6=(Y)=>Q.check(gY(r6,Y)),Q.uuidv7=(Y)=>Q.check(uY(r6,Y)),Q.nanoid=(Y)=>Q.check(mY(GH,Y)),Q.guid=(Y)=>Q.check(VQ(xW,Y)),Q.cuid=(Y)=>Q.check(cY(JH,Y)),Q.cuid2=(Y)=>Q.check(pY($H,Y)),Q.ulid=(Y)=>Q.check(iY(zH,Y)),Q.base64=(Y)=>Q.check(sY(UH,Y)),Q.base64url=(Y)=>Q.check(eY(LH,Y)),Q.xid=(Y)=>Q.check(nY(HH,Y)),Q.ksuid=(Y)=>Q.check(dY(KH,Y)),Q.ipv4=(Y)=>Q.check(rY(BH,Y)),Q.ipv6=(Y)=>Q.check(oY(DH,Y)),Q.cidrv4=(Y)=>Q.check(tY(AH,Y)),Q.cidrv6=(Y)=>Q.check(aY(FH,Y)),Q.e164=(Y)=>Q.check(QW(OH,Y)),Q.datetime=(Y)=>Q.check(SQ(Y)),Q.date=(Y)=>Q.check(RQ(Y)),Q.time=(Y)=>Q.check(CQ(Y)),Q.duration=(Y)=>Q.check(kQ(Y))});function A(Q){return xY(QH,Q)}var d=F("ZodStringFormat",(Q,X)=>{i.init(Q,X),hW.init(Q,X)}),XH=F("ZodEmail",(Q,X)=>{l8.init(Q,X),d.init(Q,X)});var xW=F("ZodGUID",(Q,X)=>{u8.init(Q,X),d.init(Q,X)});var r6=F("ZodUUID",(Q,X)=>{f8.init(Q,X),d.init(Q,X)});var YH=F("ZodURL",(Q,X)=>{m8.init(Q,X),d.init(Q,X)});var WH=F("ZodEmoji",(Q,X)=>{c8.init(Q,X),d.init(Q,X)});var GH=F("ZodNanoID",(Q,X)=>{p8.init(Q,X),d.init(Q,X)});var JH=F("ZodCUID",(Q,X)=>{i8.init(Q,X),d.init(Q,X)});var $H=F("ZodCUID2",(Q,X)=>{n8.init(Q,X),d.init(Q,X)});var zH=F("ZodULID",(Q,X)=>{d8.init(Q,X),d.init(Q,X)});var HH=F("ZodXID",(Q,X)=>{r8.init(Q,X),d.init(Q,X)});var KH=F("ZodKSUID",(Q,X)=>{o8.init(Q,X),d.init(Q,X)});var BH=F("ZodIPv4",(Q,X)=>{QY.init(Q,X),d.init(Q,X)});var DH=F("ZodIPv6",(Q,X)=>{XY.init(Q,X),d.init(Q,X)});var AH=F("ZodCIDRv4",(Q,X)=>{YY.init(Q,X),d.init(Q,X)});var FH=F("ZodCIDRv6",(Q,X)=>{WY.init(Q,X),d.init(Q,X)});var UH=F("ZodBase64",(Q,X)=>{JY.init(Q,X),d.init(Q,X)});var LH=F("ZodBase64URL",(Q,X)=>{$Y.init(Q,X),d.init(Q,X)});var OH=F("ZodE164",(Q,X)=>{zY.init(Q,X),d.init(Q,X)});var MH=F("ZodJWT",(Q,X)=>{HY.init(Q,X),d.init(Q,X)});var gW=F("ZodNumber",(Q,X)=>{LQ.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(_W(W)),Q.safe=(W)=>Q.check(_W(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 $W(gW,Q)}var VH=F("ZodNumberFormat",(Q,X)=>{KY.init(Q,X),gW.init(Q,X)});function _W(Q){return zW(VH,Q)}var ZH=F("ZodBoolean",(Q,X)=>{BY.init(Q,X),a.init(Q,X)});function e(Q){return HW(ZH,Q)}var NH=F("ZodNull",(Q,X)=>{DY.init(Q,X),a.init(Q,X)});function _Q(Q){return KW(NH,Q)}var qH=F("ZodUnknown",(Q,X)=>{AY.init(Q,X),a.init(Q,X)});function r(){return BW(qH)}var wH=F("ZodNever",(Q,X)=>{FY.init(Q,X),a.init(Q,X)});function jH(Q){return DW(wH,Q)}var PH=F("ZodArray",(Q,X)=>{UY.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 AW(PH,Q,X)}var uW=F("ZodObject",(Q,X)=>{MY.init(Q,X),a.init(Q,X),g.defineLazy(Q,"shape",()=>{return X.shape}),Q.keyof=()=>B0(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:jH()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(Y)=>{return g.extend(Q,Y)},Q.safeExtend=(Y)=>{return g.safeExtend(Q,Y)},Q.merge=(Y)=>g.merge(Q,Y),Q.pick=(Y)=>g.pick(Q,Y),Q.omit=(Y)=>g.omit(Q,Y),Q.partial=(...Y)=>g.partial(mW,Q,Y[0]),Q.required=(...Y)=>g.required(cW,Q,Y[0])});function q(Q,X){let Y={type:"object",shape:Q??{},...g.normalizeParams(X)};return new uW(Y)}function z0(Q,X){return new uW({type:"object",shape:Q,catchall:r(),...g.normalizeParams(X)})}var fW=F("ZodUnion",(Q,X)=>{OQ.init(Q,X),a.init(Q,X),Q.options=X.options});function c(Q,X){return new fW({type:"union",options:Q,...g.normalizeParams(X)})}var bH=F("ZodDiscriminatedUnion",(Q,X)=>{fW.init(Q,X),VY.init(Q,X)});function yQ(Q,X,Y){return new bH({type:"union",options:X,discriminator:Q,...g.normalizeParams(Y)})}var EH=F("ZodIntersection",(Q,X)=>{ZY.init(Q,X),a.init(Q,X)});function o6(Q,X){return new EH({type:"intersection",left:Q,right:X})}var IH=F("ZodRecord",(Q,X)=>{NY.init(Q,X),a.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function o(Q,X,Y){return new IH({type:"record",keyType:Q,valueType:X,...g.normalizeParams(Y)})}var vQ=F("ZodEnum",(Q,X)=>{qY.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 vQ({...X,checks:[],...g.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 vQ({...X,checks:[],...g.normalizeParams(G),entries:J})}});function B0(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new vQ({type:"enum",entries:Y,...g.normalizeParams(X)})}var TH=F("ZodLiteral",(Q,X)=>{wY.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 TH({type:"literal",values:Array.isArray(Q)?Q:[Q],...g.normalizeParams(X)})}var SH=F("ZodTransform",(Q,X)=>{jY.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(g.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(g.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 lW(Q){return new SH({type:"transform",transform:Q})}var mW=F("ZodOptional",(Q,X)=>{PY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function t(Q){return new mW({type:"optional",innerType:Q})}var RH=F("ZodNullable",(Q,X)=>{bY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function yW(Q){return new RH({type:"nullable",innerType:Q})}var CH=F("ZodDefault",(Q,X)=>{EY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function kH(Q,X){return new CH({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():g.shallowClone(X)}})}var vH=F("ZodPrefault",(Q,X)=>{IY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function xH(Q,X){return new vH({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():g.shallowClone(X)}})}var cW=F("ZodNonOptional",(Q,X)=>{TY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function _H(Q,X){return new cW({type:"nonoptional",innerType:Q,...g.normalizeParams(X)})}var yH=F("ZodCatch",(Q,X)=>{SY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function hH(Q,X){return new yH({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var gH=F("ZodPipe",(Q,X)=>{RY.init(Q,X),a.init(Q,X),Q.in=X.in,Q.out=X.out});function xQ(Q,X){return new gH({type:"pipe",in:Q,out:X})}var uH=F("ZodReadonly",(Q,X)=>{CY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function fH(Q){return new uH({type:"readonly",innerType:Q})}var pW=F("ZodCustom",(Q,X)=>{kY.init(Q,X),a.init(Q,X)});function iW(Q,X){return FW(pW,Q??(()=>!0),X)}function lH(Q,X={}){return UW(pW,Q,X)}function mH(Q){return LW(Q)}function hQ(Q,X){return xQ(lW(Q),X)}M0(MQ());var gQ="2025-11-25";var nW=[gQ,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],o0="io.modelcontextprotocol/related-task",a6="2.0",X0=iW((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),dW=c([A(),f().int()]),rW=A(),pZ=z0({ttl:c([f(),_Q()]).optional(),pollInterval:f().optional()}),cH=q({ttl:f().optional()}),pH=q({taskId:A()}),uQ=z0({progressToken:dW.optional(),[o0]:pH.optional()}),O0=q({_meta:uQ.optional()}),r1=O0.extend({task:cH.optional()}),oW=(Q)=>r1.safeParse(Q).success,Y0=q({method:A(),params:O0.loose().optional()}),V0=q({_meta:uQ.optional()}),Z0=q({method:A(),params:V0.loose().optional()}),W0=z0({_meta:uQ.optional()}),s6=c([A(),f().int()]),tW=q({jsonrpc:j(a6),id:s6,...Y0.shape}).strict(),fQ=(Q)=>tW.safeParse(Q).success,aW=q({jsonrpc:j(a6),...Z0.shape}).strict(),sW=(Q)=>aW.safeParse(Q).success,lQ=q({jsonrpc:j(a6),id:s6,result:W0}).strict(),o1=(Q)=>lQ.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 mQ=q({jsonrpc:j(a6),id:s6.optional(),error:q({code:f().int(),message:A(),data:r().optional()})}).strict();var eW=(Q)=>mQ.safeParse(Q).success;var QG=c([tW,aW,lQ,mQ]),iZ=c([lQ,mQ]),e6=W0.strict(),iH=V0.extend({requestId:s6.optional(),reason:A().optional()}),Q4=Z0.extend({method:j("notifications/cancelled"),params:iH}),nH=q({src:A(),mimeType:A().optional(),sizes:x(A()).optional(),theme:B0(["light","dark"]).optional()}),t1=q({icons:x(nH).optional()}),V1=q({name:A(),title:A().optional()}),XG=V1.extend({...V1.shape,...t1.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),dH=o6(q({applyDefaults:e().optional()}),o(A(),r())),rH=hQ((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},o6(q({form:dH.optional(),url:X0.optional()}),o(A(),r()).optional())),oH=z0({list:X0.optional(),cancel:X0.optional(),requests:z0({sampling:z0({createMessage:X0.optional()}).optional(),elicitation:z0({create:X0.optional()}).optional()}).optional()}),tH=z0({list:X0.optional(),cancel:X0.optional(),requests:z0({tools:z0({call:X0.optional()}).optional()}).optional()}),aH=q({experimental:o(A(),X0).optional(),sampling:q({context:X0.optional(),tools:X0.optional()}).optional(),elicitation:rH.optional(),roots:q({listChanged:e().optional()}).optional(),tasks:oH.optional()}),sH=O0.extend({protocolVersion:A(),capabilities:aH,clientInfo:XG}),cQ=Y0.extend({method:j("initialize"),params:sH});var eH=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:tH.optional()}),Q3=W0.extend({protocolVersion:A(),capabilities:eH,serverInfo:XG,instructions:A().optional()}),pQ=Z0.extend({method:j("notifications/initialized"),params:V0.optional()});var X4=Y0.extend({method:j("ping"),params:O0.optional()}),X3=q({progress:f(),total:t(f()),message:t(A())}),Y3=q({...V0.shape,...X3.shape,progressToken:dW}),Y4=Z0.extend({method:j("notifications/progress"),params:Y3}),W3=O0.extend({cursor:rW.optional()}),a1=Y0.extend({params:W3.optional()}),s1=W0.extend({nextCursor:rW.optional()}),G3=B0(["working","input_required","completed","failed","cancelled"]),e1=q({taskId:A(),status:G3,ttl:c([f(),_Q()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:t(f()),statusMessage:t(A())}),Z1=W0.extend({task:e1}),J3=V0.merge(e1),Q6=Z0.extend({method:j("notifications/tasks/status"),params:J3}),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()})}),nZ=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()})}),YG=W0.merge(e1),WG=q({uri:A(),mimeType:t(A()),_meta:o(A(),r()).optional()}),GG=WG.extend({text:A()}),iQ=A().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),JG=WG.extend({blob:iQ}),X6=B0(["user","assistant"]),N1=q({audience:x(X6).optional(),priority:f().min(0).max(1).optional(),lastModified:d1.datetime({offset:!0}).optional()}),$G=q({...V1.shape,...t1.shape,uri:A(),description:t(A()),mimeType:t(A()),annotations:N1.optional(),_meta:t(z0({}))}),$3=q({...V1.shape,...t1.shape,uriTemplate:A(),description:t(A()),mimeType:t(A()),annotations:N1.optional(),_meta:t(z0({}))}),nQ=a1.extend({method:j("resources/list")}),z3=s1.extend({resources:x($G)}),H3=a1.extend({method:j("resources/templates/list")}),K3=s1.extend({resourceTemplates:x($3)}),dQ=O0.extend({uri:A()}),B3=dQ,rQ=Y0.extend({method:j("resources/read"),params:B3}),D3=W0.extend({contents:x(c([GG,JG]))}),A3=Z0.extend({method:j("notifications/resources/list_changed"),params:V0.optional()}),F3=dQ,U3=Y0.extend({method:j("resources/subscribe"),params:F3}),L3=dQ,O3=Y0.extend({method:j("resources/unsubscribe"),params:L3}),M3=V0.extend({uri:A()}),V3=Z0.extend({method:j("notifications/resources/updated"),params:M3}),Z3=q({name:A(),description:t(A()),required:t(e())}),N3=q({...V1.shape,...t1.shape,description:t(A()),arguments:t(x(Z3)),_meta:t(z0({}))}),q3=a1.extend({method:j("prompts/list")}),w3=s1.extend({prompts:x(N3)}),j3=O0.extend({name:A(),arguments:o(A(),A()).optional()}),P3=Y0.extend({method:j("prompts/get"),params:j3}),oQ=q({type:j("text"),text:A(),annotations:N1.optional(),_meta:o(A(),r()).optional()}),tQ=q({type:j("image"),data:iQ,mimeType:A(),annotations:N1.optional(),_meta:o(A(),r()).optional()}),aQ=q({type:j("audio"),data:iQ,mimeType:A(),annotations:N1.optional(),_meta:o(A(),r()).optional()}),b3=q({type:j("tool_use"),name:A(),id:A(),input:o(A(),r()),_meta:o(A(),r()).optional()}),E3=q({type:j("resource"),resource:c([GG,JG]),annotations:N1.optional(),_meta:o(A(),r()).optional()}),I3=$G.extend({type:j("resource_link")}),sQ=c([oQ,tQ,aQ,I3,E3]),T3=q({role:X6,content:sQ}),S3=W0.extend({description:A().optional(),messages:x(T3)}),R3=Z0.extend({method:j("notifications/prompts/list_changed"),params:V0.optional()}),C3=q({title:A().optional(),readOnlyHint:e().optional(),destructiveHint:e().optional(),idempotentHint:e().optional(),openWorldHint:e().optional()}),k3=q({taskSupport:B0(["required","optional","forbidden"]).optional()}),zG=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:C3.optional(),execution:k3.optional(),_meta:o(A(),r()).optional()}),eQ=a1.extend({method:j("tools/list")}),v3=s1.extend({tools:x(zG)}),K4=W0.extend({content:x(sQ).default([]),structuredContent:o(A(),r()).optional(),isError:e().optional()}),dZ=K4.or(W0.extend({toolResult:r()})),x3=r1.extend({name:A(),arguments:o(A(),r()).optional()}),Y6=Y0.extend({method:j("tools/call"),params:x3}),_3=Z0.extend({method:j("notifications/tools/list_changed"),params:V0.optional()}),rZ=q({autoRefresh:e().default(!0),debounceMs:f().int().nonnegative().default(300)}),W6=B0(["debug","info","notice","warning","error","critical","alert","emergency"]),y3=O0.extend({level:W6}),Q9=Y0.extend({method:j("logging/setLevel"),params:y3}),h3=V0.extend({level:W6,logger:A().optional(),data:r()}),g3=Z0.extend({method:j("notifications/message"),params:h3}),u3=q({name:A().optional()}),f3=q({hints:x(u3).optional(),costPriority:f().min(0).max(1).optional(),speedPriority:f().min(0).max(1).optional(),intelligencePriority:f().min(0).max(1).optional()}),l3=q({mode:B0(["auto","required","none"]).optional()}),m3=q({type:j("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:x(sQ).default([]),structuredContent:q({}).loose().optional(),isError:e().optional(),_meta:o(A(),r()).optional()}),c3=yQ("type",[oQ,tQ,aQ]),t6=yQ("type",[oQ,tQ,aQ,b3,m3]),p3=q({role:X6,content:c([t6,x(t6)]),_meta:o(A(),r()).optional()}),i3=r1.extend({messages:x(p3),modelPreferences:f3.optional(),systemPrompt:A().optional(),includeContext:B0(["none","thisServer","allServers"]).optional(),temperature:f().optional(),maxTokens:f().int(),stopSequences:x(A()).optional(),metadata:X0.optional(),tools:x(zG).optional(),toolChoice:l3.optional()}),n3=Y0.extend({method:j("sampling/createMessage"),params:i3}),X9=W0.extend({model:A(),stopReason:t(B0(["endTurn","stopSequence","maxTokens"]).or(A())),role:X6,content:c3}),Y9=W0.extend({model:A(),stopReason:t(B0(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:X6,content:c([t6,x(t6)])}),d3=q({type:j("boolean"),title:A().optional(),description:A().optional(),default:e().optional()}),r3=q({type:j("string"),title:A().optional(),description:A().optional(),minLength:f().optional(),maxLength:f().optional(),format:B0(["email","uri","date","date-time"]).optional(),default:A().optional()}),o3=q({type:B0(["number","integer"]),title:A().optional(),description:A().optional(),minimum:f().optional(),maximum:f().optional(),default:f().optional()}),t3=q({type:j("string"),title:A().optional(),description:A().optional(),enum:x(A()),default:A().optional()}),a3=q({type:j("string"),title:A().optional(),description:A().optional(),oneOf:x(q({const:A(),title:A()})),default:A().optional()}),s3=q({type:j("string"),title:A().optional(),description:A().optional(),enum:x(A()),enumNames:x(A()).optional(),default:A().optional()}),e3=c([t3,a3]),QK=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()}),XK=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()}),YK=c([QK,XK]),WK=c([s3,e3,YK]),GK=c([WK,d3,r3,o3]),JK=r1.extend({mode:j("form").optional(),message:A(),requestedSchema:q({type:j("object"),properties:o(A(),GK),required:x(A()).optional()})}),$K=r1.extend({mode:j("url"),message:A(),elicitationId:A(),url:A().url()}),zK=c([JK,$K]),HK=Y0.extend({method:j("elicitation/create"),params:zK}),KK=V0.extend({elicitationId:A()}),BK=Z0.extend({method:j("notifications/elicitation/complete"),params:KK}),B4=W0.extend({action:B0(["accept","decline","cancel"]),content:hQ((Q)=>Q===null?void 0:Q,o(A(),c([A(),f(),e(),x(A())])).optional())}),DK=q({type:j("ref/resource"),uri:A()});var AK=q({type:j("ref/prompt"),name:A()}),FK=O0.extend({ref:c([AK,DK]),argument:q({name:A(),value:A()}),context:q({arguments:o(A(),A()).optional()}).optional()}),UK=Y0.extend({method:j("completion/complete"),params:FK});var LK=W0.extend({completion:z0({values:x(A()).max(100),total:t(f().int()),hasMore:t(e())})}),OK=q({uri:A().startsWith("file://"),name:A().optional(),_meta:o(A(),r()).optional()}),MK=Y0.extend({method:j("roots/list"),params:O0.optional()}),W9=W0.extend({roots:x(OK)}),VK=Z0.extend({method:j("notifications/roots/list_changed"),params:V0.optional()}),oZ=c([X4,cQ,UK,Q9,P3,q3,nQ,H3,rQ,U3,O3,Y6,eQ,W4,J4,$4,H4]),tZ=c([Q4,Y4,pQ,VK,Q6]),aZ=c([e6,X9,Y9,B4,W9,G4,z4,Z1]),sZ=c([X4,n3,HK,MK,W4,J4,$4,H4]),eZ=c([Q4,Y4,g3,V3,A3,_3,R3,Q6,BK]),QN=c([e6,Q3,LK,S3,w3,z3,K3,D3,K4,v3,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 HG(W.elicitations,X)}return new C(Q,X,Y)}}class HG 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 ZK=Symbol("Let zodToJsonSchema decide on which parser to use");var vN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function G9(Q){let Y=d6(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=OW(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function J9(Q,X){let Y=r0(Q,X);if(!Y.success)throw Y.error;return Y.data}var bK=60000;class $9{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,K=this._requestResolvers.get(H);if(K)if(this._requestResolvers.delete(H),$.type==="response")K(z);else{let B=z,D=new C(B.error.code,B.error.message,B.error.data);K(D)}else{let B=$.type==="response"?"Response":"Error";this._onerror(Error(`${B} 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)||eW(G))this._onresponse(G);else if(fQ(G))this._onrequest(G,J);else if(sW(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 K={jsonrpc:"2.0",id:Q.id,error:{code:_.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:K,timestamp:Date.now()},W?.sessionId).catch((B)=>this._onerror(Error(`Failed to enqueue error response: ${B}`)));else W?.send(K).catch((B)=>this._onerror(Error(`Failed to send an error response: ${B}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let $=oW(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(K)=>{let B={relatedRequestId:Q.id};if(G)B.relatedTask={taskId:G};await this.notification(K,B)},sendRequest:async(K,B,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(K,B,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(K)=>{if(J.signal.aborted)return;let B={result:K,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:B,timestamp:Date.now()},W?.sessionId);else await W?.send(B)},async(K)=>{if(J.signal.aborted)return;let B={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(K.code)?K.code:_.InternalError,message:K.message??"Internal error",...K.data!==void 0&&{data:K.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:B,timestamp:Date.now()},W?.sessionId);else await W?.send(B)}).catch((K)=>this._onerror(Error(`Failed to send response: ${K}`))).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,K)=>{let B=(V)=>{K(V)};if(!this._transport){B(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),$)this.assertTaskCapability(Q.method)}catch(V){B(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));K(T)};this._responseHandlers.set(D,(V)=>{if(Y?.signal?.aborted)return;if(V instanceof Error)return K(V);try{let T=r0(X,V.result);if(!T.success)K(T.error);else H(T.data)}catch(T){K(T)}}),Y?.signal?.addEventListener("abort",()=>{L(Y?.signal?.reason)});let O=Y?.timeout??bK,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),K(T)})}else this._transport.send(U,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((V)=>{this._cleanupTimeout(D),K(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},YG,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=G9(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,G)=>{let J=J9(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=G9(Q);this._notificationHandlers.set(Y,(W)=>{let G=J9(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"&&fQ(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 KG(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(KG($)&&KG(J))Y[G]={...$,...J};else Y[G]=J}return Y}var l$=NX(QX(),1),m$=NX(f$(),1);function xM(){let Q=new l$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return m$.default(Q),Q}class BX{constructor(Q){this._ajv=Q??xM()}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 DX{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 c$(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 p$(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 AX extends $9{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(cQ,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(pQ,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(Q9,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 DX(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 K=r0(Y6,z);if(!K.success){let L=K.error instanceof Error?K.error.message:String(K.error);throw new C(_.InvalidParams,`Invalid tools/call request: ${L}`)}let{params:B}=K.data,D=await Promise.resolve(X(z,H));if(B.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(K4,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){p$(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;c$(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:nW.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((B)=>B.type==="tool_use").map((B)=>B.id)),K=new Set(W.filter((B)=>B.type==="tool_result").map((B)=>B.toolUseId));if(H.size!==K.size||![...H].every((B)=>K.has(B)))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},Y9,X);return this.request({method:"sampling/createMessage",params:Q},X9,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},B4,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},B4,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},W9,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 n$ from"node:process";class FX{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),_M(X)}clear(){this._buffer=void 0}}function _M(Q){return QG.parse(JSON.parse(Q))}function i$(Q){return JSON.stringify(Q)+`
|
|
30
|
-
`}class UX{constructor(Q=n$.stdin,X=n$.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new FX,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=i$(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var d$={name:"@sequenzy/mcp",version:"0.0.
|
|
31
|
-
`)}var r$=[{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 o$(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 uM={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 fM(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 t4(Q,X,Y){if(X.html!==void 0&&X.blocks!==void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`, not both.`);if(X.blocks!==void 0&&!Array.isArray(X.blocks))throw Error(`\`blocks\` must be an array when calling \`${Q}\`.`);if(Y?.requireContent&&X.html===void 0&&X.blocks===void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`.`)}function lM(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 t$(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function a$(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function mM(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 cM(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 B=mM({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,page:J,pageSize:W}),D=await w("GET",`/api/v1/subscribers?${B.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 K=Y!==void 0?G.slice(0,Y):G;return{success:!0,subscribers:K,pagination:{page:1,limit:W,total:$,totalPages:z,fetchedPages:H},returned:K.length,truncated:Y!==void 0&&$>0&&K.length<$}}async function LX(Q,X){return w("GET",`/api/v1/subscribers/${encodeURIComponent(Q)}`,void 0,X)}var s$=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
|
|
30
|
+
`}class UX{constructor(Q=n$.stdin,X=n$.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new FX,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=i$(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var d$={name:"@sequenzy/mcp",version:"0.0.13",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 hM(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=hM(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
|
+
`)}var r$=[{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 o$(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 uM={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. Engagement fields (`emailSent`, `emailOpened`, `emailClicked`, `emailBounced`, `emailComplained`) accept a time range as the value or a specific campaign via `campaign:<campaign_id>`."},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`. For engagement fields, use `is` (event happened) or `is_not` (event did not happen)."},value:{type:"string",description:"Filter value. Stripe product examples: `prod_123` for bought/didn't buy, `prod_123:3` for payment thresholds. Engagement examples: `7d`, `30d`, `90d`, `180d`, `all` for rolling time windows, or `campaign:<campaign_id>` to scope to a specific sent campaign (use `list_campaigns` to find IDs)."}},required:["field","operator","value"],additionalProperties:!1};function fM(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 t4(Q,X,Y){if(X.html!==void 0&&X.blocks!==void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`, not both.`);if(X.blocks!==void 0&&!Array.isArray(X.blocks))throw Error(`\`blocks\` must be an array when calling \`${Q}\`.`);if(Y?.requireContent&&X.html===void 0&&X.blocks===void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`.`)}function lM(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 t$(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function a$(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function mM(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 cM(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 B=mM({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,page:J,pageSize:W}),D=await w("GET",`/api/v1/subscribers?${B.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 K=Y!==void 0?G.slice(0,Y):G;return{success:!0,subscribers:K,pagination:{page:1,limit:W,total:$,totalPages:z,fetchedPages:H},returned:K.length,truncated:Y!==void 0&&$>0&&K.length<$}}async function LX(Q,X){return w("GET",`/api/v1/subscribers/${encodeURIComponent(Q)}`,void 0,X)}var s$=[{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
|
|
34
34
|
|
|
@@ -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"},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:uM,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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},required:["name","subject"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, `html`, or `blocks` 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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},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`. Supports campaign-specific engagement filters via `field: "emailBounced"` (or `emailSent`/`emailOpened`/`emailClicked`/`emailComplained`) with `value: "campaign:<campaign_id>"` - combine two such filters to express rules like "bounced campaign A but not campaign B".',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:uM,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"}]. Example campaign-specific engagement combo: [{"id":"filter-1","field":"emailBounced","operator":"is","value":"campaign:cmp_abc"},{"id":"filter-2","field":"emailBounced","operator":"is_not","value":"campaign:cmp_xyz"}]. 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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},required:["name","subject"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, `html`, or `blocks` 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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},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.13",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "@sequenzy/mcp",
|
|
15
|
-
"version": "0.0.
|
|
15
|
+
"version": "0.0.13",
|
|
16
16
|
"runtime": "node",
|
|
17
17
|
"transport": {
|
|
18
18
|
"type": "stdio"
|