@emseepea/server 0.3.1 → 0.3.2
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 +31 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,17 +20,22 @@ import { createEmseepea, defineMappedTool, defineTool, serveEmseepea } from "@em
|
|
|
20
20
|
import { z } from "zod";
|
|
21
21
|
|
|
22
22
|
const outputSchema = z.object({
|
|
23
|
-
name: z.string(),
|
|
24
|
-
peaType: z.enum(["shelling", "snap"])
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
name: z.string().describe("Name of the pea variety."),
|
|
24
|
+
peaType: z.enum(["shelling", "snap"])
|
|
25
|
+
.describe("Whether the variety is grown for shelled peas or edible pods."),
|
|
26
|
+
growthHabit: z.enum(["bush", "climbing"])
|
|
27
|
+
.describe("Whether the plant grows as a bush or climbing vine."),
|
|
28
|
+
daysToMaturity: z.number().int().positive()
|
|
29
|
+
.describe("Approximate days from sowing until the first harvest."),
|
|
27
30
|
});
|
|
28
31
|
|
|
29
32
|
const getPeaVariety = defineTool({
|
|
30
33
|
name: "get-pea-variety",
|
|
31
34
|
access: "public",
|
|
32
35
|
description: "Get the type, growth habit, and maturity time for one pea variety.",
|
|
33
|
-
inputSchema: z.object({
|
|
36
|
+
inputSchema: z.object({
|
|
37
|
+
name: z.string().describe("Pea variety to look up."),
|
|
38
|
+
}),
|
|
34
39
|
outputSchema,
|
|
35
40
|
handler: ({ name }) => {
|
|
36
41
|
const data = {
|
|
@@ -47,6 +52,9 @@ const app = createEmseepea({ name: "pea-guide", version: "1.0.0", tools: [getPea
|
|
|
47
52
|
await serveEmseepea(app);
|
|
48
53
|
```
|
|
49
54
|
|
|
55
|
+
Describe each public input and output property in terms useful to a model. Em
|
|
56
|
+
See Pea includes Zod `.describe()` text in the MCP tool schema sent to clients.
|
|
57
|
+
|
|
50
58
|
## Discover Capability Modules at Startup
|
|
51
59
|
|
|
52
60
|
Explicit registration still works. If you prefer one file per capability, put
|
|
@@ -84,8 +92,12 @@ export default (() => defineTool({
|
|
|
84
92
|
name: "get-pea-variety",
|
|
85
93
|
access: "public",
|
|
86
94
|
description: "Get one pea variety.",
|
|
87
|
-
inputSchema: z.object({
|
|
88
|
-
|
|
95
|
+
inputSchema: z.object({
|
|
96
|
+
name: z.string().describe("Pea variety to look up."),
|
|
97
|
+
}),
|
|
98
|
+
outputSchema: z.object({
|
|
99
|
+
name: z.string().describe("Name of the pea variety."),
|
|
100
|
+
}),
|
|
89
101
|
handler: ({ name }) => ({ text: name, data: { name } }),
|
|
90
102
|
})) satisfies CapabilityModuleFactory;
|
|
91
103
|
```
|
|
@@ -374,16 +386,19 @@ Prefer an open, bounded schema when the backend can add valid values
|
|
|
374
386
|
independently.
|
|
375
387
|
|
|
376
388
|
```ts
|
|
377
|
-
const inputSchema = z.object({
|
|
389
|
+
const inputSchema = z.object({
|
|
390
|
+
name: z.string().max(200).describe("Pea taxon to look up."),
|
|
391
|
+
});
|
|
378
392
|
const backendInputSchema = z.object({ search: z.string().max(200) });
|
|
379
393
|
const backendTaxon = z.object({
|
|
380
|
-
id: z.number().int().positive(),
|
|
381
|
-
name: z.string().max(200),
|
|
382
|
-
rank: z.string().max(40),
|
|
383
|
-
observations_count: z.number().int().nonnegative()
|
|
394
|
+
id: z.number().int().positive().describe("Provider identifier for the taxon."),
|
|
395
|
+
name: z.string().max(200).describe("Scientific name of the taxon."),
|
|
396
|
+
rank: z.string().max(40).describe("Taxonomic rank reported by the provider."),
|
|
397
|
+
observations_count: z.number().int().nonnegative()
|
|
398
|
+
.describe("Recorded observations, not an estimate of the wild population."),
|
|
384
399
|
});
|
|
385
400
|
const outputSchema = backendTaxon.extend({
|
|
386
|
-
source: z.literal("catalogue-service"),
|
|
401
|
+
source: z.literal("catalogue-service").describe("Data provider for this result."),
|
|
387
402
|
});
|
|
388
403
|
const backendOutputSchema = z.object({
|
|
389
404
|
record: backendTaxon,
|
|
@@ -604,7 +619,9 @@ const methodGuide = defineResourceTemplate({
|
|
|
604
619
|
|
|
605
620
|
const growing = definePrompt({
|
|
606
621
|
name: "growing-guide",
|
|
607
|
-
argsSchema: z.object({
|
|
622
|
+
argsSchema: z.object({
|
|
623
|
+
topic: z.string().min(1).describe("Pea-growing topic to explain."),
|
|
624
|
+
}),
|
|
608
625
|
complete: {
|
|
609
626
|
topic: (value) => ["sowing-depth", "plant-spacing"].filter((topic) => topic.startsWith(value)),
|
|
610
627
|
},
|