Skip to content

Commit 87f5d4c

Browse files
committed
Add note to tools docs
1 parent 1ff6146 commit 87f5d4c

File tree

1 file changed

+5
-1
lines changed
  • src/content/docs/agents/model-context-protocol/mcp-server

1 file changed

+5
-1
lines changed

src/content/docs/agents/model-context-protocol/mcp-server/tools.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Render } from "~/components";
1111

1212
Model Context Protocol (MCP) tools are functions that a [MCP Server](/agents/model-context-protocol/mcp-server) provides and MCP clients can call.
1313

14-
When you build MCP Servers with the `@cloudflare/model-context-protocol` package, you can define tools by writing JavaScript or TypeScript methods and decorating them with the `@mcp.tool` decorator. This removes the need to manually implement the tool discovery, serialization, and invocation logic.
14+
When you build MCP Servers with the `@cloudflare/model-context-protocol` package, you can define tools by writing JavaScript or TypeScript methods and decorating them with the `@mcp.tool` [decorator](https://github.com/tc39/proposal-decorators). This removes the need to manually implement the tool discovery, serialization, and invocation logic.
1515

1616
For example, the following code defines a simple MCP server that adds two numbers together:
1717

@@ -35,3 +35,7 @@ class McpEntrypoint extends WorkerEntrypoint {
3535
```
3636

3737
In this example, the `add` method is decorated with the `@mcp.tool` decorator, which adds the tool to the MCP server and provides the tool's description, input parameters, and return type.
38+
39+
:::note
40+
Because decorators are a [Stage 3 TC39 proposed addition to the JavaScript language](https://github.com/tc39/proposal-decorators), to use decorators in your code, and to use the Cloudflare MCP Server SDK, you must use Wrangler v4.0.0 or later, or [`@cloudflare/vite-plugin`](https://www.npmjs.com/package/@cloudflare/vite-plugin). This ensures that decorators in your code are automatically transpiled into code that the [Cloudflare Workers runtime](/workers/reference/how-workers-works/) can understand.
41+
:::

0 commit comments

Comments
 (0)