@emseepea/create-tool-server 0.0.7 → 0.0.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.
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "private": true,
26
26
  "dependencies": {
27
- "@emseepea/server": "0.3.0",
27
+ "@emseepea/server": "0.3.2",
28
28
  "zod": "4.4.3"
29
29
  }
30
30
  }
@@ -2,14 +2,17 @@ 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 peaVarietySchema = z.object({
6
- name: z.enum(varietyNames),
7
- peaType: z.enum(["shelling", "snap"]),
8
- growthHabit: z.enum(["bush", "climbing"]),
9
- daysToMaturity: z.number().int().positive(),
10
- traits: z.array(z.string()),
5
+ const inputSchema = z.object({
6
+ name: z.enum(varietyNames).describe("Sample pea variety to look up."),
11
7
  });
12
- const varieties: Record<(typeof varietyNames)[number], z.input<typeof peaVarietySchema>> = {
8
+ const outputSchema = z.object({
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."),
14
+ });
15
+ const varieties: Record<(typeof varietyNames)[number], z.input<typeof outputSchema>> = {
13
16
  "Harbour Gem": {
14
17
  name: "Harbour Gem",
15
18
  peaType: "shelling",
@@ -31,8 +34,8 @@ export default (() => defineTool({
31
34
  access: "public",
32
35
  title: "Pea Variety Details",
33
36
  description: "Get the type, growth habit, maturity time, and traits of a sample pea variety.",
34
- inputSchema: z.object({ name: z.enum(varietyNames) }),
35
- outputSchema: peaVarietySchema,
37
+ inputSchema,
38
+ outputSchema,
36
39
  handler: ({ name }) => {
37
40
  const data = varieties[name];
38
41
  return {
@@ -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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emseepea/create-tool-server",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
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.0",
21
+ "@emseepea/server": "0.3.2",
22
22
  "zod": "4.4.3",
23
23
  "@emseepea/testing": "0.3.0",
24
24
  "@types/node": "24.13.3",