ovr 7.0.0-next.29 → 7.0.0-next.30

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # ovr
2
2
 
3
+ ## 7.0.0-next.30
4
+
5
+ ### Minor Changes
6
+
7
+ - f1fd8db: - The MCP endpoint no longer serves resources: `resources/list`, `resources/templates/list`, and `resources/read` are gone, with the `page://` names. An agent reads a page with its GET route's tool, as every client we connected already did. A file in a tool's result is named by its address.
8
+ - A tool whose route answers with JSON, such as `c.json()`, gives the value as `structuredContent` beside the text, when it is an object.
9
+ - `auth.consent(c)` returns the host the user goes back to as `returns`, where it was `redirect`, since it is a host and not an address.
10
+
3
11
  ## 7.0.0-next.29
4
12
 
5
13
  ### Minor Changes
@@ -151,8 +151,8 @@ export declare namespace Auth {
151
151
  /** Name the agent gives itself, not verified */
152
152
  readonly name: string;
153
153
  };
154
- /** Host the user returns to after deciding */
155
- readonly redirect: string;
154
+ /** Host the user returns to after deciding, the agent's own */
155
+ readonly returns: string;
156
156
  /** Form with Allow, confirmed with the user's passkey, and Deny buttons; custom `children` deny with `formaction="/oauth/deny"` */
157
157
  readonly Form: (props: JSX.IntrinsicElements["form"]) => JSX.Element;
158
158
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,KAAK,OAAO,IAAI,WAAW,EAAY,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,KAAK,QAAQ,EAAc,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE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;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,IAAI,EAAE,CACd,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KACzB,OAAO,CAAC,MAAM,CAAC,CAAC;IAErB,qFAAqF;IACrF,YAAY,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EA4D5C;IAED,2EAA2E;IAC3E,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,CAQ/C;IAgCD,2JAA2J;IAC3J,QAAQ,CAAC,KAAK,MACV,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAC,QACzC,MAAM;;;;OAGX;IAEF,kFAAkF;IAClF,QAAQ,CAAC,MAAM,MAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAC,mBAEhE;IAEF;;;;;;;;OAQG;IACH,QAAQ,CAAC,UAAU,MACf,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAC,UACvC,MAAM,mBAKb;CACF"}
@@ -562,7 +562,7 @@ export function oauth(options, storage, state, resources) {
562
562
  });
