@decocms/runtime 1.2.8 → 1.2.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/runtime",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "check": "tsc --noEmit",
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@cloudflare/workers-types": "^4.20250617.0",
11
11
  "@decocms/bindings": "^1.0.7",
12
- "@modelcontextprotocol/sdk": "1.25.3",
12
+ "@modelcontextprotocol/sdk": "1.26.0",
13
13
  "@ai-sdk/provider": "^3.0.0",
14
14
  "hono": "^4.10.7",
15
15
  "jose": "^6.0.11",
package/src/index.ts CHANGED
@@ -195,7 +195,7 @@ export const withBindings = <TEnv>({
195
195
 
196
196
  context = {
197
197
  authorization,
198
- state: decoded.state ?? metadata.state,
198
+ state: decoded.state ?? metadata.state ?? {},
199
199
  token: tokenOrContext,
200
200
  meshUrl: (decoded.meshUrl as string) ?? metadata.meshUrl,
201
201
  connectionId: (decoded.connectionId as string) ?? metadata.connectionId,
package/src/tools.ts CHANGED
@@ -7,7 +7,10 @@ import {
7
7
  } from "@decocms/bindings";
8
8
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
9
  import { WebStandardStreamableHTTPServerTransport as HttpServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
10
- import type { GetPromptResult } from "@modelcontextprotocol/sdk/types.js";
10
+ import type {
11
+ GetPromptResult,
12
+ ToolAnnotations,
13
+ } from "@modelcontextprotocol/sdk/types.js";
11
14
  import { z } from "zod";
12
15
  import type { ZodRawShape, ZodSchema, ZodTypeAny } from "zod";
13
16
  import { BindingRegistry } from "./bindings.ts";
@@ -47,6 +50,7 @@ export interface Tool<
47
50
  _meta?: Record<string, unknown>;
48
51
  id: string;
49
52
  description?: string;
53
+ annotations?: ToolAnnotations;
50
54
  inputSchema: TSchemaIn;
51
55
  outputSchema?: TSchemaOut;
52
56
  execute(
@@ -76,6 +80,7 @@ export type CreatedTool = {
76
80
  _meta?: Record<string, unknown>;
77
81
  id: string;
78
82
  description?: string;
83
+ annotations?: ToolAnnotations;
79
84
  inputSchema: ZodTypeAny;
80
85
  outputSchema?: ZodTypeAny;
81
86
  streamable?: true;
@@ -86,8 +91,11 @@ export type CreatedTool = {
86
91
  }): Promise<unknown>;
87
92
  };
88
93
 
89
- // Re-export GetPromptResult for external use
90
- export type { GetPromptResult } from "@modelcontextprotocol/sdk/types.js";
94
+ // Re-export types for external use
95
+ export type {
96
+ GetPromptResult,
97
+ ToolAnnotations,
98
+ } from "@modelcontextprotocol/sdk/types.js";
91
99
 
92
100
  /**
93
101
  * Prompt argument schema shape - must be string types per MCP specification.
@@ -530,7 +538,7 @@ const getEventBus = (
530
538
  const bus = env as unknown as { [prop]: EventBusBindingClient };
531
539
  return typeof bus[prop] !== "undefined"
532
540
  ? bus[prop]
533
- : env?.MESH_REQUEST_CONTEXT.state[prop];
541
+ : env?.MESH_REQUEST_CONTEXT?.state?.[prop];
534
542
  };
535
543
 
536
544
  const toolsFor = <TSchema extends ZodTypeAny = never>({
@@ -713,6 +721,7 @@ export const createMCPServer = <
713
721
  ...(tool._meta ?? {}),
714
722
  },
715
723
  description: tool.description,
724
+ annotations: tool.annotations,
716
725
  inputSchema:
717
726
  tool.inputSchema && "shape" in tool.inputSchema
718
727
  ? (tool.inputSchema.shape as ZodRawShape)