@aws/nx-plugin 0.25.1 → 0.25.3
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/README.md +6 -4
- package/package.json +1 -1
- package/src/mcp-server/server.js +3 -1
- package/src/mcp-server/server.js.map +1 -1
- package/src/mcp-server/tools/create-workspace-command.js +1 -1
- package/src/mcp-server/tools/create-workspace-command.js.map +1 -1
- package/src/mcp-server/tools/general-guidance.js +5 -2
- package/src/mcp-server/tools/general-guidance.js.map +1 -1
- package/src/mcp-server/tools/generator-guide.js +1 -1
- package/src/mcp-server/tools/generator-guide.js.map +1 -1
- package/src/mcp-server/tools/list-generators.js +1 -1
- package/src/mcp-server/tools/list-generators.js.map +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +8 -3
- package/src/ts/mcp-server/files/src/server.ts.template +1 -1
package/README.md
CHANGED
|
@@ -96,9 +96,9 @@ pnpm nx g @aws/nx-plugin:ts#infra
|
|
|
96
96
|
|
|
97
97
|
### Additional resources
|
|
98
98
|
|
|
99
|
-
- Use [Quick Start](https://awslabs.github.io/nx-plugin-for-aws/get_started/quick-start/) to get a taste of @aws/nx-plugin.
|
|
100
|
-
- [Build a Dungeon Adventure Game](https://awslabs.github.io/nx-plugin-for-aws/get_started/tutorials/dungeon-game/overview/) to get an in-depth guided tutorial on how to use the @aws/nx-plugin.
|
|
101
|
-
- [Add @aws/nx-plugin to your existing project](https://awslabs.github.io/nx-plugin-for-aws/get_started/tutorials/existing-project/)
|
|
99
|
+
- Use [Quick Start](https://awslabs.github.io/nx-plugin-for-aws/en/get_started/quick-start/) to get a taste of @aws/nx-plugin.
|
|
100
|
+
- [Build a Dungeon Adventure Game](https://awslabs.github.io/nx-plugin-for-aws/en/get_started/tutorials/dungeon-game/overview/) to get an in-depth guided tutorial on how to use the @aws/nx-plugin.
|
|
101
|
+
- [Add @aws/nx-plugin to your existing project](https://awslabs.github.io/nx-plugin-for-aws/en/get_started/tutorials/existing-project/)
|
|
102
102
|
|
|
103
103
|
## MCP Server Installation and Setup
|
|
104
104
|
|
|
@@ -114,7 +114,7 @@ Example configuration for Amazon Q CLI MCP (`~/.aws/amazonq/mcp.json`):
|
|
|
114
114
|
"mcpServers": {
|
|
115
115
|
"aws-nx-mcp": {
|
|
116
116
|
"command": "npx",
|
|
117
|
-
"args": ["-p", "@aws/nx-plugin", "aws-nx-mcp"]
|
|
117
|
+
"args": ["-y", "-p", "@aws/nx-plugin", "aws-nx-mcp"]
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -122,6 +122,8 @@ Example configuration for Amazon Q CLI MCP (`~/.aws/amazonq/mcp.json`):
|
|
|
122
122
|
|
|
123
123
|
If you have issues such as `ENOENT npx`, replace the command with `/full/path/to/npx` (use `which npx` to find this).
|
|
124
124
|
|
|
125
|
+
For more details, [take a look at the guide here](https://awslabs.github.io/nx-plugin-for-aws/en/get_started/building-with-ai/)
|
|
126
|
+
|
|
125
127
|
## Documentation Translation
|
|
126
128
|
|
|
127
129
|
The project supports automatic translation of documentation using AWS Bedrock's Deepseek & Haiku 3.5 models. Documentation is translated from English to multiple languages (currently Japanese, with support for French, Spanish, German, Chinese, and Korean).
|
package/package.json
CHANGED
package/src/mcp-server/server.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createServer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
/**
|
|
5
6
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
7
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -11,6 +12,7 @@ const create_workspace_command_1 = require("./tools/create-workspace-command");
|
|
|
11
12
|
const list_generators_1 = require("./tools/list-generators");
|
|
12
13
|
const generator_guide_1 = require("./tools/generator-guide");
|
|
13
14
|
const general_guidance_1 = require("./tools/general-guidance");
|
|
15
|
+
const package_json_1 = tslib_1.__importDefault(require("../../package.json"));
|
|
14
16
|
/**
|
|
15
17
|
* Create the MCP Server
|
|
16
18
|
*/
|
|
@@ -18,7 +20,7 @@ const createServer = () => {
|
|
|
18
20
|
const generators = (0, nx_1.listGenerators)();
|
|
19
21
|
const server = new mcp_js_1.McpServer({
|
|
20
22
|
name: 'nx-plugin-for-aws',
|
|
21
|
-
version:
|
|
23
|
+
version: package_json_1.default.version,
|
|
22
24
|
}, {
|
|
23
25
|
instructions: `# Nx Plugin for AWS MCP Server
|
|
24
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/mcp-server/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/mcp-server/server.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,oEAAoE;AACpE,oCAA6C;AAC7C,+EAAiF;AACjF,6DAAgE;AAChE,6DAAgE;AAChE,+DAGkC;AAClC,8EAA6C;AAE7C;;GAEG;AACI,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,MAAM,UAAU,GAAG,IAAA,mBAAc,GAAE,CAAC;IAEpC,MAAM,MAAM,GAAG,IAAI,kBAAS,CAC1B;QACE,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,sBAAW,CAAC,OAAO;KAC7B,EACD;QACE,YAAY,EAAE;;;;;;;EAOlB,uCAAoB;CACrB;KACI,CACF,CAAC;IAEF,IAAA,yCAAsB,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC3C,IAAA,wDAA6B,EAAC,MAAM,CAAC,CAAC;IACtC,IAAA,uCAAqB,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC1C,IAAA,uCAAqB,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAE1C,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA3BW,QAAA,YAAY,gBA2BvB"}
|
|
@@ -7,7 +7,7 @@ const schema_1 = require("../schema");
|
|
|
7
7
|
* Add a tool which tells a model how to create an Nx workspace
|
|
8
8
|
*/
|
|
9
9
|
const addCreateWorkspaceCommandTool = (server) => {
|
|
10
|
-
server.tool('create-workspace-command', { workspaceName: zod_1.z.string(), packageManager: schema_1.PackageManagerSchema }, ({ workspaceName, packageManager }) => ({
|
|
10
|
+
server.tool('create-workspace-command', 'Tool to discover how to create a workspace to start a new project.', { workspaceName: zod_1.z.string(), packageManager: schema_1.PackageManagerSchema }, ({ workspaceName, packageManager }) => ({
|
|
11
11
|
content: [
|
|
12
12
|
{
|
|
13
13
|
type: 'text',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-workspace-command.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/create-workspace-command.ts"],"names":[],"mappings":";;;AAKA,6BAAwB;AACxB,sCAAiD;AAEjD;;GAEG;AACI,MAAM,6BAA6B,GAAG,CAAC,MAAiB,EAAE,EAAE;IACjE,MAAM,CAAC,IAAI,CACT,0BAA0B,EAC1B,EAAE,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,cAAc,EAAE,6BAAoB,EAAE,EACnE,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC;QACtC,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE;;;kCAGkB,aAAa,SAAS,cAAc;;;kEAGJ,aAAa;;;;KAI1E,aAAa,wBAAwB,aAAa;;;;GAIpD;aACM;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"create-workspace-command.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/create-workspace-command.ts"],"names":[],"mappings":";;;AAKA,6BAAwB;AACxB,sCAAiD;AAEjD;;GAEG;AACI,MAAM,6BAA6B,GAAG,CAAC,MAAiB,EAAE,EAAE;IACjE,MAAM,CAAC,IAAI,CACT,0BAA0B,EAC1B,oEAAoE,EACpE,EAAE,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,cAAc,EAAE,6BAAoB,EAAE,EACnE,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC;QACtC,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE;;;kCAGkB,aAAa,SAAS,cAAc;;;kEAGJ,aAAa;;;;KAI1E,aAAa,wBAAwB,aAAa;;;;GAIpD;aACM;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AA5BW,QAAA,6BAA6B,iCA4BxC"}
|
|
@@ -14,7 +14,7 @@ exports.TOOL_SELECTION_GUIDE = `## Tool Selection Guide
|
|
|
14
14
|
* Add a tool which provides general guidance for using Nx and the Nx Plugin for AWS
|
|
15
15
|
*/
|
|
16
16
|
const addGeneralGuidanceTool = (server, generators) => {
|
|
17
|
-
server.tool('general-guidance', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
server.tool('general-guidance', 'Tool for guidance and best practices for working with Nx and the Nx Plugin for AWS', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
18
18
|
return ({
|
|
19
19
|
content: [
|
|
20
20
|
{
|
|
@@ -35,7 +35,7 @@ ${exports.TOOL_SELECTION_GUIDE}
|
|
|
35
35
|
${schema_1.PACKAGE_MANAGERS.map((pm) => (0, generator_info_1.buildNxCommand)('<options>', pm)).join(' - \n')}
|
|
36
36
|
- Each project in your workspace has a file named \`project.json\` which contains important project information such as its name, and defines the "targets" which can be run for that project, for example building or testing the project
|
|
37
37
|
- Use the command \`nx reset\` to reset the Nx daemon when unexpected issues arise
|
|
38
|
-
- After adding dependencies between projects, use \`nx sync\` to ensure project references are set up correctly
|
|
38
|
+
- After adding dependencies between TypeScript projects, use \`nx sync\` to ensure project references are set up correctly
|
|
39
39
|
|
|
40
40
|
## General Instructions
|
|
41
41
|
|
|
@@ -56,8 +56,11 @@ ${schema_1.PACKAGE_MANAGERS.map((pm) => (0, generator_info_1.buildNxCommand)('<o
|
|
|
56
56
|
|
|
57
57
|
## Best Practices
|
|
58
58
|
|
|
59
|
+
- After running a generator, use the \`nx show projects\` command to check which projects have been added (if any)
|
|
60
|
+
- Carefully examine the files that have been generated and always refer back to the generator guide when working in a generated project
|
|
59
61
|
- Generate all projects into the \`packages/\` directory
|
|
60
62
|
- After making changes to your projects, fix linting issues, then run a full build
|
|
63
|
+
- When it's time to start testing a project, suggest to the user that infrastructure is deployed to AWS. For websites, if a runtime-config.json is needed, use the load:runtime-config target after a deployment to point a local website at a sandbox stack.
|
|
61
64
|
|
|
62
65
|
## Language Specific Guidance
|
|
63
66
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general-guidance.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/general-guidance.ts"],"names":[],"mappings":";;;;AAMA,sCAA6C;AAC7C,sDAAoE;AAEvD,QAAA,oBAAoB,GAAG;;;;;gGAK4D,CAAC;AAEjG;;GAEG;AACI,MAAM,sBAAsB,GAAG,CACpC,MAAiB,EACjB,UAA6B,EAC7B,EAAE;IACF,MAAM,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"general-guidance.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/general-guidance.ts"],"names":[],"mappings":";;;;AAMA,sCAA6C;AAC7C,sDAAoE;AAEvD,QAAA,oBAAoB,GAAG;;;;;gGAK4D,CAAC;AAEjG;;GAEG;AACI,MAAM,sBAAsB,GAAG,CACpC,MAAiB,EACjB,UAA6B,EAC7B,EAAE;IACF,MAAM,CAAC,IAAI,CACT,kBAAkB,EAClB,oFAAoF,EACpF,GAAS,EAAE;QAAC,OAAA,CAAC;YACX,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;EAEd,4BAAoB;;;;2DAIqC,yBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;EAOpF,yBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAA,+BAAc,EAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkC3E,MAAM,IAAA,gCAAe,EAAC,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,EAAE,UAAU,CAAC;;KAExE;iBACI;aACF;SACF,CAAC,CAAA;MAAA,CACH,CAAC;AACJ,CAAC,CAAC;AAjEW,QAAA,sBAAsB,0BAiEjC"}
|
|
@@ -9,7 +9,7 @@ const schema_1 = require("../schema");
|
|
|
9
9
|
* Add a tool which provides a detailed guide for an individual generator
|
|
10
10
|
*/
|
|
11
11
|
const addGeneratorGuideTool = (server, generators) => {
|
|
12
|
-
server.tool('generator-guide', {
|
|
12
|
+
server.tool('generator-guide', 'Tool to retrieve detailed information about a specific generator.', {
|
|
13
13
|
packageManager: schema_1.PackageManagerSchema,
|
|
14
14
|
generator: zod_1.z.custom((v) => generators.map((g) => g.id).includes(v)),
|
|
15
15
|
}, (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ packageManager, generator: generatorId }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator-guide.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/generator-guide.ts"],"names":[],"mappings":";;;;AAMA,6BAAwB;AACxB,sDAG2B;AAC3B,sCAAiD;AAEjD;;GAEG;AACI,MAAM,qBAAqB,GAAG,CACnC,MAAiB,EACjB,UAA6B,EAC7B,EAAE;IACF,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB;QACE,cAAc,EAAE,6BAAoB;QACpC,SAAS,EAAE,OAAC,CAAC,MAAM,CAAS,CAAC,CAAC,EAAE,EAAE,CAChC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACxC;KACF,EACD,KAAmD,EAAE,oDAA9C,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE;QAC/C,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC;QAC/D,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,8BAA8B,WAAW,2BAA2B,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC7G,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,MAAM,IAAA,oCAAmB,EAAC,cAAc,EAAE,SAAS,CAAC;;;;EAIpE,MAAM,IAAA,4CAA2B,EAAC,SAAS,EAAE,UAAU,EAAE,cAAc,CAAC;CACzE;iBACU;aACF;SACF,CAAC;IACJ,CAAC,CAAA,CACF,CAAC;AACJ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"generator-guide.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/generator-guide.ts"],"names":[],"mappings":";;;;AAMA,6BAAwB;AACxB,sDAG2B;AAC3B,sCAAiD;AAEjD;;GAEG;AACI,MAAM,qBAAqB,GAAG,CACnC,MAAiB,EACjB,UAA6B,EAC7B,EAAE;IACF,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,mEAAmE,EACnE;QACE,cAAc,EAAE,6BAAoB;QACpC,SAAS,EAAE,OAAC,CAAC,MAAM,CAAS,CAAC,CAAC,EAAE,EAAE,CAChC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACxC;KACF,EACD,KAAmD,EAAE,oDAA9C,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE;QAC/C,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC;QAC/D,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,8BAA8B,WAAW,2BAA2B,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC7G,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,MAAM,IAAA,oCAAmB,EAAC,cAAc,EAAE,SAAS,CAAC;;;;EAIpE,MAAM,IAAA,4CAA2B,EAAC,SAAS,EAAE,UAAU,EAAE,cAAc,CAAC;CACzE;iBACU;aACF;SACF,CAAC;IACJ,CAAC,CAAA,CACF,CAAC;AACJ,CAAC,CAAC;AApCW,QAAA,qBAAqB,yBAoChC"}
|
|
@@ -7,7 +7,7 @@ const generator_info_1 = require("../generator-info");
|
|
|
7
7
|
* Adds a tool which lists details about the available generators
|
|
8
8
|
*/
|
|
9
9
|
const addListGeneratorsTool = (server, generators) => {
|
|
10
|
-
server.tool('list-generators', { packageManager: schema_1.PackageManagerSchema }, ({ packageManager }) => ({
|
|
10
|
+
server.tool('list-generators', 'Tool to discover the available generators and how to run them.', { packageManager: schema_1.PackageManagerSchema }, ({ packageManager }) => ({
|
|
11
11
|
content: [
|
|
12
12
|
{
|
|
13
13
|
type: 'text',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-generators.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/list-generators.ts"],"names":[],"mappings":";;;AAKA,sCAAiD;AACjD,sDAAwD;AAGxD;;GAEG;AACI,MAAM,qBAAqB,GAAG,CACnC,MAAiB,EACjB,UAA6B,EAC7B,EAAE;IACF,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,EAAE,cAAc,EAAE,6BAAoB,EAAE,EACxC,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC;QACvB,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE;;IAEZ,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,IAAA,oCAAmB,EAAC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;GACpF;aACM;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"list-generators.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/list-generators.ts"],"names":[],"mappings":";;;AAKA,sCAAiD;AACjD,sDAAwD;AAGxD;;GAEG;AACI,MAAM,qBAAqB,GAAG,CACnC,MAAiB,EACjB,UAA6B,EAC7B,EAAE;IACF,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,gEAAgE,EAChE,EAAE,cAAc,EAAE,6BAAoB,EAAE,EACxC,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC;QACvB,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE;;IAEZ,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,IAAA,oCAAmB,EAAC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;GACpF;aACM;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,qBAAqB,yBAoBhC"}
|
|
@@ -207,9 +207,14 @@ export const createServer = () => {
|
|
|
207
207
|
});
|
|
208
208
|
|
|
209
209
|
// Add an addition tool
|
|
210
|
-
server.tool(
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
server.tool(
|
|
211
|
+
'add',
|
|
212
|
+
'adds two numbers',
|
|
213
|
+
{ a: z.number(), b: z.number() },
|
|
214
|
+
async ({ a, b }) => ({
|
|
215
|
+
content: [{ type: 'text', text: String(a + b) }],
|
|
216
|
+
}),
|
|
217
|
+
);
|
|
213
218
|
|
|
214
219
|
// Add a resource which provides context from a markdown file
|
|
215
220
|
server.resource('example-context', 'example://context', async (uri) => ({
|