563
563
  return {
564
564
  client: { id: pending.client, name: pending.name },
565
- redirect: new URL(pending.redirect).host || pending.redirect,
565
+ returns: new URL(pending.redirect).host || pending.redirect,
566
566
  Form: (props) => Form({
567
567
  ...props,
568
568
  children: [
@@ -52,7 +52,7 @@ export declare namespace Mcp {
52
52
  }
53
53
  /**
54
54
  * Model Context Protocol endpoint. Agents use the app's routes as tools, and
55
- * read its pages as Markdown resources.
55
+ * read its pages as Markdown with the tools of its GET routes.
56
56
  *
57
57
  * ```ts
58
58
  * app.use(new Mcp({ instructions: "Save and organize bookmarks." }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IG;YACH,KAAK,CACJ,GAAG,EAAE,GAAG,CAAC,KAAK,EACd,QAAQ,EAAE,MAAM,GACd,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;SACzC,CAAC;KACF;CACD;AAED;;;;;;;GAOG;AACH,qBAAa,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;;IAuCzC,wCAAwC;IACxC,YAAY,OAAO,GAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAM,EAEvC;IAED;;;;;OAKG;IACH,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,CAgD7D;CAynCD"}
package/dist/mcp/index.js CHANGED
@@ -27,7 +27,7 @@ class RpcError extends Error {
27
27
  }
28
28
  /**
29
29
  * Model Context Protocol endpoint. Agents use the app's routes as tools, and
30
- * read its pages as Markdown resources.
30
+ * read its pages as Markdown with the tools of its GET routes.
31
31
  *
32
32
  * ```ts
33
33
  * app.use(new Mcp({ instructions: "Save and organize bookmarks." }));
@@ -45,12 +45,6 @@ export class Mcp {
45
45
  static #meta = "io.modelcontextprotocol/";
46
46
  /** Largest response an agent reads from a route */
47
47
  static #output = 4 * Size.mb;
48
- /**
49
- * Scheme that names a page of an app agents sign in to. An `https` name
50
- * says the agent can fetch the page itself, which it cannot without the
51
- * user's session, so it reads the page through this endpoint.
52
- */
53
- static #scheme = "page:";
54
48
  /** Redirects followed after a tool call */
55
49
  static #redirects = 5;
56
50
  /**
@@ -377,9 +371,7 @@ export class Mcp {
377
371
  throw Mcp.#mismatch("Mcp-Method", "the request method");
378
372
  const name = method === "tools/call" || method === "prompts/get"
379
373
  ? params.name
380
- : method === "resources/read"
381
- ? params.uri
382
- : undefined;
374
+ : undefined;
383
375
  if (name !== undefined) {
384
376
  let value = c.req.headers.get("mcp-name");
385
377
  if (value === null && optional)
@@ -411,7 +403,7 @@ export class Mcp {
411
403
  /** @returns Server capabilities and instructions */
412
404
  #server() {
413
405
  return {
414
- capabilities: { tools: {}, resources: {} },
406
+ capabilities: { tools: {} },
415
407
  instructions: this.#options.instructions,
416
408
  };
417
409
  }
@@ -440,29 +432,6 @@ export class Mcp {
440
432
  return { tools: this.#tools(), ...cache };
441
433
  case "tools/call":
442
434
  return this.#call(c, params, session);
443
- case "resources/list":
444
- case "resources/templates/list": {
445
- // pages with parameters are templates
446
- const templates = method !== "resources/list";
447
- return {
448
- [templates ? "resourceTemplates" : "resources"]: this.#app.routes.filter((route) => route.method === Method.get &&
449
- route.description &&
450
- /[:*]/.test(route.pattern) === templates).map((route) => {
451
- const href = this.#name(new URL(route.pattern.replace(parameters, (_, name) => name ? `{${name}}` : "{+wildcard}"), c.url));
452
- return {
453
- [templates ? "uriTemplate" : "uri"]: templates
454
- ? href.replaceAll("%7B", "{").replaceAll("%7D", "}")
455
- : href,
456
- name: route.pattern,
457
- description: route.description,
458
- mimeType: Mime.type.md,
459
- };
460
- }),
461
- ...cache,
462
- };
463
- }
464
- case "resources/read":
465
- return this.#resource(c, params, session, legacy);
466
435
  }
467
436
  throw new RpcError(-32601, "Method not found", 404);
468
437
  }
@@ -794,79 +763,6 @@ export class Mcp {
794
763
  // the form's fields among the arguments, which are all a write updates
795
764
  new Set(Object.keys(args).filter((name) => shape && Object.hasOwn(shape, name))));
796
765
  }
797
- /**
798
- * Reads a page as Markdown.
799
- *
800
- * @param c Request context
801
- * @param params `resources/read` params
802
- * @param session Session the token authorizes
803
- * @returns Resource contents
804
- */
805
- async #resource(c, params, session, legacy) {
806
- const uri = String(params.uri);
807
- let url;
808
- try {
809
- url = new URL(uri);
810
- // a page by its name, or by its address, as a link in a page gives it
811
- if (url.protocol === Mcp.#scheme)
812
- url = new URL(url.pathname + url.search + url.hash, `${c.url.protocol}//${url.host}`);
813
- }
814
- catch {
815
- throw new RpcError(-32602, "Invalid resource URI");
816
- }
817
- // its own code before 2026-07-28, invalid params since
818
- const missing = () => new RpcError(legacy ? -32002 : -32602, "Resource not found", 200, {
819
- uri,
820
- });
821
- // a page read as the user is theirs alone, and may change at any time
822
- const cache = {
823
- ttlMs: 0,
824
- cacheScope: this.#options.auth ? "private" : "public",
825
- };
826
- if (!this.#readable(c, url))
827
- throw missing();
828
- const res = await this.#run(c, session, url);
829
- // the page's form has issues, such as a search with invalid parameters
830
- if (typeof res === "string")
831
- throw new RpcError(-32602, res);
832
- if (res.status >= 500)
833
- throw await Mcp.#failed(res);
834
- // a stream is only from a page that succeeds, so it passes the checks below
835
- const { type, live, ...body } = await Mcp.#body(res);
836
- if (res.status === 404)
837
- throw missing();
838
- // refused, such as a 403: the request's to change, where a server error
839
- // above is the app's
840
- if (!res.ok) {
841
- const retry = res.headers.get("retry-after");
842
- throw new RpcError(-32602, `${res.status} ${body.text || res.statusText}`.trim(), 200, {
843
- uri,
844
- status: res.status,
845
- ...(retry !== null && { retryAfter: retry }),
846
- });
847
- }
848
- return {
849
- contents: [
850
- {
851
- uri: this.#name(url),
852
- ...(live
853
- ? { mimeType: Mime.type.text, text: this.#stream(url) }
854
- : { mimeType: type ?? Mime.type.md, ...body }),
855
- },
856
- ],
857
- ...cache,
858
- };
859
- }
860
- /**
861
- * @param url A page's address
862
- * @returns The page's resource name: its address, or with sign-in the same
863
- * host and path as a `page:` URI
864
- */
865
- #name(url) {
866
- return this.#options.auth
867
- ? `${Mcp.#scheme}//${url.host}${url.pathname}${url.search}${url.hash}`
868
- : url.href;
869
- }
870
766
  /**
871
767
  * @param url Address of a route that answers with an event stream
872
768
  * @returns What to tell the agent, a stream may never end so it is not read
@@ -1074,20 +970,41 @@ export class Mcp {
1074
970
  .replace(/[^\w .-]+/g, "_")
1075
971
  .slice(0, 100), false, {
1076
972
  type: "resource",
1077
- resource: { uri: this.#name(url), mimeType: type, text },
973
+ resource: { uri: url.href, mimeType: type, text },
1078
974
  });
1079
- return Mcp.#result([redirected && redirect(redirected), !res.ok && Mcp.#status(res), text]
1080
- .filter(Boolean)
1081
- .join("\n\n"), !res.ok,
1082
- // a file, as a person would download or see it
1083
- blob === undefined
1084
- ? undefined
1085
- : kind === "image" || kind === "audio"
1086
- ? { type: kind, data: blob, mimeType: type }
1087
- : {
1088
- type: "resource",
1089
- resource: { uri: this.#name(url), mimeType: type, blob },
1090
- });
975
+ // JSON a route answers with, such as `c.json()`, is also given as
976
+ // data, so a client need not parse the text. Only an object: the
977
+ // protocol's structured content is one
978
+ let data;
979
+ if (res.ok && text && /^application\/(.+\+)?json$/i.test(type ?? "")) {
980
+ try {
981
+ data = JSON.parse(text);
982
+ }
983
+ catch {
984
+ // said to be JSON and is not, so it stays text
985
+ }
986
+ }
987
+ return {
988
+ ...Mcp.#result([
989
+ redirected && redirect(redirected),
990
+ !res.ok && Mcp.#status(res),
991
+ text,
992
+ ]
993
+ .filter(Boolean)
994
+ .join("\n\n"), !res.ok,
995
+ // a file, as a person would download or see it
996
+ blob === undefined
997
+ ? undefined
998
+ : kind === "image" || kind === "audio"
999
+ ? { type: kind, data: blob, mimeType: type }
1000
+ : {
1001
+ type: "resource",
1002
+ resource: { uri: url.href, mimeType: type, blob },
1003
+ }),
1004
+ ...(data !== null &&
1005
+ typeof data === "object" &&
1006
+ !Array.isArray(data) && { structuredContent: data }),
1007
+ };
1091
1008
  }
1092
1009
  }
1093
1010
  /**
@@ -334,7 +334,7 @@ export declare class Route<Pattern extends string = string, Params extends Route
334
334
  get tool(): Route.Tool | undefined;
335
335
  /**
336
336
  * Describe the route for agents. Only described routes are served to
337
- * them: as MCP tools, and GET routes as resources too.
337
+ * them, as MCP tools.
338
338
  *
339
339
  * @template D Description, a string literal that is not blank
340
340
  * @param description What the route does, written for an agent, not blank
@@ -118,7 +118,7 @@ export class Route {
118
118
  }
119
119
  /**
120
120
  * Describe the route for agents. Only described routes are served to
121
- * them: as MCP tools, and GET routes as resources too.
121
+ * them, as MCP tools.
122
122
  *
123
123
  * @template D Description, a string literal that is not blank
124
124
  * @param description What the route does, written for an agent, not blank
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ovr",
3
3
  "description": "Web apps anyone can use. Each route serves people a page and agents Markdown and MCP tools, with forms, Postgres, and passkey sign-in built in.",
4
- "version": "7.0.0-next.29",
4
+ "version": "7.0.0-next.30",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
package/src/auth/index.ts CHANGED
@@ -206,8 +206,8 @@ export namespace Auth {
206
206
  /** Name the agent gives itself, not verified */
207
207
  readonly name: string;
208
208
  };
209
- /** Host the user returns to after deciding */
210
- readonly redirect: string;
209
+ /** Host the user returns to after deciding, the agent's own */
210
+ readonly returns: string;
211
211
  /** Form with Allow, confirmed with the user's passkey, and Deny buttons; custom `children` deny with `formaction="/oauth/deny"` */
212
212
  readonly Form: (props: JSX.IntrinsicElements["form"]) => JSX.Element;
213
213
  }
