@emseepea/create-tool-server 0.0.8 → 0.0.10

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.
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "private": true,
26
26
  "dependencies": {
27
- "@emseepea/server": "0.3.1",
27
+ "@emseepea/server": "0.3.3",
28
28
  "zod": "4.4.3"
29
29
  }
30
30
  }
@@ -2,13 +2,15 @@ import { defineTool, type CapabilityModuleFactory } from "@emseepea/server";
2
2
  import { z } from "zod";
3
3
 
4
4
  const varietyNames = ["Harbour Gem", "Highland Snap"] as const;
5
- const inputSchema = z.object({ name: z.enum(varietyNames) });
5
+ const inputSchema = z.object({
6
+ name: z.enum(varietyNames).describe("Sample pea variety to look up."),
7
+ });
6
8
  const outputSchema = z.object({
7
- name: z.enum(varietyNames),
8
- peaType: z.enum(["shelling", "snap"]),
9
- growthHabit: z.enum(["bush", "climbing"]),
10
- daysToMaturity: z.number().int().positive(),
11
- traits: z.array(z.string()),
9
+ name: z.enum(varietyNames).describe("Name of the pea variety."),
10
+ peaType: z.enum(["shelling", "snap"]).describe("Whether the variety is grown for shelled peas or edible pods."),
11
+ growthHabit: z.enum(["bush", "climbing"]).describe("Whether the plant grows as a compact bush or a climbing vine."),
12
+ daysToMaturity: z.number().int().positive().describe("Approximate days from sowing until the first harvest."),
13
+ traits: z.array(z.string()).describe("Notable growing or eating qualities of the variety."),
12
14
  });
13
15
  const varieties: Record<(typeof varietyNames)[number], z.input<typeof outputSchema>> = {
14
16
  "Harbour Gem": {
@@ -34,12 +36,5 @@ export default (() => defineTool({
34
36
  description: "Get the type, growth habit, maturity time, and traits of a sample pea variety.",
35
37
  inputSchema,
36
38
  outputSchema,
37
- handler: ({ name }) => {
38
- const data = varieties[name];
39
- return {
40
- text: `${data.name} is a ${data.peaType} pea with a ${data.growthHabit} habit. ` +
41
- `It matures in ${data.daysToMaturity} days and is known for ${data.traits.join(" and ")}.`,
42
- data,
43
- };
44
- },
39
+ handler: ({ name }) => ({ data: varieties[name] }),
45
40
  })) satisfies CapabilityModuleFactory;
@@ -9,6 +9,13 @@ test("advertises and returns understandable pea variety details", async (t) => {
9
9
 
10
10
  const listed = await client.listTools();
11
11
  assert.deepEqual(listed.tools.map(({ name }) => name), ["get-pea-variety"]);
12
+ const tool = listed.tools[0];
13
+ assert.equal(tool.inputSchema.properties.name.description, "Sample pea variety to look up.");
14
+ assert.equal(tool.outputSchema.properties.name.description, "Name of the pea variety.");
15
+ assert.equal(tool.outputSchema.properties.peaType.description, "Whether the variety is grown for shelled peas or edible pods.");
16
+ assert.equal(tool.outputSchema.properties.growthHabit.description, "Whether the plant grows as a compact bush or a climbing vine.");
17
+ assert.equal(tool.outputSchema.properties.daysToMaturity.description, "Approximate days from sowing until the first harvest.");
18
+ assert.equal(tool.outputSchema.properties.traits.description, "Notable growing or eating qualities of the variety.");
12
19
 
13
20
  const result = await client.callTool({
14
21
  name: "get-pea-variety",
@@ -22,4 +29,5 @@ test("advertises and returns understandable pea variety details", async (t) => {
22
29
  daysToMaturity: 70,
23
30
  traits: ["edible pods", "needs support"],
24
31
  });
32
+ assert.equal(result.content[0].text, JSON.stringify(result.structuredContent));
25
33
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emseepea/create-tool-server",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Create an Em See Pea server with one public tool.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  "prepack": "npm run build:initializer"
19
19
  },
20
20
  "devDependencies": {
21
- "@emseepea/server": "0.3.1",
21
+ "@emseepea/server": "0.3.3",
22
22
  "zod": "4.4.3",
23
23
  "@emseepea/testing": "0.3.0",
24
24
  "@types/node": "24.13.3",