@emseepea/create-tool-server 0.0.6 → 0.0.8

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.
@@ -6,23 +6,35 @@ import {
6
6
  createConversation,
7
7
  } from "@emseepea/testing/semantic";
8
8
 
9
- test("keeps pea variety details distinct", async (t) => {
9
+ test("looks up pea varieties and compares a follow-up", async (t) => {
10
10
  const chat = await createConversation(t, {
11
11
  server: new URL("../dist/server.js", import.meta.url),
12
12
  });
13
- const response = await chat.send(
13
+
14
+ // The first turn's flexible prose needs the one model judge. The follow-up's
15
+ // exact call and returned name add context coverage without another judge.
16
+ const highland = await chat.send(
14
17
  "Describe the pea type, growth habit, maturity time, and traits of Highland Snap.",
15
18
  );
16
19
 
17
- assertToolCalls(response, [{
20
+ assertToolCalls(highland, [{
18
21
  name: "get-pea-variety",
19
22
  arguments: { name: "Highland Snap" },
20
23
  }]);
21
- assertResponseContains(response, "Highland Snap");
22
- await assertResponseMeaning(response, {
24
+ assertResponseContains(highland, "Highland Snap");
25
+ await assertResponseMeaning(highland, {
23
26
  expected:
24
27
  "Highland Snap is a climbing snap pea that matures in 70 days, has edible " +
25
28
  "pods, and needs support. Pea type, growth habit, maturity time, and traits " +
26
29
  "remain distinct.",
27
30
  });
31
+
32
+ const comparison = await chat.send(
33
+ "Compare that with Harbour Gem. Include its pea type, growth habit, and maturity time.",
34
+ );
35
+ assertToolCalls(comparison, [{
36
+ name: "get-pea-variety",
37
+ arguments: { name: "Harbour Gem" },
38
+ }]);
39
+ assertResponseContains(comparison, "Harbour Gem");
28
40
  });
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "private": true,
26
26
  "dependencies": {
27
- "@emseepea/server": "0.3.0",
27
+ "@emseepea/server": "0.3.1",
28
28
  "zod": "4.4.3"
29
29
  }
30
30
  }
@@ -2,14 +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 peaVarietySchema = z.object({
5
+ const inputSchema = z.object({ name: z.enum(varietyNames) });
6
+ const outputSchema = z.object({
6
7
  name: z.enum(varietyNames),
7
8
  peaType: z.enum(["shelling", "snap"]),
8
9
  growthHabit: z.enum(["bush", "climbing"]),
9
10
  daysToMaturity: z.number().int().positive(),
10
11
  traits: z.array(z.string()),
11
12
  });
12
- const varieties: Record<(typeof varietyNames)[number], z.input<typeof peaVarietySchema>> = {
13
+ const varieties: Record<(typeof varietyNames)[number], z.input<typeof outputSchema>> = {
13
14
  "Harbour Gem": {
14
15
  name: "Harbour Gem",
15
16
  peaType: "shelling",
@@ -31,8 +32,8 @@ export default (() => defineTool({
31
32
  access: "public",
32
33
  title: "Pea Variety Details",
33
34
  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,
35
+ inputSchema,
36
+ outputSchema,
36
37
  handler: ({ name }) => {
37
38
  const data = varieties[name];
38
39
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emseepea/create-tool-server",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
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.1",
22
22
  "zod": "4.4.3",
23
23
  "@emseepea/testing": "0.3.0",
24
24
  "@types/node": "24.13.3",