xmcp 1.7.1 → 1.7.2
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/client.js +1 -1
- package/dist/index.js +1 -1
- package/dist/runtime/adapter-express.js +1 -1
- package/dist/runtime/adapter-fastify.js +1 -1
- package/dist/runtime/adapter-fetch-cloudflare.js +1 -1
- package/dist/runtime/adapter-fetch.js +1 -1
- package/dist/runtime/adapter-nestjs.js +1 -1
- package/dist/runtime/adapter-nextjs.js +1 -1
- package/dist/runtime/cloudflare-worker.js +1 -1
- package/dist/runtime/http.js +11 -11
- package/dist/runtime/stdio.js +1 -1
- package/dist/runtime/utils/transformers/resource.d.ts +3 -3
- package/dist/runtime/vercel.js +1 -1
- package/package.json +1 -1
|
@@ -219,7 +219,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let c=l.js
|
|
|
219
219
|
<div id="root"></div>
|
|
220
220
|
${t}
|
|
221
221
|
</body>
|
|
222
|
-
</html>`);return{contents:[{uri:i.uri,text:d,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let s=i.handler({},r);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:i.uri,text:s,mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};u?.(i.name,i.uri),t.registerResource(i.name,i.uri,s,l)}),o.forEach((r,a)=>{let i={name:fj(a),description:"No description provided"},{default:n,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(i,o),!1===i.enabled)return;let c={};fT(s)?c=s:null!=s&&console.warn(`Invalid schema for resource "${i.name}" at ${a}. Expected Record<string, z.ZodType>`);let d=fZ(a);if(!d)return void console.warn(`Skipping resource "${i.name}" at ${a}: Invalid file path format`);let p=d.uriTemplate;i.mimeType&&i.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,a={}){let i=fZ(r);if(!i)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,n)=>{let o=t(function(t,r,a){let i={},n={};if(0===r.parameters.length)return n;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],a=c[t],n=r.match(/^\{(.+)\}$/);n&&(i[n[1]]=a)}for(let t of r.parameters){let r=i[t],o=a[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){n[t]=r;continue}try{n[t]=o.parse(r)}catch(a){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${a instanceof Error?a.message:String(a)}`)}}return n}(r.href,i,a),n);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${t}: ${r}
|
|
222
|
+
</html>`);return{contents:[{uri:i.uri,text:d,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let s=i.handler({},r);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:i.uri,text:s,mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};u?.(i.name,i.uri),t.registerResource(i.name,i.uri,s,l)}),o.forEach((r,a)=>{let i={name:fj(a),description:"No description provided"},{default:n,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(i,o),!1===i.enabled)return;let c={};fT(s)?c=s:null!=s&&console.warn(`Invalid schema for resource "${i.name}" at ${a}. Expected Record<string, z.ZodType>`);let d=fZ(a);if(!d)return void console.warn(`Skipping resource "${i.name}" at ${a}: Invalid file path format`);let p=d.uriTemplate;i.mimeType&&i.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,a={}){let i=fZ(r);if(!i)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,n)=>{let o=t(function(t,r,a){let i={},n={};if(0===r.parameters.length)return n;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],a=c[t],n=r.match(/^\{(.+)\}$/);n&&(i[n[1]]=a)}for(let t of r.parameters){let r=i[t],o=a[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){n[t]=r;continue}try{n[t]=o.parse(r)}catch(a){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${a instanceof Error?a.message:String(a)}`)}}return n}(r.href,i,a),n);if(o instanceof Promise&&(o=await o),cG(o))return o;if("string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult, InputRequiredResult, or string. Got ${t}: ${r}
|
|
223
223
|
|
|
224
224
|
Expected ReadResourceResult format:
|
|
225
225
|
{
|
|
@@ -219,7 +219,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let c=l.js
|
|
|
219
219
|
<div id="root"></div>
|
|
220
220
|
${t}
|
|
221
221
|
</body>
|
|
222
|
-
</html>`);return{contents:[{uri:i.uri,text:d,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let s=i.handler({},r);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:i.uri,text:s,mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};u?.(i.name,i.uri),t.registerResource(i.name,i.uri,s,l)}),o.forEach((r,a)=>{let i={name:fT(a),description:"No description provided"},{default:n,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(i,o),!1===i.enabled)return;let c={};fj(s)?c=s:null!=s&&console.warn(`Invalid schema for resource "${i.name}" at ${a}. Expected Record<string, z.ZodType>`);let d=fZ(a);if(!d)return void console.warn(`Skipping resource "${i.name}" at ${a}: Invalid file path format`);let p=d.uriTemplate;i.mimeType&&i.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,a={}){let i=fZ(r);if(!i)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,n)=>{let o=t(function(t,r,a){let i={},n={};if(0===r.parameters.length)return n;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],a=c[t],n=r.match(/^\{(.+)\}$/);n&&(i[n[1]]=a)}for(let t of r.parameters){let r=i[t],o=a[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){n[t]=r;continue}try{n[t]=o.parse(r)}catch(a){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${a instanceof Error?a.message:String(a)}`)}}return n}(r.href,i,a),n);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${t}: ${r}
|
|
222
|
+
</html>`);return{contents:[{uri:i.uri,text:d,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let s=i.handler({},r);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:i.uri,text:s,mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};u?.(i.name,i.uri),t.registerResource(i.name,i.uri,s,l)}),o.forEach((r,a)=>{let i={name:fT(a),description:"No description provided"},{default:n,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(i,o),!1===i.enabled)return;let c={};fj(s)?c=s:null!=s&&console.warn(`Invalid schema for resource "${i.name}" at ${a}. Expected Record<string, z.ZodType>`);let d=fZ(a);if(!d)return void console.warn(`Skipping resource "${i.name}" at ${a}: Invalid file path format`);let p=d.uriTemplate;i.mimeType&&i.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,a={}){let i=fZ(r);if(!i)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,n)=>{let o=t(function(t,r,a){let i={},n={};if(0===r.parameters.length)return n;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],a=c[t],n=r.match(/^\{(.+)\}$/);n&&(i[n[1]]=a)}for(let t of r.parameters){let r=i[t],o=a[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){n[t]=r;continue}try{n[t]=o.parse(r)}catch(a){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${a instanceof Error?a.message:String(a)}`)}}return n}(r.href,i,a),n);if(o instanceof Promise&&(o=await o),cG(o))return o;if("string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult, InputRequiredResult, or string. Got ${t}: ${r}
|
|
223
223
|
|
|
224
224
|
Expected ReadResourceResult format:
|
|
225
225
|
{
|
|
@@ -215,7 +215,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let l=s.js
|
|
|
215
215
|
<div id="root"></div>
|
|
216
216
|
${t}
|
|
217
217
|
</body>
|
|
218
|
-
</html>`);return{contents:[{uri:i.uri,text:u,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let o=i.handler({},r);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:i.uri,text:o,mimeType:n,_meta:i._meta}]};if(o&&"object"==typeof o&&"_meta"in o&&!("content"in o))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(o&&"object"==typeof o&&"content"in o&&Array.isArray(o.content)){let t=o.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};c?.(i.name,i.uri),t.registerResource(i.name,i.uri,o,s)}),a.forEach((r,i)=>{let n={name:mY(i),description:"No description provided"},{default:a,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(n,o),!1===n.enabled)return;let u={};mK(s)?u=s:null!=s&&console.warn(`Invalid schema for resource "${n.name}" at ${i}. Expected Record<string, z.ZodType>`);let d=m5(i);if(!d)return void console.warn(`Skipping resource "${n.name}" at ${i}: Invalid file path format`);let p=d.uriTemplate;n.mimeType&&n.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,i={}){let n=m5(r);if(!n)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,a)=>{let o=t(function(t,r,i){let n={},a={};if(0===r.parameters.length)return a;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],i=c[t],a=r.match(/^\{(.+)\}$/);a&&(n[a[1]]=i)}for(let t of r.parameters){let r=n[t],o=i[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){a[t]=r;continue}try{a[t]=o.parse(r)}catch(i){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${i instanceof Error?i.message:String(i)}`)}}return a}(r.href,n,i),a);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${t}: ${r}
|
|
218
|
+
</html>`);return{contents:[{uri:i.uri,text:u,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let o=i.handler({},r);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:i.uri,text:o,mimeType:n,_meta:i._meta}]};if(o&&"object"==typeof o&&"_meta"in o&&!("content"in o))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(o&&"object"==typeof o&&"content"in o&&Array.isArray(o.content)){let t=o.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};c?.(i.name,i.uri),t.registerResource(i.name,i.uri,o,s)}),a.forEach((r,i)=>{let n={name:mY(i),description:"No description provided"},{default:a,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(n,o),!1===n.enabled)return;let u={};mK(s)?u=s:null!=s&&console.warn(`Invalid schema for resource "${n.name}" at ${i}. Expected Record<string, z.ZodType>`);let d=m5(i);if(!d)return void console.warn(`Skipping resource "${n.name}" at ${i}: Invalid file path format`);let p=d.uriTemplate;n.mimeType&&n.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,i={}){let n=m5(r);if(!n)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,a)=>{let o=t(function(t,r,i){let n={},a={};if(0===r.parameters.length)return a;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],i=c[t],a=r.match(/^\{(.+)\}$/);a&&(n[a[1]]=i)}for(let t of r.parameters){let r=n[t],o=i[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){a[t]=r;continue}try{a[t]=o.parse(r)}catch(i){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${i instanceof Error?i.message:String(i)}`)}}return a}(r.href,n,i),a);if(o instanceof Promise&&(o=await o),cX(o))return o;if("string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult, InputRequiredResult, or string. Got ${t}: ${r}
|
|
219
219
|
|
|
220
220
|
Expected ReadResourceResult format:
|
|
221
221
|
{
|
|
@@ -219,7 +219,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let c=l.js
|
|
|
219
219
|
<div id="root"></div>
|
|
220
220
|
${t}
|
|
221
221
|
</body>
|
|
222
|
-
</html>`);return{contents:[{uri:a.uri,text:d,mimeType:i,_meta:a._meta}]}}catch(t){throw console.error(`React failed for ${a.name}:`,t),t}let s=a.handler({},r);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:a.uri,text:s,mimeType:i,_meta:a._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:a.uri,text:t.text,mimeType:i,_meta:a._meta}]}}return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]}};u?.(a.name,a.uri),t.registerResource(a.name,a.uri,s,l)}),o.forEach((r,a)=>{let i={name:fc(a),description:"No description provided"},{default:n,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(i,o),!1===i.enabled)return;let c={};fl(s)?c=s:null!=s&&console.warn(`Invalid schema for resource "${i.name}" at ${a}. Expected Record<string, z.ZodType>`);let d=f_(a);if(!d)return void console.warn(`Skipping resource "${i.name}" at ${a}: Invalid file path format`);let p=d.uriTemplate;i.mimeType&&i.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,a={}){let i=f_(r);if(!i)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,n)=>{let o=t(function(t,r,a){let i={},n={};if(0===r.parameters.length)return n;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],a=c[t],n=r.match(/^\{(.+)\}$/);n&&(i[n[1]]=a)}for(let t of r.parameters){let r=i[t],o=a[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){n[t]=r;continue}try{n[t]=o.parse(r)}catch(a){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${a instanceof Error?a.message:String(a)}`)}}return n}(r.href,i,a),n);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${t}: ${r}
|
|
222
|
+
</html>`);return{contents:[{uri:a.uri,text:d,mimeType:i,_meta:a._meta}]}}catch(t){throw console.error(`React failed for ${a.name}:`,t),t}let s=a.handler({},r);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:a.uri,text:s,mimeType:i,_meta:a._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:a.uri,text:t.text,mimeType:i,_meta:a._meta}]}}return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]}};u?.(a.name,a.uri),t.registerResource(a.name,a.uri,s,l)}),o.forEach((r,a)=>{let i={name:fc(a),description:"No description provided"},{default:n,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(i,o),!1===i.enabled)return;let c={};fl(s)?c=s:null!=s&&console.warn(`Invalid schema for resource "${i.name}" at ${a}. Expected Record<string, z.ZodType>`);let d=f_(a);if(!d)return void console.warn(`Skipping resource "${i.name}" at ${a}: Invalid file path format`);let p=d.uriTemplate;i.mimeType&&i.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,a={}){let i=f_(r);if(!i)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,n)=>{let o=t(function(t,r,a){let i={},n={};if(0===r.parameters.length)return n;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],a=c[t],n=r.match(/^\{(.+)\}$/);n&&(i[n[1]]=a)}for(let t of r.parameters){let r=i[t],o=a[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){n[t]=r;continue}try{n[t]=o.parse(r)}catch(a){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${a instanceof Error?a.message:String(a)}`)}}return n}(r.href,i,a),n);if(o instanceof Promise&&(o=await o),cK(o))return o;if("string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult, InputRequiredResult, or string. Got ${t}: ${r}
|
|
223
223
|
|
|
224
224
|
Expected ReadResourceResult format:
|
|
225
225
|
{
|
|
@@ -219,7 +219,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let l=c.js
|
|
|
219
219
|
<div id="root"></div>
|
|
220
220
|
${t}
|
|
221
221
|
</body>
|
|
222
|
-
</html>`);return{contents:[{uri:r.uri,text:u,mimeType:n,_meta:r._meta}]}}catch(t){throw console.error(`React failed for ${r.name}:`,t),t}let s=r.handler({},a);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:r.uri,text:s,mimeType:n,_meta:r._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:r.uri,text:"",mimeType:n,_meta:r._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:r.uri,text:t.text,mimeType:n,_meta:r._meta}]}}return{contents:[{uri:r.uri,text:"",mimeType:n,_meta:r._meta}]}};p?.(r.name,r.uri),t.registerResource(r.name,r.uri,s,c)}),o.forEach((a,r)=>{let i={name:hT(r),description:"No description provided"},{default:n,metadata:o,schema:s,complete:c}=a;if("object"==typeof o&&null!==o&&Object.assign(i,o),!1===i.enabled)return;let l={};hP(s)?l=s:null!=s&&console.warn(`Invalid schema for resource "${i.name}" at ${r}. Expected Record<string, z.ZodType>`);let u=hD(r);if(!u)return void console.warn(`Skipping resource "${i.name}" at ${r}: Invalid file path format`);let d=u.uriTemplate;i.mimeType&&i.mimeType.includes("html")&&(d=d.endsWith(".html")?d:`${d}.html`);let m=function(t,a,r={}){let i=hD(a);if(!i)throw Error(`Invalid resource file path: ${a}. Must follow (scheme)/path/[param] convention.`);return async(a,n)=>{let o=t(function(t,a,r){let i={},n={};if(0===a.parameters.length)return n;let o=a.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",c=o.split("/"),l=s.split("/");for(let t=0;t<c.length&&t<l.length;t++){let a=c[t],r=l[t],n=a.match(/^\{(.+)\}$/);n&&(i[n[1]]=r)}for(let t of a.parameters){let a=i[t],o=r[t];if(void 0===a)throw Error(`Missing required parameter: ${t}`);if(!o){n[t]=a;continue}try{n[t]=o.parse(a)}catch(r){throw Error(`Invalid parameter "${t}": ${a}. Validation error: ${r instanceof Error?r.message:String(r)}`)}}return n}(a.href,i,r),n);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:a.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,a=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${t}: ${a}
|
|
222
|
+
</html>`);return{contents:[{uri:r.uri,text:u,mimeType:n,_meta:r._meta}]}}catch(t){throw console.error(`React failed for ${r.name}:`,t),t}let s=r.handler({},a);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:r.uri,text:s,mimeType:n,_meta:r._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:r.uri,text:"",mimeType:n,_meta:r._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:r.uri,text:t.text,mimeType:n,_meta:r._meta}]}}return{contents:[{uri:r.uri,text:"",mimeType:n,_meta:r._meta}]}};p?.(r.name,r.uri),t.registerResource(r.name,r.uri,s,c)}),o.forEach((a,r)=>{let i={name:hT(r),description:"No description provided"},{default:n,metadata:o,schema:s,complete:c}=a;if("object"==typeof o&&null!==o&&Object.assign(i,o),!1===i.enabled)return;let l={};hP(s)?l=s:null!=s&&console.warn(`Invalid schema for resource "${i.name}" at ${r}. Expected Record<string, z.ZodType>`);let u=hD(r);if(!u)return void console.warn(`Skipping resource "${i.name}" at ${r}: Invalid file path format`);let d=u.uriTemplate;i.mimeType&&i.mimeType.includes("html")&&(d=d.endsWith(".html")?d:`${d}.html`);let m=function(t,a,r={}){let i=hD(a);if(!i)throw Error(`Invalid resource file path: ${a}. Must follow (scheme)/path/[param] convention.`);return async(a,n)=>{let o=t(function(t,a,r){let i={},n={};if(0===a.parameters.length)return n;let o=a.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",c=o.split("/"),l=s.split("/");for(let t=0;t<c.length&&t<l.length;t++){let a=c[t],r=l[t],n=a.match(/^\{(.+)\}$/);n&&(i[n[1]]=r)}for(let t of a.parameters){let a=i[t],o=r[t];if(void 0===a)throw Error(`Missing required parameter: ${t}`);if(!o){n[t]=a;continue}try{n[t]=o.parse(a)}catch(r){throw Error(`Invalid parameter "${t}": ${a}. Validation error: ${r instanceof Error?r.message:String(r)}`)}}return n}(a.href,i,r),n);if(o instanceof Promise&&(o=await o),lW(o))return o;if("string"==typeof o)return{contents:[{uri:a.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,a=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult, InputRequiredResult, or string. Got ${t}: ${a}
|
|
223
223
|
|
|
224
224
|
Expected ReadResourceResult format:
|
|
225
225
|
{
|
|
@@ -219,7 +219,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let c=l.js
|
|
|
219
219
|
<div id="root"></div>
|
|
220
220
|
${t}
|
|
221
221
|
</body>
|
|
222
|
-
</html>`);return{contents:[{uri:i.uri,text:d,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let s=i.handler({},r);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:i.uri,text:s,mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};u?.(i.name,i.uri),t.registerResource(i.name,i.uri,s,l)}),o.forEach((r,a)=>{let i={name:fc(a),description:"No description provided"},{default:n,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(i,o),!1===i.enabled)return;let c={};fl(s)?c=s:null!=s&&console.warn(`Invalid schema for resource "${i.name}" at ${a}. Expected Record<string, z.ZodType>`);let d=f_(a);if(!d)return void console.warn(`Skipping resource "${i.name}" at ${a}: Invalid file path format`);let p=d.uriTemplate;i.mimeType&&i.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,a={}){let i=f_(r);if(!i)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,n)=>{let o=t(function(t,r,a){let i={},n={};if(0===r.parameters.length)return n;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],a=c[t],n=r.match(/^\{(.+)\}$/);n&&(i[n[1]]=a)}for(let t of r.parameters){let r=i[t],o=a[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){n[t]=r;continue}try{n[t]=o.parse(r)}catch(a){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${a instanceof Error?a.message:String(a)}`)}}return n}(r.href,i,a),n);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${t}: ${r}
|
|
222
|
+
</html>`);return{contents:[{uri:i.uri,text:d,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let s=i.handler({},r);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:i.uri,text:s,mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let t=s.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};u?.(i.name,i.uri),t.registerResource(i.name,i.uri,s,l)}),o.forEach((r,a)=>{let i={name:fc(a),description:"No description provided"},{default:n,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(i,o),!1===i.enabled)return;let c={};fl(s)?c=s:null!=s&&console.warn(`Invalid schema for resource "${i.name}" at ${a}. Expected Record<string, z.ZodType>`);let d=f_(a);if(!d)return void console.warn(`Skipping resource "${i.name}" at ${a}: Invalid file path format`);let p=d.uriTemplate;i.mimeType&&i.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,a={}){let i=f_(r);if(!i)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,n)=>{let o=t(function(t,r,a){let i={},n={};if(0===r.parameters.length)return n;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],a=c[t],n=r.match(/^\{(.+)\}$/);n&&(i[n[1]]=a)}for(let t of r.parameters){let r=i[t],o=a[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){n[t]=r;continue}try{n[t]=o.parse(r)}catch(a){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${a instanceof Error?a.message:String(a)}`)}}return n}(r.href,i,a),n);if(o instanceof Promise&&(o=await o),cB(o))return o;if("string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult, InputRequiredResult, or string. Got ${t}: ${r}
|
|
223
223
|
|
|
224
224
|
Expected ReadResourceResult format:
|
|
225
225
|
{
|
|
@@ -215,7 +215,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let l=s.js
|
|
|
215
215
|
<div id="root"></div>
|
|
216
216
|
${t}
|
|
217
217
|
</body>
|
|
218
|
-
</html>`);return{contents:[{uri:i.uri,text:u,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let o=i.handler({},r);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:i.uri,text:o,mimeType:n,_meta:i._meta}]};if(o&&"object"==typeof o&&"_meta"in o&&!("content"in o))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(o&&"object"==typeof o&&"content"in o&&Array.isArray(o.content)){let t=o.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};c?.(i.name,i.uri),t.registerResource(i.name,i.uri,o,s)}),a.forEach((r,i)=>{let n={name:mX(i),description:"No description provided"},{default:a,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(n,o),!1===n.enabled)return;let u={};mY(s)?u=s:null!=s&&console.warn(`Invalid schema for resource "${n.name}" at ${i}. Expected Record<string, z.ZodType>`);let d=m7(i);if(!d)return void console.warn(`Skipping resource "${n.name}" at ${i}: Invalid file path format`);let p=d.uriTemplate;n.mimeType&&n.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,i={}){let n=m7(r);if(!n)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,a)=>{let o=t(function(t,r,i){let n={},a={};if(0===r.parameters.length)return a;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],i=c[t],a=r.match(/^\{(.+)\}$/);a&&(n[a[1]]=i)}for(let t of r.parameters){let r=n[t],o=i[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){a[t]=r;continue}try{a[t]=o.parse(r)}catch(i){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${i instanceof Error?i.message:String(i)}`)}}return a}(r.href,n,i),a);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${t}: ${r}
|
|
218
|
+
</html>`);return{contents:[{uri:i.uri,text:u,mimeType:n,_meta:i._meta}]}}catch(t){throw console.error(`React failed for ${i.name}:`,t),t}let o=i.handler({},r);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:i.uri,text:o,mimeType:n,_meta:i._meta}]};if(o&&"object"==typeof o&&"_meta"in o&&!("content"in o))return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]};if(o&&"object"==typeof o&&"content"in o&&Array.isArray(o.content)){let t=o.content.find(t=>"text"===t.type);if(t&&"text"===t.type&&"string"==typeof t.text)return{contents:[{uri:i.uri,text:t.text,mimeType:n,_meta:i._meta}]}}return{contents:[{uri:i.uri,text:"",mimeType:n,_meta:i._meta}]}};c?.(i.name,i.uri),t.registerResource(i.name,i.uri,o,s)}),a.forEach((r,i)=>{let n={name:mX(i),description:"No description provided"},{default:a,metadata:o,schema:s,complete:l}=r;if("object"==typeof o&&null!==o&&Object.assign(n,o),!1===n.enabled)return;let u={};mY(s)?u=s:null!=s&&console.warn(`Invalid schema for resource "${n.name}" at ${i}. Expected Record<string, z.ZodType>`);let d=m7(i);if(!d)return void console.warn(`Skipping resource "${n.name}" at ${i}: Invalid file path format`);let p=d.uriTemplate;n.mimeType&&n.mimeType.includes("html")&&(p=p.endsWith(".html")?p:`${p}.html`);let m=function(t,r,i={}){let n=m7(r);if(!n)throw Error(`Invalid resource file path: ${r}. Must follow (scheme)/path/[param] convention.`);return async(r,a)=>{let o=t(function(t,r,i){let n={},a={};if(0===r.parameters.length)return a;let o=r.uriTemplate.split("://")[1]||"",s=t.split("://")[1]||"",l=o.split("/"),c=s.split("/");for(let t=0;t<l.length&&t<c.length;t++){let r=l[t],i=c[t],a=r.match(/^\{(.+)\}$/);a&&(n[a[1]]=i)}for(let t of r.parameters){let r=n[t],o=i[t];if(void 0===r)throw Error(`Missing required parameter: ${t}`);if(!o){a[t]=r;continue}try{a[t]=o.parse(r)}catch(i){throw Error(`Invalid parameter "${t}": ${r}. Validation error: ${i instanceof Error?i.message:String(i)}`)}}return a}(r.href,n,i),a);if(o instanceof Promise&&(o=await o),cX(o))return o;if("string"==typeof o)return{contents:[{uri:r.href,text:o}]};if(!o||"object"!=typeof o||!Array.isArray(o.contents)){let t=null===o?"null":typeof o,r=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Resource handler must return a ReadResourceResult, InputRequiredResult, or string. Got ${t}: ${r}
|
|
219
219
|
|
|
220
220
|
Expected ReadResourceResult format:
|
|
221
221
|
{
|