package/src/auth/oauth.ts CHANGED
@@ -708,7 +708,7 @@ export function oauth(
708
708
 
709
709
  return {
710
710
  client: { id: pending.client, name: pending.name },
711
- redirect: new URL(pending.redirect).host || pending.redirect,
711
+ returns: new URL(pending.redirect).host || pending.redirect,
712
712
  Form: (props) =>
713
713
  Form({
714
714
  ...props,
@@ -17,7 +17,9 @@ server:
17
17
  - elicitation-sep1034-defaults
18
18
  - elicitation-sep1330-enums
19
19
 
20
- # resources read by a fixed URI
20
+ # resources are an optional feature that ovr does not have: an agent reads
21
+ # a page with its GET route's tool
22
+ - resources-list
21
23
  - resources-read-text
22
24
  - resources-read-binary
23
25
  - resources-templates-read
@@ -24,13 +24,18 @@ server:
24
24
  - server-stateless:sep-2575-http-server-no-independent-requests-on-stream
25
25
  - server-stateless:sep-2575-server-no-log-without-loglevel
26
26
 
27
- # resources read by a fixed URI
27
+ # resources are an optional feature that ovr does not have: an agent reads
28
+ # a page with its GET route's tool
29
+ - resources-list
30
+ - sep-2164-resource-not-found
31
+ - caching:sep-2549-resources-list-caching-hints
32
+ - caching:sep-2549-resources-templates-list-caching-hints
28
33
  - resources-read-text
29
34
  - resources-read-binary
30
35
  - resources-templates-read
31
36
 
32
37
  # prompts and completion are optional features that ovr does not have, a
33
- # route is a tool or a resource
38
+ # route is a tool
34
39
  - prompts-list
35
40
  - prompts-get-simple
36
41
  - prompts-get-with-args
package/src/mcp/index.ts CHANGED
@@ -106,7 +106,7 @@ export namespace Mcp {
106
106
 
107
107
  /**
108
108
  * Model Context Protocol endpoint. Agents use the app's routes as tools, and
109
- * read its pages as Markdown resources.
109
+ * read its pages as Markdown with the tools of its GET routes.
110
110
  *
111
111
  * ```ts
112
112
  * app.use(new Mcp({ instructions: "Save and organize bookmarks." }));
@@ -128,13 +128,6 @@ export class Mcp<P extends string = string> {
128
128
  /** Largest response an agent reads from a route */
129
129
  static readonly #output = 4 * Size.mb;
130
130
 
131
- /**
132
- * Scheme that names a page of an app agents sign in to. An `https` name
133
- * says the agent can fetch the page itself, which it cannot without the
134
- * user's session, so it reads the page through this endpoint.
135
- */
136
- static readonly #scheme = "page:";
137
-
138
131
  /** Redirects followed after a tool call */
139
132
  static readonly #redirects = 5;
140
133
 
@@ -546,9 +539,7 @@ export class Mcp<P extends string = string> {
546
539
  const name =
547
540
  method === "tools/call" || method === "prompts/get"
548
541
  ? params.name
549
- : method === "resources/read"
550
- ? params.uri
551
- : undefined;
542
+ : undefined;
552
543
 
553
544
  if (name !== undefined) {
554
545
  let value = c.req.headers.get("mcp-name");
@@ -580,7 +571,7 @@ export class Mcp<P extends string = string> {
580
571
  /** @returns Server capabilities and instructions */
581
572
  #server() {
582
573
  return {
583
- capabilities: { tools: {}, resources: {} },
574
+ capabilities: { tools: {} },
584
575
  instructions: this.#options.instructions,
585
576
  };
586
577
  }
@@ -616,40 +607,6 @@ export class Mcp<P extends string = string> {
616
607
  return { tools: this.#tools(), ...cache };
617
608
  case "tools/call":
618
609
  return this.#call(c, params, session);
619
- case "resources/list":
620
- case "resources/templates/list": {
621
- // pages with parameters are templates
622
- const templates = method !== "resources/list";
623
- return {
624
- [templates ? "resourceTemplates" : "resources"]:
625
- this.#app!.routes.filter(
626
- (route) =>
627
- route.method === Method.get &&
628
- route.description &&
629
- /[:*]/.test(route.pattern) === templates,
630
- ).map((route) => {
631
- const href = this.#name(
632
- new URL(
633
- route.pattern.replace(parameters, (_, name?: string) =>
634
- name ? `{${name}}` : "{+wildcard}",
635
- ),
636
- c.url,
637
- ),
638
- );
639
- return {
640
- [templates ? "uriTemplate" : "uri"]: templates
641
- ? href.replaceAll("%7B", "{").replaceAll("%7D", "}")
642
- : href,
643
- name: route.pattern,
644
- description: route.description,
645
- mimeType: Mime.type.md,
646
- };
647
- }),
648
- ...cache,
649
- };
650
- }
651
- case "resources/read":
652
- return this.#resource(c, params, session, legacy);
653
610
  }
654
611
 
655
612
  throw new RpcError(-32601, "Method not found", 404);
@@ -1053,92 +1010,6 @@ export class Mcp<P extends string = string> {
1053
1010
  );
1054
1011
  }
1055
1012
 
1056
- /**
1057
- * Reads a page as Markdown.
1058
- *
1059
- * @param c Request context
1060
- * @param params `resources/read` params
1061
- * @param session Session the token authorizes
1062
- * @returns Resource contents
1063
- */
1064
- async #resource(c: Context, params: Json, session: unknown, legacy: boolean) {
1065
- const uri = String(params.uri);
1066
- let url: URL;
1067
- try {
1068
- url = new URL(uri);
1069
- // a page by its name, or by its address, as a link in a page gives it
1070
- if (url.protocol === Mcp.#scheme)
1071
- url = new URL(
1072
- url.pathname + url.search + url.hash,
1073
- `${c.url.protocol}//${url.host}`,
1074
- );
1075
- } catch {
1076
- throw new RpcError(-32602, "Invalid resource URI");
1077
- }
1078
-
1079
- // its own code before 2026-07-28, invalid params since
1080
- const missing = () =>
1081
- new RpcError(legacy ? -32002 : -32602, "Resource not found", 200, {
1082
- uri,
1083
- });
1084
- // a page read as the user is theirs alone, and may change at any time
1085
- const cache = {
1086
- ttlMs: 0,
1087
- cacheScope: this.#options.auth ? "private" : "public",
1088
- };
1089
-
1090
- if (!this.#readable(c, url)) throw missing();
1091
-
1092
- const res = await this.#run(c, session, url);
1093
- // the page's form has issues, such as a search with invalid parameters
1094
- if (typeof res === "string") throw new RpcError(-32602, res);
1095
-
1096
- if (res.status >= 500) throw await Mcp.#failed(res);
1097
-
1098
- // a stream is only from a page that succeeds, so it passes the checks below
1099
- const { type, live, ...body } = await Mcp.#body(res);
1100
-
1101
- if (res.status === 404) throw missing();
1102
- // refused, such as a 403: the request's to change, where a server error
1103
- // above is the app's
1104
- if (!res.ok) {
1105
- const retry = res.headers.get("retry-after");
1106
- throw new RpcError(
1107
- -32602,
1108
- `${res.status} ${body.text || res.statusText}`.trim(),
1109
- 200,
1110
- {
1111
- uri,
1112
- status: res.status,
1113
- ...(retry !== null && { retryAfter: retry }),
1114
- },
1115
- );
1116
- }
1117
-
1118
- return {
1119
- contents: [
1120
- {
1121
- uri: this.#name(url),
1122
- ...(live
1123
- ? { mimeType: Mime.type.text, text: this.#stream(url) }
1124
- : { mimeType: type ?? Mime.type.md, ...body }),
1125
- },
1126
- ],
1127
- ...cache,
1128
- };
1129
- }
1130
-
1131
- /**
1132
- * @param url A page's address
1133
- * @returns The page's resource name: its address, or with sign-in the same
1134
- * host and path as a `page:` URI
1135
- */
1136
- #name(url: URL) {
1137
- return this.#options.auth
1138
- ? `${Mcp.#scheme}//${url.host}${url.pathname}${url.search}${url.hash}`
1139
- : url.href;
1140
- }
1141
-
1142
1013
  /**
1143
1014
  * @param url Address of a route that answers with an event stream
1144
1015
  * @returns What to tell the agent, a stream may never end so it is not read
@@ -1389,25 +1260,46 @@ export class Mcp<P extends string = string> {
1389
1260
  false,
1390
1261
  {
1391
1262
  type: "resource",
1392
- resource: { uri: this.#name(url), mimeType: type, text },
1263
+ resource: { uri: url.href, mimeType: type, text },
1393
1264
  },
1394
1265
  );
1395
1266
 
1396
- return Mcp.#result(
1397
- [redirected && redirect(redirected), !res.ok && Mcp.#status(res), text]
1398
- .filter(Boolean)
1399
- .join("\n\n"),
1400
- !res.ok,
1401
- // a file, as a person would download or see it
1402
- blob === undefined
1403
- ? undefined
1404
- : kind === "image" || kind === "audio"
1405
- ? { type: kind, data: blob, mimeType: type }
1406
- : {
1407
- type: "resource",
1408
- resource: { uri: this.#name(url), mimeType: type, blob },
1409
- },
1410
- );
1267
+ // JSON a route answers with, such as `c.json()`, is also given as
1268
+ // data, so a client need not parse the text. Only an object: the
1269
+ // protocol's structured content is one
1270
+ let data: unknown;
1271
+ if (res.ok && text && /^application\/(.+\+)?json$/i.test(type ?? "")) {
1272
+ try {
1273
+ data = JSON.parse(text);
1274
+ } catch {
1275
+ // said to be JSON and is not, so it stays text
1276
+ }
1277
+ }
1278
+
1279
+ return {
1280
+ ...Mcp.#result(
1281
+ [
1282
+ redirected && redirect(redirected),
1283
+ !res.ok && Mcp.#status(res),
1284
+ text,
1285
+ ]
1286
+ .filter(Boolean)
1287
+ .join("\n\n"),
1288
+ !res.ok,
1289
+ // a file, as a person would download or see it
1290
+ blob === undefined
1291
+ ? undefined
1292
+ : kind === "image" || kind === "audio"
1293
+ ? { type: kind, data: blob, mimeType: type }
1294
+ : {
1295
+ type: "resource",
1296
+ resource: { uri: url.href, mimeType: type, blob },
1297
+ },
1298
+ ),
1299
+ ...(data !== null &&
1300
+ typeof data === "object" &&
1301
+ !Array.isArray(data) && { structuredContent: data }),
1302
+ };
1411
1303
  }
1412
1304
  }
1413
1305
 
@@ -589,7 +589,7 @@ export class Route<
589
589
 
590
590
  /**
591
591
  * Describe the route for agents. Only described routes are served to
592
- * them: as MCP tools, and GET routes as resources too.
592
+ * them, as MCP tools.
593
593
  *
594
594
  * @template D Description, a string literal that is not blank
595
595
  * @param description What the route does, written for an agent, not blank