import { _ as ao, $ as i, a as no, b as co, c as so, d as io, e as ro, f as lo, g as mo, h as uo, i as po, j as ho, k as So, l as go, m as fo, n as Zo, o as Ro, p as v, q as ko, r as yo, s as he, t as _o, u as xo, v as Io, w as To, x as Se, y as Po, z as bo, A as ge, B as vo, C as Co, D as No, E as qo, F as A, G as fe, H as Ze, I as Eo, J as Oo, K as Uo, L as wo, M as $o, N as Do, O as Lo, P as Ao, Q as Mo, R as D, S as jo, T as zo, U as M, V as Bo, W as Fo, X as Jo, Y as Go, Z as Wo, a0 as Vo, a1 as Ko, a2 as Ho, a3 as Yo, a4 as Xo, a5 as Qo, a6 as et, a7 as ot, a8 as tt, a9 as at, aa as nt, ab as ct, ac as st, ad as it, ae as rt, af as lt, ag as mt, ah as ut, ai as pt, aj as dt, ak as ht, al as ie, am as St, an as gt, ao as ft, ap as Zt, aq as Rt, ar as kt, as as yt, at as _t, au as xt, av as It, aw as Tt, ax as Pt, ay as bt, az as vt, aA as Ct, aB as Nt, aC as qt, aD as Et, aE as Ot, aF as re, aG as G, aH as le, aI as W, aJ as me, aK as Ut, aL as wt, aM as $t, aN as Dt, aO as Lt, aP as At, aQ as Mt, aR as jt, aS as zt, aT as Bt, aU as Ft, aV as Jt, aW as Gt, aX as Wt, aY as Vt, aZ as Kt, a_ as Ht, a$ as Yt, b0 as Xt, b1 as Qt, b2 as ea, b3 as oa, b4 as ta, b5 as aa, b6 as na, b7 as ca, b8 as sa, b9 as ia } from "./string-BZO3_EzG.js";
const ra = /* @__PURE__ */ i("ZodISODateTime", (e, o) => {
  no.init(e, o), S.init(e, o);
});
function Re(e) {
  return ao(ra, e);
}
const la = /* @__PURE__ */ i("ZodISODate", (e, o) => {
  ro.init(e, o), S.init(e, o);
});
function ma(e) {
  return co(la, e);
}
const ua = /* @__PURE__ */ i("ZodISOTime", (e, o) => {
  lo.init(e, o), S.init(e, o);
});
function pa(e) {
  return so(ua, e);
}
const da = /* @__PURE__ */ i("ZodISODuration", (e, o) => {
  mo.init(e, o), S.init(e, o);
});
function ha(e) {
  return io(da, e);
}
const Sa = (e, o) => {
  uo.init(e, o), e.name = "ZodError", Object.defineProperties(e, {
    format: {
      value: (t) => ho(e, t)
      // enumerable: false,
    },
    flatten: {
      value: (t) => po(e, t)
      // enumerable: false,
    },
    addIssue: {
      value: (t) => e.issues.push(t)
      // enumerable: false,
    },
    addIssues: {
      value: (t) => e.issues.push(...t)
      // enumerable: false,
    },
    isEmpty: {
      get() {
        return e.issues.length === 0;
      }
      // enumerable: false,
    }
  });
}, B = i("ZodError", Sa, {
  Parent: Error
}), ga = /* @__PURE__ */ So(B), fa = /* @__PURE__ */ fo(B), Za = /* @__PURE__ */ go(B), Ra = /* @__PURE__ */ Zo(B), p = /* @__PURE__ */ i("ZodType", (e, o) => (Lo.init(e, o), e.def = o, Object.defineProperty(e, "_def", { value: o }), e.check = (...t) => e.clone(
  {
    ...o,
    checks: [
      ...o.checks ?? [],
      ...t.map((n) => typeof n == "function" ? { _zod: { check: n, def: { check: "custom" }, onattach: [] } } : n)
    ]
  }
  // { parent: true }
), e.clone = (t, n) => Ao(e, t, n), e.brand = () => e, e.register = ((t, n) => (t.add(e, n), e)), e.parse = (t, n) => ga(e, t, n, { callee: e.parse }), e.safeParse = (t, n) => Za(e, t, n), e.parseAsync = async (t, n) => fa(e, t, n, { callee: e.parseAsync }), e.safeParseAsync = async (t, n) => Ra(e, t, n), e.spa = e.safeParseAsync, e.refine = (t, n) => e.check(mn(t, n)), e.superRefine = (t) => e.check(un(t)), e.overwrite = (t) => e.check(Mo(t)), e.optional = () => g(e), e.nullable = () => de(e), e.nullish = () => g(de(e)), e.nonoptional = (t) => on(e, t), e.array = () => l(e), e.or = (t) => u([e, t]), e.and = (t) => H(e, t), e.transform = (t) => K(e, be(t)), e.default = (t) => Xa(e, t), e.prefault = (t) => en(e, t), e.catch = (t) => an(e, t), e.pipe = (t) => K(e, t), e.readonly = () => sn(e), e.describe = (t) => {
  const n = e.clone();
  return D.add(n, { description: t }), n;
}, Object.defineProperty(e, "description", {
  get() {
    return D.get(e)?.description;
  },
  configurable: !0
}), e.meta = (...t) => {
  if (t.length === 0)
    return D.get(e);
  const n = e.clone();
  return D.add(n, t[0]), n;
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), ke = /* @__PURE__ */ i("_ZodString", (e, o) => {
  ge.init(e, o), p.init(e, o);
  const t = e._zod.bag;
  e.format = t.format ?? null, e.minLength = t.minimum ?? null, e.maxLength = t.maximum ?? null, e.regex = (...n) => e.check(vo(...n)), e.includes = (...n) => e.check(Co(...n)), e.startsWith = (...n) => e.check(No(...n)), e.endsWith = (...n) => e.check(qo(...n)), e.min = (...n) => e.check(A(...n)), e.max = (...n) => e.check(fe(...n)), e.length = (...n) => e.check(Ze(...n)), e.nonempty = (...n) => e.check(A(1, ...n)), e.lowercase = (n) => e.check(Eo(n)), e.uppercase = (n) => e.check(Oo(n)), e.trim = () => e.check(Uo()), e.normalize = (...n) => e.check(wo(...n)), e.toLowerCase = () => e.check($o()), e.toUpperCase = () => e.check(Do());
}), ka = /* @__PURE__ */ i("ZodString", (e, o) => {
  ge.init(e, o), ke.init(e, o), e.email = (t) => e.check(pt(ya, t)), e.url = (t) => e.check(Se(ye, t)), e.jwt = (t) => e.check(dt($a, t)), e.emoji = (t) => e.check(ht(_a, t)), e.guid = (t) => e.check(ie(ue, t)), e.uuid = (t) => e.check(St(L, t)), e.uuidv4 = (t) => e.check(gt(L, t)), e.uuidv6 = (t) => e.check(ft(L, t)), e.uuidv7 = (t) => e.check(Zt(L, t)), e.nanoid = (t) => e.check(Rt(xa, t)), e.guid = (t) => e.check(ie(ue, t)), e.cuid = (t) => e.check(kt(Ia, t)), e.cuid2 = (t) => e.check(yt(Ta, t)), e.ulid = (t) => e.check(_t(Pa, t)), e.base64 = (t) => e.check(xt(Oa, t)), e.base64url = (t) => e.check(It(Ua, t)), e.xid = (t) => e.check(Tt(ba, t)), e.ksuid = (t) => e.check(Pt(va, t)), e.ipv4 = (t) => e.check(bt(Ca, t)), e.ipv6 = (t) => e.check(vt(Na, t)), e.cidrv4 = (t) => e.check(Ct(qa, t)), e.cidrv6 = (t) => e.check(Nt(Ea, t)), e.e164 = (t) => e.check(qt(wa, t)), e.datetime = (t) => e.check(Re(t)), e.date = (t) => e.check(ma(t)), e.time = (t) => e.check(pa(t)), e.duration = (t) => e.check(ha(t));
});
function a(e) {
  return ko(ka, e);
}
const S = /* @__PURE__ */ i("ZodStringFormat", (e, o) => {
  bo.init(e, o), ke.init(e, o);
}), ya = /* @__PURE__ */ i("ZodEmail", (e, o) => {
  Bt.init(e, o), S.init(e, o);
}), ue = /* @__PURE__ */ i("ZodGUID", (e, o) => {
  Ft.init(e, o), S.init(e, o);
}), L = /* @__PURE__ */ i("ZodUUID", (e, o) => {
  Jt.init(e, o), S.init(e, o);
}), ye = /* @__PURE__ */ i("ZodURL", (e, o) => {
  Et.init(e, o), S.init(e, o);
});
function ts(e) {
  return Se(ye, e);
}
const _a = /* @__PURE__ */ i("ZodEmoji", (e, o) => {
  Gt.init(e, o), S.init(e, o);
}), xa = /* @__PURE__ */ i("ZodNanoID", (e, o) => {
  Wt.init(e, o), S.init(e, o);
}), Ia = /* @__PURE__ */ i("ZodCUID", (e, o) => {
  Vt.init(e, o), S.init(e, o);
}), Ta = /* @__PURE__ */ i("ZodCUID2", (e, o) => {
  Kt.init(e, o), S.init(e, o);
}), Pa = /* @__PURE__ */ i("ZodULID", (e, o) => {
  Ht.init(e, o), S.init(e, o);
}), ba = /* @__PURE__ */ i("ZodXID", (e, o) => {
  Yt.init(e, o), S.init(e, o);
}), va = /* @__PURE__ */ i("ZodKSUID", (e, o) => {
  Xt.init(e, o), S.init(e, o);
}), Ca = /* @__PURE__ */ i("ZodIPv4", (e, o) => {
  Qt.init(e, o), S.init(e, o);
}), Na = /* @__PURE__ */ i("ZodIPv6", (e, o) => {
  ea.init(e, o), S.init(e, o);
}), qa = /* @__PURE__ */ i("ZodCIDRv4", (e, o) => {
  oa.init(e, o), S.init(e, o);
}), Ea = /* @__PURE__ */ i("ZodCIDRv6", (e, o) => {
  ta.init(e, o), S.init(e, o);
}), Oa = /* @__PURE__ */ i("ZodBase64", (e, o) => {
  aa.init(e, o), S.init(e, o);
}), Ua = /* @__PURE__ */ i("ZodBase64URL", (e, o) => {
  na.init(e, o), S.init(e, o);
}), wa = /* @__PURE__ */ i("ZodE164", (e, o) => {
  ca.init(e, o), S.init(e, o);
}), $a = /* @__PURE__ */ i("ZodJWT", (e, o) => {
  sa.init(e, o), S.init(e, o);
}), _e = /* @__PURE__ */ i("ZodNumber", (e, o) => {
  Ot.init(e, o), p.init(e, o), e.gt = (n, r) => e.check(re(n, r)), e.gte = (n, r) => e.check(G(n, r)), e.min = (n, r) => e.check(G(n, r)), e.lt = (n, r) => e.check(le(n, r)), e.lte = (n, r) => e.check(W(n, r)), e.max = (n, r) => e.check(W(n, r)), e.int = (n) => e.check(pe(n)), e.safe = (n) => e.check(pe(n)), e.positive = (n) => e.check(re(0, n)), e.nonnegative = (n) => e.check(G(0, n)), e.negative = (n) => e.check(le(0, n)), e.nonpositive = (n) => e.check(W(0, n)), e.multipleOf = (n, r) => e.check(me(n, r)), e.step = (n, r) => e.check(me(n, r)), e.finite = () => e;
  const t = e._zod.bag;
  e.minValue = Math.max(t.minimum ?? Number.NEGATIVE_INFINITY, t.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(t.maximum ?? Number.POSITIVE_INFINITY, t.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (t.format ?? "").includes("int") || Number.isSafeInteger(t.multipleOf ?? 0.5), e.isFinite = !0, e.format = t.format ?? null;
});
function m(e) {
  return yo(_e, e);
}
const Da = /* @__PURE__ */ i("ZodNumberFormat", (e, o) => {
  ia.init(e, o), _e.init(e, o);
});
function pe(e) {
  return jt(Da, e);
}
const La = /* @__PURE__ */ i("ZodBoolean", (e, o) => {
  Ut.init(e, o), p.init(e, o);
});
function Z(e) {
  return To(La, e);
}
const Aa = /* @__PURE__ */ i("ZodNull", (e, o) => {
  wt.init(e, o), p.init(e, o);
});
function xe(e) {
  return _o(Aa, e);
}
const Ma = /* @__PURE__ */ i("ZodAny", (e, o) => {
  $t.init(e, o), p.init(e, o);
});
function as() {
  return Po(Ma);
}
const ja = /* @__PURE__ */ i("ZodUnknown", (e, o) => {
  Dt.init(e, o), p.init(e, o);
});
function d() {
  return xo(ja);
}
const za = /* @__PURE__ */ i("ZodNever", (e, o) => {
  zt.init(e, o), p.init(e, o);
});
function Ba(e) {
  return At(za, e);
}
const Fa = /* @__PURE__ */ i("ZodArray", (e, o) => {
  Lt.init(e, o), p.init(e, o), e.element = o.element, e.min = (t, n) => e.check(A(t, n)), e.nonempty = (t) => e.check(A(1, t)), e.max = (t, n) => e.check(fe(t, n)), e.length = (t, n) => e.check(Ze(t, n)), e.unwrap = () => e.element;
});
function l(e, o) {
  return Io(Fa, e, o);
}
const Ie = /* @__PURE__ */ i("ZodObject", (e, o) => {
  Ko.init(e, o), p.init(e, o), Ho(e, "shape", () => o.shape), e.keyof = () => x(Object.keys(e._zod.def.shape)), e.catchall = (t) => e.clone({ ...e._zod.def, catchall: t }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: d() }), e.loose = () => e.clone({ ...e._zod.def, catchall: d() }), e.strict = () => e.clone({ ...e._zod.def, catchall: Ba() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (t) => Yo(e, t), e.merge = (t) => Xo(e, t), e.pick = (t) => Qo(e, t), e.omit = (t) => et(e, t), e.partial = (...t) => ot(ve, e, t[0]), e.required = (...t) => tt(Ce, e, t[0]);
});
function c(e, o) {
  const t = {
    type: "object",
    get shape() {
      return he(this, "shape", { ...e }), this.shape;
    },
    ...v(o)
  };
  return new Ie(t);
}
function _(e, o) {
  return new Ie({
    type: "object",
    get shape() {
      return he(this, "shape", { ...e }), this.shape;
    },
    catchall: d(),
    ...v(o)
  });
}
const Te = /* @__PURE__ */ i("ZodUnion", (e, o) => {
  at.init(e, o), p.init(e, o), e.options = o.options;
});
function u(e, o) {
  return new Te({
    type: "union",
    options: e,
    ...v(o)
  });
}
const Ja = /* @__PURE__ */ i("ZodDiscriminatedUnion", (e, o) => {
  Te.init(e, o), nt.init(e, o);
});
function Pe(e, o, t) {
  return new Ja({
    type: "union",
    options: o,
    discriminator: e,
    ...v(t)
  });
}
const Ga = /* @__PURE__ */ i("ZodIntersection", (e, o) => {
  ct.init(e, o), p.init(e, o);
});
function H(e, o) {
  return new Ga({
    type: "intersection",
    left: e,
    right: o
  });
}
const Wa = /* @__PURE__ */ i("ZodRecord", (e, o) => {
  st.init(e, o), p.init(e, o), e.keyType = o.keyType, e.valueType = o.valueType;
});
function h(e, o, t) {
  return new Wa({
    type: "record",
    keyType: e,
    valueType: o,
    ...v(t)
  });
}
const V = /* @__PURE__ */ i("ZodEnum", (e, o) => {
  it.init(e, o), p.init(e, o), e.enum = o.entries, e.options = Object.values(o.entries);
  const t = new Set(Object.keys(o.entries));
  e.extract = (n, r) => {
    const b = {};
    for (const f of n)
      if (t.has(f))
        b[f] = o.entries[f];
      else
        throw new Error(`Key ${f} not found in enum`);
    return new V({
      ...o,
      checks: [],
      ...v(r),
      entries: b
    });
  }, e.exclude = (n, r) => {
    const b = { ...o.entries };
    for (const f of n)
      if (t.has(f))
        delete b[f];
      else
        throw new Error(`Key ${f} not found in enum`);
    return new V({
      ...o,
      checks: [],
      ...v(r),
      entries: b
    });
  };
});
function x(e, o) {
  const t = Array.isArray(e) ? Object.fromEntries(e.map((n) => [n, n])) : e;
  return new V({
    type: "enum",
    entries: t,
    ...v(o)
  });
}
const Va = /* @__PURE__ */ i("ZodLiteral", (e, o) => {
  rt.init(e, o), p.init(e, o), e.values = new Set(o.values), Object.defineProperty(e, "value", {
    get() {
      if (o.values.length > 1)
        throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
      return o.values[0];
    }
  });
});
function s(e, o) {
  return new Va({
    type: "literal",
    values: Array.isArray(e) ? e : [e],
    ...v(o)
  });
}
const Ka = /* @__PURE__ */ i("ZodTransform", (e, o) => {
  lt.init(e, o), p.init(e, o), e._zod.parse = (t, n) => {
    t.addIssue = (b) => {
      if (typeof b == "string")
        t.issues.push(M(b, t.value, o));
      else {
        const f = b;
        f.fatal && (f.continue = !1), f.code ?? (f.code = "custom"), f.input ?? (f.input = t.value), f.inst ?? (f.inst = e), f.continue ?? (f.continue = !0), t.issues.push(M(f));
      }
    };
    const r = o.transform(t.value, t);
    return r instanceof Promise ? r.then((b) => (t.value = b, t)) : (t.value = r, t);
  };
});
function be(e) {
  return new Ka({
    type: "transform",
    transform: e
  });
}
const ve = /* @__PURE__ */ i("ZodOptional", (e, o) => {
  mt.init(e, o), p.init(e, o), e.unwrap = () => e._zod.def.innerType;
});
function g(e) {
  return new ve({
    type: "optional",
    innerType: e
  });
}
const Ha = /* @__PURE__ */ i("ZodNullable", (e, o) => {
  Bo.init(e, o), p.init(e, o), e.unwrap = () => e._zod.def.innerType;
});
function de(e) {
  return new Ha({
    type: "nullable",
    innerType: e
  });
}
const Ya = /* @__PURE__ */ i("ZodDefault", (e, o) => {
  Jo.init(e, o), p.init(e, o), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
});
function Xa(e, o) {
  return new Ya({
    type: "default",
    innerType: e,
    get defaultValue() {
      return typeof o == "function" ? o() : o;
    }
  });
}
const Qa = /* @__PURE__ */ i("ZodPrefault", (e, o) => {
  Go.init(e, o), p.init(e, o), e.unwrap = () => e._zod.def.innerType;
});
function en(e, o) {
  return new Qa({
    type: "prefault",
    innerType: e,
    get defaultValue() {
      return typeof o == "function" ? o() : o;
    }
  });
}
const Ce = /* @__PURE__ */ i("ZodNonOptional", (e, o) => {
  Fo.init(e, o), p.init(e, o), e.unwrap = () => e._zod.def.innerType;
});
function on(e, o) {
  return new Ce({
    type: "nonoptional",
    innerType: e,
    ...v(o)
  });
}
const tn = /* @__PURE__ */ i("ZodCatch", (e, o) => {
  Wo.init(e, o), p.init(e, o), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
});
function an(e, o) {
  return new tn({
    type: "catch",
    innerType: e,
    catchValue: typeof o == "function" ? o : () => o
  });
}
const nn = /* @__PURE__ */ i("ZodPipe", (e, o) => {
  ut.init(e, o), p.init(e, o), e.in = o.in, e.out = o.out;
});
function K(e, o) {
  return new nn({
    type: "pipe",
    in: e,
    out: o
    // ...util.normalizeParams(params),
  });
}
const cn = /* @__PURE__ */ i("ZodReadonly", (e, o) => {
  Vo.init(e, o), p.init(e, o);
});
function sn(e) {
  return new cn({
    type: "readonly",
    innerType: e
  });
}
const Ne = /* @__PURE__ */ i("ZodCustom", (e, o) => {
  Mt.init(e, o), p.init(e, o);
});
function rn(e) {
  const o = new zo({
    check: "custom"
    // ...util.normalizeParams(params),
  });
  return o._zod.check = e, o;
}
function ln(e, o) {
  return Ro(Ne, e ?? (() => !0), o);
}
function mn(e, o = {}) {
  return jo(Ne, e, o);
}
function un(e) {
  const o = rn((t) => (t.addIssue = (n) => {
    if (typeof n == "string")
      t.issues.push(M(n, t.value, o._zod.def));
    else {
      const r = n;
      r.fatal && (r.continue = !1), r.code ?? (r.code = "custom"), r.input ?? (r.input = t.value), r.inst ?? (r.inst = o), r.continue ?? (r.continue = !o._zod.def.abort), t.issues.push(M(r));
    }
  }, e(t.value, t)));
  return o;
}
function qe(e, o) {
  return K(be(e), o);
}
const pn = "2025-11-25", ns = [pn, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"], dn = "io.modelcontextprotocol/related-task", F = "2.0", R = ln((e) => e !== null && (typeof e == "object" || typeof e == "function")), Ee = u([a(), m().int()]), Oe = a();
_({
  /**
   * Time in milliseconds to keep task results available after completion.
   * If null, the task has unlimited lifetime until manually cleaned up.
   */
  ttl: u([m(), xe()]).optional(),
  /**
   * Time in milliseconds to wait between task status requests.
   */
  pollInterval: m().optional()
});
const hn = c({
  ttl: m().optional()
}), Sn = c({
  taskId: a()
}), Y = _({
  /**
   * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
   */
  progressToken: Ee.optional(),
  /**
   * If specified, this request is related to the provided task.
   */
  [dn]: Sn.optional()
}), I = c({
  /**
   * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
   */
  _meta: Y.optional()
}), q = I.extend({
  /**
   * If specified, the caller is requesting task-augmented execution for this request.
   * The request will return a CreateTaskResult immediately, and the actual result can be
   * retrieved later via tasks/result.
   *
   * Task augmentation is subject to capability negotiation - receivers MUST declare support
   * for task augmentation of specific request types in their capabilities.
   */
  task: hn.optional()
}), cs = (e) => q.safeParse(e).success, k = c({
  method: a(),
  params: I.loose().optional()
}), T = c({
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: Y.optional()
}), P = c({
  method: a(),
  params: T.loose().optional()
}), y = _({
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: Y.optional()
}), J = u([a(), m().int()]), Ue = c({
  jsonrpc: s(F),
  id: J,
  ...k.shape
}).strict(), ss = (e) => Ue.safeParse(e).success, we = c({
  jsonrpc: s(F),
  ...P.shape
}).strict(), is = (e) => we.safeParse(e).success, X = c({
  jsonrpc: s(F),
  id: J,
  result: y
}).strict(), rs = (e) => X.safeParse(e).success;
var j;
(function(e) {
  e[e.ConnectionClosed = -32e3] = "ConnectionClosed", e[e.RequestTimeout = -32001] = "RequestTimeout", e[e.ParseError = -32700] = "ParseError", e[e.InvalidRequest = -32600] = "InvalidRequest", e[e.MethodNotFound = -32601] = "MethodNotFound", e[e.InvalidParams = -32602] = "InvalidParams", e[e.InternalError = -32603] = "InternalError", e[e.UrlElicitationRequired = -32042] = "UrlElicitationRequired";
})(j || (j = {}));
const Q = c({
  jsonrpc: s(F),
  id: J.optional(),
  error: c({
    /**
     * The error type that occurred.
     */
    code: m().int(),
    /**
     * A short description of the error. The message SHOULD be limited to a concise single sentence.
     */
    message: a(),
    /**
     * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
     */
    data: d().optional()
  })
}).strict(), ls = (e) => Q.safeParse(e).success, ms = u([
  Ue,
  we,
  X,
  Q
]);
u([X, Q]);
const $e = y.strict(), gn = T.extend({
  /**
   * The ID of the request to cancel.
   *
   * This MUST correspond to the ID of a request previously issued in the same direction.
   */
  requestId: J.optional(),
  /**
   * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
   */
  reason: a().optional()
}), De = P.extend({
  method: s("notifications/cancelled"),
  params: gn
}), fn = c({
  /**
   * URL or data URI for the icon.
   */
  src: a(),
  /**
   * Optional MIME type for the icon.
   */
  mimeType: a().optional(),
  /**
   * Optional array of strings that specify sizes at which the icon can be used.
   * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
   *
   * If not provided, the client should assume that the icon can be used at any size.
   */
  sizes: l(a()).optional(),
  /**
   * Optional specifier for the theme this icon is designed for. `light` indicates
   * the icon is designed to be used with a light background, and `dark` indicates
   * the icon is designed to be used with a dark background.
   *
   * If not provided, the client should assume the icon can be used with any theme.
   */
  theme: x(["light", "dark"]).optional()
}), E = c({
  /**
   * Optional set of sized icons that the client can display in a user interface.
   *
   * Clients that support rendering icons MUST support at least the following MIME types:
   * - `image/png` - PNG images (safe, universal compatibility)
   * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
   *
   * Clients that support rendering icons SHOULD also support:
   * - `image/svg+xml` - SVG images (scalable but requires security precautions)
   * - `image/webp` - WebP images (modern, efficient format)
   */
  icons: l(fn).optional()
}), C = c({
  /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
  name: a(),
  /**
   * Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
   * even by those unfamiliar with domain-specific terminology.
   *
   * If not provided, the name should be used for display (except for Tool,
   * where `annotations.title` should be given precedence over using `name`,
   * if present).
   */
  title: a().optional()
}), Le = C.extend({
  ...C.shape,
  ...E.shape,
  version: a(),
  /**
   * An optional URL of the website for this implementation.
   */
  websiteUrl: a().optional(),
  /**
   * An optional human-readable description of what this implementation does.
   *
   * This can be used by clients or servers to provide context about their purpose
   * and capabilities. For example, a server might describe the types of resources
   * or tools it provides, while a client might describe its intended use case.
   */
  description: a().optional()
}), Zn = H(c({
  applyDefaults: Z().optional()
}), h(a(), d())), Rn = qe((e) => e && typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0 ? { form: {} } : e, H(c({
  form: Zn.optional(),
  url: R.optional()
}), h(a(), d()).optional())), kn = _({
  /**
   * Present if the client supports listing tasks.
   */
  list: R.optional(),
  /**
   * Present if the client supports cancelling tasks.
   */
  cancel: R.optional(),
  /**
   * Capabilities for task creation on specific request types.
   */
  requests: _({
    /**
     * Task support for sampling requests.
     */
    sampling: _({
      createMessage: R.optional()
    }).optional(),
    /**
     * Task support for elicitation requests.
     */
    elicitation: _({
      create: R.optional()
    }).optional()
  }).optional()
}), yn = _({
  /**
   * Present if the server supports listing tasks.
   */
  list: R.optional(),
  /**
   * Present if the server supports cancelling tasks.
   */
  cancel: R.optional(),
  /**
   * Capabilities for task creation on specific request types.
   */
  requests: _({
    /**
     * Task support for tool requests.
     */
    tools: _({
      call: R.optional()
    }).optional()
  }).optional()
}), _n = c({
  /**
   * Experimental, non-standard capabilities that the client supports.
   */
  experimental: h(a(), R).optional(),
  /**
   * Present if the client supports sampling from an LLM.
   */
  sampling: c({
    /**
     * Present if the client supports context inclusion via includeContext parameter.
     * If not declared, servers SHOULD only use `includeContext: "none"` (or omit it).
     */
    context: R.optional(),
    /**
     * Present if the client supports tool use via tools and toolChoice parameters.
     */
    tools: R.optional()
  }).optional(),
  /**
   * Present if the client supports eliciting user input.
   */
  elicitation: Rn.optional(),
  /**
   * Present if the client supports listing roots.
   */
  roots: c({
    /**
     * Whether the client supports issuing notifications for changes to the roots list.
     */
    listChanged: Z().optional()
  }).optional(),
  /**
   * Present if the client supports task creation.
   */
  tasks: kn.optional()
}), xn = I.extend({
  /**
   * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
   */
  protocolVersion: a(),
  capabilities: _n,
  clientInfo: Le
}), In = k.extend({
  method: s("initialize"),
  params: xn
}), Tn = c({
  /**
   * Experimental, non-standard capabilities that the server supports.
   */
  experimental: h(a(), R).optional(),
  /**
   * Present if the server supports sending log messages to the client.
   */
  logging: R.optional(),
  /**
   * Present if the server supports sending completions to the client.
   */
  completions: R.optional(),
  /**
   * Present if the server offers any prompt templates.
   */
  prompts: c({
    /**
     * Whether this server supports issuing notifications for changes to the prompt list.
     */
    listChanged: Z().optional()
  }).optional(),
  /**
   * Present if the server offers any resources to read.
   */
  resources: c({
    /**
     * Whether this server supports clients subscribing to resource updates.
     */
    subscribe: Z().optional(),
    /**
     * Whether this server supports issuing notifications for changes to the resource list.
     */
    listChanged: Z().optional()
  }).optional(),
  /**
   * Present if the server offers any tools to call.
   */
  tools: c({
    /**
     * Whether this server supports issuing notifications for changes to the tool list.
     */
    listChanged: Z().optional()
  }).optional(),
  /**
   * Present if the server supports task creation.
   */
  tasks: yn.optional()
}), Pn = y.extend({
  /**
   * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.
   */
  protocolVersion: a(),
  capabilities: Tn,
  serverInfo: Le,
  /**
   * Instructions describing how to use the server and its features.
   *
   * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.
   */
  instructions: a().optional()
}), Ae = P.extend({
  method: s("notifications/initialized"),
  params: T.optional()
}), us = (e) => Ae.safeParse(e).success, Me = k.extend({
  method: s("ping"),
  params: I.optional()
}), bn = c({
  /**
   * The progress thus far. This should increase every time progress is made, even if the total is unknown.
   */
  progress: m(),
  /**
   * Total number of items to process (or total progress required), if known.
   */
  total: g(m()),
  /**
   * An optional message describing the current progress.
   */
  message: g(a())
}), vn = c({
  ...T.shape,
  ...bn.shape,
  /**
   * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
   */
  progressToken: Ee
}), je = P.extend({
  method: s("notifications/progress"),
  params: vn
}), Cn = I.extend({
  /**
   * An opaque token representing the current pagination position.
   * If provided, the server should return results starting after this cursor.
   */
  cursor: Oe.optional()
}), O = k.extend({
  params: Cn.optional()
}), U = y.extend({
  /**
   * An opaque token representing the pagination position after the last returned result.
   * If present, there may be more results available.
   */
  nextCursor: Oe.optional()
}), Nn = x(["working", "input_required", "completed", "failed", "cancelled"]), w = c({
  taskId: a(),
  status: Nn,
  /**
   * Time in milliseconds to keep task results available after completion.
   * If null, the task has unlimited lifetime until manually cleaned up.
   */
  ttl: u([m(), xe()]),
  /**
   * ISO 8601 timestamp when the task was created.
   */
  createdAt: a(),
  /**
   * ISO 8601 timestamp when the task was last updated.
   */
  lastUpdatedAt: a(),
  pollInterval: g(m()),
  /**
   * Optional diagnostic message for failed tasks or other status information.
   */
  statusMessage: g(a())
}), ze = y.extend({
  task: w
}), qn = T.merge(w), Be = P.extend({
  method: s("notifications/tasks/status"),
  params: qn
}), Fe = k.extend({
  method: s("tasks/get"),
  params: I.extend({
    taskId: a()
  })
}), Je = y.merge(w), Ge = k.extend({
  method: s("tasks/result"),
  params: I.extend({
    taskId: a()
  })
});
y.loose();
const We = O.extend({
  method: s("tasks/list")
}), Ve = U.extend({
  tasks: l(w)
}), Ke = k.extend({
  method: s("tasks/cancel"),
  params: I.extend({
    taskId: a()
  })
}), ps = y.merge(w), He = c({
  /**
   * The URI of this resource.
   */
  uri: a(),
  /**
   * The MIME type of this resource, if known.
   */
  mimeType: g(a()),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: h(a(), d()).optional()
}), Ye = He.extend({
  /**
   * The text of the item. This must only be set if the item can actually be represented as text (not binary data).
   */
  text: a()
}), ee = a().refine((e) => {
  try {
    return atob(e), !0;
  } catch {
    return !1;
  }
}, { message: "Invalid Base64 string" }), Xe = He.extend({
  /**
   * A base64-encoded string representing the binary data of the item.
   */
  blob: ee
}), $ = x(["user", "assistant"]), N = c({
  /**
   * Intended audience(s) for the resource.
   */
  audience: l($).optional(),
  /**
   * Importance hint for the resource, from 0 (least) to 1 (most).
   */
  priority: m().min(0).max(1).optional(),
  /**
   * ISO 8601 timestamp for the most recent modification.
   */
  lastModified: Re({ offset: !0 }).optional()
}), Qe = c({
  ...C.shape,
  ...E.shape,
  /**
   * The URI of this resource.
   */
  uri: a(),
  /**
   * A description of what this resource represents.
   *
   * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
   */
  description: g(a()),
  /**
   * The MIME type of this resource, if known.
   */
  mimeType: g(a()),
  /**
   * Optional annotations for the client.
   */
  annotations: N.optional(),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: g(_({}))
}), En = c({
  ...C.shape,
  ...E.shape,
  /**
   * A URI template (according to RFC 6570) that can be used to construct resource URIs.
   */
  uriTemplate: a(),
  /**
   * A description of what this template is for.
   *
   * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
   */
  description: g(a()),
  /**
   * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.
   */
  mimeType: g(a()),
  /**
   * Optional annotations for the client.
   */
  annotations: N.optional(),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: g(_({}))
}), On = O.extend({
  method: s("resources/list")
}), Un = U.extend({
  resources: l(Qe)
}), wn = O.extend({
  method: s("resources/templates/list")
}), $n = U.extend({
  resourceTemplates: l(En)
}), oe = I.extend({
  /**
   * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
   *
   * @format uri
   */
  uri: a()
}), Dn = oe, Ln = k.extend({
  method: s("resources/read"),
  params: Dn
}), An = y.extend({
  contents: l(u([Ye, Xe]))
}), Mn = P.extend({
  method: s("notifications/resources/list_changed"),
  params: T.optional()
}), jn = oe, zn = k.extend({
  method: s("resources/subscribe"),
  params: jn
}), Bn = oe, Fn = k.extend({
  method: s("resources/unsubscribe"),
  params: Bn
}), Jn = T.extend({
  /**
   * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
   */
  uri: a()
}), Gn = P.extend({
  method: s("notifications/resources/updated"),
  params: Jn
}), Wn = c({
  /**
   * The name of the argument.
   */
  name: a(),
  /**
   * A human-readable description of the argument.
   */
  description: g(a()),
  /**
   * Whether this argument must be provided.
   */
  required: g(Z())
}), Vn = c({
  ...C.shape,
  ...E.shape,
  /**
   * An optional description of what this prompt provides
   */
  description: g(a()),
  /**
   * A list of arguments to use for templating the prompt.
   */
  arguments: g(l(Wn)),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: g(_({}))
}), Kn = O.extend({
  method: s("prompts/list")
}), Hn = U.extend({
  prompts: l(Vn)
}), Yn = I.extend({
  /**
   * The name of the prompt or prompt template.
   */
  name: a(),
  /**
   * Arguments to use for templating the prompt.
   */
  arguments: h(a(), a()).optional()
}), Xn = k.extend({
  method: s("prompts/get"),
  params: Yn
}), te = c({
  type: s("text"),
  /**
   * The text content of the message.
   */
  text: a(),
  /**
   * Optional annotations for the client.
   */
  annotations: N.optional(),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: h(a(), d()).optional()
}), ae = c({
  type: s("image"),
  /**
   * The base64-encoded image data.
   */
  data: ee,
  /**
   * The MIME type of the image. Different providers may support different image types.
   */
  mimeType: a(),
  /**
   * Optional annotations for the client.
   */
  annotations: N.optional(),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: h(a(), d()).optional()
}), ne = c({
  type: s("audio"),
  /**
   * The base64-encoded audio data.
   */
  data: ee,
  /**
   * The MIME type of the audio. Different providers may support different audio types.
   */
  mimeType: a(),
  /**
   * Optional annotations for the client.
   */
  annotations: N.optional(),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: h(a(), d()).optional()
}), Qn = c({
  type: s("tool_use"),
  /**
   * The name of the tool to invoke.
   * Must match a tool name from the request's tools array.
   */
  name: a(),
  /**
   * Unique identifier for this tool call.
   * Used to correlate with ToolResultContent in subsequent messages.
   */
  id: a(),
  /**
   * Arguments to pass to the tool.
   * Must conform to the tool's inputSchema.
   */
  input: h(a(), d()),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: h(a(), d()).optional()
}), ec = c({
  type: s("resource"),
  resource: u([Ye, Xe]),
  /**
   * Optional annotations for the client.
   */
  annotations: N.optional(),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: h(a(), d()).optional()
}), oc = Qe.extend({
  type: s("resource_link")
}), ce = u([
  te,
  ae,
  ne,
  oc,
  ec
]), tc = c({
  role: $,
  content: ce
}), ac = y.extend({
  /**
   * An optional description for the prompt.
   */
  description: a().optional(),
  messages: l(tc)
}), nc = P.extend({
  method: s("notifications/prompts/list_changed"),
  params: T.optional()
}), cc = c({
  /**
   * A human-readable title for the tool.
   */
  title: a().optional(),
  /**
   * If true, the tool does not modify its environment.
   *
   * Default: false
   */
  readOnlyHint: Z().optional(),
  /**
   * If true, the tool may perform destructive updates to its environment.
   * If false, the tool performs only additive updates.
   *
   * (This property is meaningful only when `readOnlyHint == false`)
   *
   * Default: true
   */
  destructiveHint: Z().optional(),
  /**
   * If true, calling the tool repeatedly with the same arguments
   * will have no additional effect on the its environment.
   *
   * (This property is meaningful only when `readOnlyHint == false`)
   *
   * Default: false
   */
  idempotentHint: Z().optional(),
  /**
   * If true, this tool may interact with an "open world" of external
   * entities. If false, the tool's domain of interaction is closed.
   * For example, the world of a web search tool is open, whereas that
   * of a memory tool is not.
   *
   * Default: true
   */
  openWorldHint: Z().optional()
}), sc = c({
  /**
   * Indicates the tool's preference for task-augmented execution.
   * - "required": Clients MUST invoke the tool as a task
   * - "optional": Clients MAY invoke the tool as a task or normal request
   * - "forbidden": Clients MUST NOT attempt to invoke the tool as a task
   *
   * If not present, defaults to "forbidden".
   */
  taskSupport: x(["required", "optional", "forbidden"]).optional()
}), eo = c({
  ...C.shape,
  ...E.shape,
  /**
   * A human-readable description of the tool.
   */
  description: a().optional(),
  /**
   * A JSON Schema 2020-12 object defining the expected parameters for the tool.
   * Must have type: 'object' at the root level per MCP spec.
   */
  inputSchema: c({
    type: s("object"),
    properties: h(a(), R).optional(),
    required: l(a()).optional()
  }).catchall(d()),
  /**
   * An optional JSON Schema 2020-12 object defining the structure of the tool's output
   * returned in the structuredContent field of a CallToolResult.
   * Must have type: 'object' at the root level per MCP spec.
   */
  outputSchema: c({
    type: s("object"),
    properties: h(a(), R).optional(),
    required: l(a()).optional()
  }).catchall(d()).optional(),
  /**
   * Optional additional tool information.
   */
  annotations: cc.optional(),
  /**
   * Execution-related properties for this tool.
   */
  execution: sc.optional(),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: h(a(), d()).optional()
}), ic = O.extend({
  method: s("tools/list")
}), rc = U.extend({
  tools: l(eo)
}), oo = y.extend({
  /**
   * A list of content objects that represent the result of the tool call.
   *
   * If the Tool does not define an outputSchema, this field MUST be present in the result.
   * For backwards compatibility, this field is always present, but it may be empty.
   */
  content: l(ce).default([]),
  /**
   * An object containing structured tool output.
   *
   * If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema.
   */
  structuredContent: h(a(), d()).optional(),
  /**
   * Whether the tool call ended in an error.
   *
   * If not set, this is assumed to be false (the call was successful).
   *
   * Any errors that originate from the tool SHOULD be reported inside the result
   * object, with `isError` set to true, _not_ as an MCP protocol-level error
   * response. Otherwise, the LLM would not be able to see that an error occurred
   * and self-correct.
   *
   * However, any errors in _finding_ the tool, an error indicating that the
   * server does not support tool calls, or any other exceptional conditions,
   * should be reported as an MCP error response.
   */
  isError: Z().optional()
});
oo.or(y.extend({
  toolResult: d()
}));
const lc = q.extend({
  /**
   * The name of the tool to call.
   */
  name: a(),
  /**
   * Arguments to pass to the tool.
   */
  arguments: h(a(), d()).optional()
}), mc = k.extend({
  method: s("tools/call"),
  params: lc
}), uc = P.extend({
  method: s("notifications/tools/list_changed"),
  params: T.optional()
}), ds = c({
  /**
   * If true, the list will be refreshed automatically when a list changed notification is received.
   * The callback will be called with the updated list.
   *
   * If false, the callback will be called with null items, allowing manual refresh.
   *
   * @default true
   */
  autoRefresh: Z().default(!0),
  /**
   * Debounce time in milliseconds for list changed notification processing.
   *
   * Multiple notifications received within this timeframe will only trigger one refresh.
   * Set to 0 to disable debouncing.
   *
   * @default 300
   */
  debounceMs: m().int().nonnegative().default(300)
}), to = x(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]), pc = I.extend({
  /**
   * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/logging/message.
   */
  level: to
}), dc = k.extend({
  method: s("logging/setLevel"),
  params: pc
}), hc = T.extend({
  /**
   * The severity of this log message.
   */
  level: to,
  /**
   * An optional name of the logger issuing this message.
   */
  logger: a().optional(),
  /**
   * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
   */
  data: d()
}), Sc = P.extend({
  method: s("notifications/message"),
  params: hc
}), gc = c({
  /**
   * A hint for a model name.
   */
  name: a().optional()
}), fc = c({
  /**
   * Optional hints to use for model selection.
   */
  hints: l(gc).optional(),
  /**
   * How much to prioritize cost when selecting a model.
   */
  costPriority: m().min(0).max(1).optional(),
  /**
   * How much to prioritize sampling speed (latency) when selecting a model.
   */
  speedPriority: m().min(0).max(1).optional(),
  /**
   * How much to prioritize intelligence and capabilities when selecting a model.
   */
  intelligencePriority: m().min(0).max(1).optional()
}), Zc = c({
  /**
   * Controls when tools are used:
   * - "auto": Model decides whether to use tools (default)
   * - "required": Model MUST use at least one tool before completing
   * - "none": Model MUST NOT use any tools
   */
  mode: x(["auto", "required", "none"]).optional()
}), Rc = c({
  type: s("tool_result"),
  toolUseId: a().describe("The unique identifier for the corresponding tool call."),
  content: l(ce).default([]),
  structuredContent: c({}).loose().optional(),
  isError: Z().optional(),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: h(a(), d()).optional()
}), kc = Pe("type", [te, ae, ne]), z = Pe("type", [
  te,
  ae,
  ne,
  Qn,
  Rc
]), yc = c({
  role: $,
  content: u([z, l(z)]),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: h(a(), d()).optional()
}), _c = q.extend({
  messages: l(yc),
  /**
   * The server's preferences for which model to select. The client MAY modify or omit this request.
   */
  modelPreferences: fc.optional(),
  /**
   * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
   */
  systemPrompt: a().optional(),
  /**
   * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
   * The client MAY ignore this request.
   *
   * Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client
   * declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.
   */
  includeContext: x(["none", "thisServer", "allServers"]).optional(),
  temperature: m().optional(),
  /**
   * The requested maximum number of tokens to sample (to prevent runaway completions).
   *
   * The client MAY choose to sample fewer tokens than the requested maximum.
   */
  maxTokens: m().int(),
  stopSequences: l(a()).optional(),
  /**
   * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
   */
  metadata: R.optional(),
  /**
   * Tools that the model may use during generation.
   * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
   */
  tools: l(eo).optional(),
  /**
   * Controls how the model uses tools.
   * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
   * Default is `{ mode: "auto" }`.
   */
  toolChoice: Zc.optional()
}), xc = k.extend({
  method: s("sampling/createMessage"),
  params: _c
}), Ic = y.extend({
  /**
   * The name of the model that generated the message.
   */
  model: a(),
  /**
   * The reason why sampling stopped, if known.
   *
   * Standard values:
   * - "endTurn": Natural end of the assistant's turn
   * - "stopSequence": A stop sequence was encountered
   * - "maxTokens": Maximum token limit was reached
   *
   * This field is an open string to allow for provider-specific stop reasons.
   */
  stopReason: g(x(["endTurn", "stopSequence", "maxTokens"]).or(a())),
  role: $,
  /**
   * Response content. Single content block (text, image, or audio).
   */
  content: kc
}), Tc = y.extend({
  /**
   * The name of the model that generated the message.
   */
  model: a(),
  /**
   * The reason why sampling stopped, if known.
   *
   * Standard values:
   * - "endTurn": Natural end of the assistant's turn
   * - "stopSequence": A stop sequence was encountered
   * - "maxTokens": Maximum token limit was reached
   * - "toolUse": The model wants to use one or more tools
   *
   * This field is an open string to allow for provider-specific stop reasons.
   */
  stopReason: g(x(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(a())),
  role: $,
  /**
   * Response content. May be a single block or array. May include ToolUseContent if stopReason is "toolUse".
   */
  content: u([z, l(z)])
}), Pc = c({
  type: s("boolean"),
  title: a().optional(),
  description: a().optional(),
  default: Z().optional()
}), bc = c({
  type: s("string"),
  title: a().optional(),
  description: a().optional(),
  minLength: m().optional(),
  maxLength: m().optional(),
  format: x(["email", "uri", "date", "date-time"]).optional(),
  default: a().optional()
}), vc = c({
  type: x(["number", "integer"]),
  title: a().optional(),
  description: a().optional(),
  minimum: m().optional(),
  maximum: m().optional(),
  default: m().optional()
}), Cc = c({
  type: s("string"),
  title: a().optional(),
  description: a().optional(),
  enum: l(a()),
  default: a().optional()
}), Nc = c({
  type: s("string"),
  title: a().optional(),
  description: a().optional(),
  oneOf: l(c({
    const: a(),
    title: a()
  })),
  default: a().optional()
}), qc = c({
  type: s("string"),
  title: a().optional(),
  description: a().optional(),
  enum: l(a()),
  enumNames: l(a()).optional(),
  default: a().optional()
}), Ec = u([Cc, Nc]), Oc = c({
  type: s("array"),
  title: a().optional(),
  description: a().optional(),
  minItems: m().optional(),
  maxItems: m().optional(),
  items: c({
    type: s("string"),
    enum: l(a())
  }),
  default: l(a()).optional()
}), Uc = c({
  type: s("array"),
  title: a().optional(),
  description: a().optional(),
  minItems: m().optional(),
  maxItems: m().optional(),
  items: c({
    anyOf: l(c({
      const: a(),
      title: a()
    }))
  }),
  default: l(a()).optional()
}), wc = u([Oc, Uc]), $c = u([qc, Ec, wc]), Dc = u([$c, Pc, bc, vc]), Lc = q.extend({
  /**
   * The elicitation mode.
   *
   * Optional for backward compatibility. Clients MUST treat missing mode as "form".
   */
  mode: s("form").optional(),
  /**
   * The message to present to the user describing what information is being requested.
   */
  message: a(),
  /**
   * A restricted subset of JSON Schema.
   * Only top-level properties are allowed, without nesting.
   */
  requestedSchema: c({
    type: s("object"),
    properties: h(a(), Dc),
    required: l(a()).optional()
  })
}), Ac = q.extend({
  /**
   * The elicitation mode.
   */
  mode: s("url"),
  /**
   * The message to present to the user explaining why the interaction is needed.
   */
  message: a(),
  /**
   * The ID of the elicitation, which must be unique within the context of the server.
   * The client MUST treat this ID as an opaque value.
   */
  elicitationId: a(),
  /**
   * The URL that the user should navigate to.
   */
  url: a().url()
}), Mc = u([Lc, Ac]), jc = k.extend({
  method: s("elicitation/create"),
  params: Mc
}), zc = T.extend({
  /**
   * The ID of the elicitation that completed.
   */
  elicitationId: a()
}), Bc = P.extend({
  method: s("notifications/elicitation/complete"),
  params: zc
}), Fc = y.extend({
  /**
   * The user action in response to the elicitation.
   * - "accept": User submitted the form/confirmed the action
   * - "decline": User explicitly decline the action
   * - "cancel": User dismissed without making an explicit choice
   */
  action: x(["accept", "decline", "cancel"]),
  /**
   * The submitted form data, only present when action is "accept".
   * Contains values matching the requested schema.
   * Per MCP spec, content is "typically omitted" for decline/cancel actions.
   * We normalize null to undefined for leniency while maintaining type compatibility.
   */
  content: qe((e) => e === null ? void 0 : e, h(a(), u([a(), m(), Z(), l(a())])).optional())
}), Jc = c({
  type: s("ref/resource"),
  /**
   * The URI or URI template of the resource.
   */
  uri: a()
}), Gc = c({
  type: s("ref/prompt"),
  /**
   * The name of the prompt or prompt template
   */
  name: a()
}), Wc = I.extend({
  ref: u([Gc, Jc]),
  /**
   * The argument's information
   */
  argument: c({
    /**
     * The name of the argument
     */
    name: a(),
    /**
     * The value of the argument to use for completion matching.
     */
    value: a()
  }),
  context: c({
    /**
     * Previously-resolved variables in a URI template or prompt.
     */
    arguments: h(a(), a()).optional()
  }).optional()
}), Vc = k.extend({
  method: s("completion/complete"),
  params: Wc
}), Kc = y.extend({
  completion: _({
    /**
     * An array of completion values. Must not exceed 100 items.
     */
    values: l(a()).max(100),
    /**
     * The total number of completion options available. This can exceed the number of values actually sent in the response.
     */
    total: g(m().int()),
    /**
     * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
     */
    hasMore: g(Z())
  })
}), Hc = c({
  /**
   * The URI identifying the root. This *must* start with file:// for now.
   */
  uri: a().startsWith("file://"),
  /**
   * An optional name for the root.
   */
  name: a().optional(),
  /**
   * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
   * for notes on _meta usage.
   */
  _meta: h(a(), d()).optional()
}), Yc = k.extend({
  method: s("roots/list"),
  params: I.optional()
}), Xc = y.extend({
  roots: l(Hc)
}), Qc = P.extend({
  method: s("notifications/roots/list_changed"),
  params: T.optional()
});
u([
  Me,
  In,
  Vc,
  dc,
  Xn,
  Kn,
  On,
  wn,
  Ln,
  zn,
  Fn,
  mc,
  ic,
  Fe,
  Ge,
  We,
  Ke
]);
u([
  De,
  je,
  Ae,
  Qc,
  Be
]);
u([
  $e,
  Ic,
  Tc,
  Fc,
  Xc,
  Je,
  Ve,
  ze
]);
u([
  Me,
  xc,
  jc,
  Yc,
  Fe,
  Ge,
  We,
  Ke
]);
u([
  De,
  je,
  Sc,
  Gn,
  Mn,
  uc,
  nc,
  Be,
  Bc
]);
u([
  $e,
  Pn,
  Kc,
  ac,
  Hn,
  Un,
  $n,
  An,
  oo,
  rc,
  Je,
  Ve,
  ze
]);
class se extends Error {
  constructor(o, t, n) {
    super(`MCP error ${o}: ${t}`), this.code = o, this.data = n, this.name = "McpError";
  }
  /**
   * Factory method to create the appropriate error type based on the error code and data
   */
  static fromError(o, t, n) {
    if (o === j.UrlElicitationRequired && n) {
      const r = n;
      if (r.elicitations)
        return new es(r.elicitations, t);
    }
    return new se(o, t, n);
  }
}
class es extends se {
  constructor(o, t = `URL elicitation${o.length > 1 ? "s" : ""} required`) {
    super(j.UrlElicitationRequired, t, {
      elicitations: o
    });
  }
  get elicitations() {
    return this.data?.elicitations ?? [];
  }
}
export {
  jc as A,
  Fc as B,
  oo as C,
  xc as D,
  j as E,
  Tc as F,
  Fe as G,
  Ic as H,
  Pn as I,
  ms as J,
  ts as K,
  rc as L,
  se as M,
  _ as N,
  Z as O,
  je as P,
  l as Q,
  dn as R,
  ns as S,
  Be as T,
  a as U,
  c as V,
  s as W,
  as as X,
  m as Y,
  _e as Z,
  us as _,
  De as a,
  Me as b,
  Ge as c,
  We as d,
  Ke as e,
  ls as f,
  ss as g,
  is as h,
  rs as i,
  cs as j,
  ze as k,
  Je as l,
  Ve as m,
  ps as n,
  uc as o,
  nc as p,
  Mn as q,
  pn as r,
  $e as s,
  Kc as t,
  ac as u,
  Hn as v,
  Un as w,
  $n as x,
  An as y,
  ds as z
};
//# sourceMappingURL=types-CkvOiUfs.js.map
