@jaypie/mcp 0.2.10 → 0.3.0

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.
@@ -407,50 +407,6 @@ expressHandler automatically sets these headers:
407
407
 
408
408
  When Datadog environment variables are configured, expressHandler automatically submits metrics for each request including status code and path.
409
409
 
410
- ## Server Creation
411
-
412
- Use `createServer` to quickly set up an Express server with standard Jaypie middleware.
413
-
414
- ### Basic Server Usage
415
-
416
- ```typescript
417
- import express from "express";
418
- import { createServer, expressHandler } from "jaypie";
419
-
420
- const app = express();
421
-
422
- app.get("/", expressHandler(async (req, res) => {
423
- return { message: "Hello World" };
424
- }));
425
-
426
- const { server, port } = await createServer(app);
427
- console.log(`Server running on port ${port}`);
428
- ```
429
-
430
- ### Server Options
431
-
432
- ```typescript
433
- import { createServer } from "jaypie";
434
- import type { CreateServerOptions } from "jaypie";
435
-
436
- const options: CreateServerOptions = {
437
- port: 3000, // Port to listen on (default: PORT env var or 8080)
438
- cors: { origin: "*" }, // CORS config (false to disable)
439
- jsonLimit: "10mb", // JSON body parser limit (default: "1mb")
440
- middleware: [myMiddleware], // Additional middleware to apply
441
- };
442
-
443
- const { server, port } = await createServer(app, options);
444
- ```
445
-
446
- ### Server Result
447
-
448
- ```typescript
449
- import type { ServerResult } from "jaypie";
450
-
451
- // { server: Server, port: number }
452
- ```
453
-
454
410
  ## Streaming Responses
455
411
 
456
412
  Use `expressStreamHandler` for Server-Sent Events (SSE) streaming responses. Ideal for real-time updates, LLM streaming, and long-running operations.
@@ -1,28 +1,28 @@
1
1
  ---
2
- description: Commander.js CLI integration with serviceHandler callbacks (onMessage, onComplete, onError, onFatal)
2
+ description: Commander.js CLI integration with fabricService callbacks (onMessage, onComplete, onError, onFatal)
3
3
  include: "**/cli/**"
4
4
  ---
5
5
 
6
- # Jaypie Vocabulary Commander Adapter
6
+ # Jaypie Fabric Commander Adapter
7
7
 
8
- The Commander adapter (`@jaypie/vocabulary/commander`) integrates Jaypie service handlers with Commander.js CLI applications, providing automatic option generation, type coercion, and callback hooks for progress reporting.
8
+ The Commander adapter (`@jaypie/fabric/commander`) integrates Jaypie service handlers with Commander.js CLI applications, providing automatic option generation, type conversion, and callback hooks for progress reporting.
9
9
 
10
- **See also:** [Jaypie_Vocabulary_Package.md](Jaypie_Vocabulary_Package.md) for core serviceHandler documentation.
10
+ **See also:** [Jaypie_Fabric_Package.md](Jaypie_Fabric_Package.md) for core fabricService documentation.
11
11
 
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- npm install @jaypie/vocabulary commander
15
+ npm install @jaypie/fabric commander
16
16
  ```
17
17
 
18
18
  ## Quick Start
19
19
 
20
20
  ```typescript
21
21
  import { Command } from "commander";
22
- import { serviceHandler } from "@jaypie/vocabulary";
23
- import { registerServiceCommand } from "@jaypie/vocabulary/commander";
22
+ import { fabricService } from "@jaypie/fabric";
23
+ import { fabricCommand } from "@jaypie/fabric/commander";
24
24
 
25
- const handler = serviceHandler({
25
+ const handler = fabricService({
26
26
  alias: "greet",
27
27
  description: "Greet a user",
28
28
  input: {
@@ -36,12 +36,12 @@ const handler = serviceHandler({
36
36
  });
37
37
 
38
38
  const program = new Command();
39
- registerServiceCommand({ handler, program });
39
+ fabricCommand({ service: handler, program });
40
40
  program.parse();
41
41
  // Usage: greet --user Alice -l
42
42
  ```
43
43
 
44
- ## registerServiceCommand
44
+ ## fabricCommand
45
45
 
46
46
  The primary function for registering a service handler as a Commander command.
47
47
 
@@ -49,7 +49,7 @@ The primary function for registering a service handler as a Commander command.
49
49
 
50
50
  | Option | Type | Description |
51
51
  |--------|------|-------------|
52
- | `handler` | `ServiceHandlerFunction` | Required. The service handler to register |
52
+ | `service` | `Service` | Required. The service handler to register |
53
53
  | `program` | `Command` | Required. Commander program or command |
54
54
  | `name` | `string` | Override command name (default: handler.alias) |
55
55
  | `description` | `string` | Override description (default: handler.description) |
@@ -68,10 +68,10 @@ Receives progress messages sent by the service via `context.sendMessage`:
68
68
 
69
69
  ```typescript
70
70
  import { Command } from "commander";
71
- import { serviceHandler } from "@jaypie/vocabulary";
72
- import { registerServiceCommand } from "@jaypie/vocabulary/commander";
71
+ import { fabricService } from "@jaypie/fabric";
72
+ import { fabricCommand } from "@jaypie/fabric/commander";
73
73
 
74
- const handler = serviceHandler({
74
+ const handler = fabricService({
75
75
  alias: "process",
76
76
  input: { jobId: { type: String, letter: "j" } },
77
77
  service: async ({ jobId }, context) => {
@@ -91,8 +91,8 @@ const handler = serviceHandler({
91
91
  });
92
92
 
93
93
  const program = new Command();
94
- registerServiceCommand({
95
- handler,
94
+ fabricCommand({
95
+ service: handler,
96
96
  program,
97
97
  onMessage: (msg) => {
98
98
  // msg: { content: string, level?: "trace"|"debug"|"info"|"warn"|"error" }
@@ -110,8 +110,8 @@ program.parse();
110
110
  Called with the handler's return value on successful completion:
111
111
 
112
112
  ```typescript
113
- registerServiceCommand({
114
- handler,
113
+ fabricCommand({
114
+ service: handler,
115
115
  program,
116
116
  onComplete: (response) => {
117
117
  // Called after service completes successfully
@@ -130,8 +130,8 @@ registerServiceCommand({
130
130
  Receives errors that the service explicitly reports via `context.onError()`. Use this for recoverable errors that don't halt execution:
131
131
 
132
132
  ```typescript
133
- registerServiceCommand({
134
- handler,
133
+ fabricCommand({
134
+ service: handler,
135
135
  program,
136
136
  onError: (error) => {
137
137
  // Log recoverable errors
@@ -145,8 +145,8 @@ registerServiceCommand({
145
145
  Receives fatal errors - either thrown errors or errors reported via `context.onFatal()`. Any error that escapes the service (is thrown) is treated as fatal:
146
146
 
147
147
  ```typescript
148
- registerServiceCommand({
149
- handler,
148
+ fabricCommand({
149
+ service: handler,
150
150
  program,
151
151
  onFatal: (error) => {
152
152
  console.error("Fatal error:", error.message);
@@ -164,10 +164,10 @@ registerServiceCommand({
164
164
 
165
165
  ```typescript
166
166
  import { Command } from "commander";
167
- import { serviceHandler } from "@jaypie/vocabulary";
168
- import { registerServiceCommand } from "@jaypie/vocabulary/commander";
167
+ import { fabricService } from "@jaypie/fabric";
168
+ import { fabricCommand } from "@jaypie/fabric/commander";
169
169
 
170
- const evaluateHandler = serviceHandler({
170
+ const evaluateHandler = fabricService({
171
171
  alias: "evaluate",
172
172
  description: "Run an evaluation job",
173
173
  input: {
@@ -231,8 +231,8 @@ const evaluateHandler = serviceHandler({
231
231
  const program = new Command();
232
232
  program.version("1.0.0").description("Evaluation CLI");
233
233
 
234
- registerServiceCommand({
235
- handler: evaluateHandler,
234
+ fabricCommand({
235
+ service: evaluateHandler,
236
236
  program,
237
237
  onMessage: (msg) => {
238
238
  const prefix = msg.level === "warn" ? "WARNING: " :
@@ -309,13 +309,13 @@ For more control, use `createCommanderOptions` and `parseCommanderOptions`:
309
309
 
310
310
  ```typescript
311
311
  import { Command } from "commander";
312
- import { serviceHandler } from "@jaypie/vocabulary";
312
+ import { fabricService } from "@jaypie/fabric";
313
313
  import {
314
314
  createCommanderOptions,
315
315
  parseCommanderOptions,
316
- } from "@jaypie/vocabulary/commander";
316
+ } from "@jaypie/fabric/commander";
317
317
 
318
- const handler = serviceHandler({
318
+ const handler = fabricService({
319
319
  input: {
320
320
  userName: { type: String, description: "User name" },
321
321
  maxRetries: { type: Number, default: 3 },
@@ -351,14 +351,14 @@ import type {
351
351
  CommanderOptionOverride,
352
352
  CreateCommanderOptionsConfig,
353
353
  CreateCommanderOptionsResult,
354
+ FabricCommandConfig,
355
+ FabricCommandResult,
354
356
  OnCompleteCallback,
355
357
  OnErrorCallback,
356
358
  OnFatalCallback,
357
359
  OnMessageCallback,
358
360
  ParseCommanderOptionsConfig,
359
- RegisterServiceCommandConfig,
360
- RegisterServiceCommandResult,
361
- } from "@jaypie/vocabulary/commander";
361
+ } from "@jaypie/fabric/commander";
362
362
  ```
363
363
 
364
364
  ### Callback Type Definitions
@@ -386,26 +386,26 @@ type OnFatalCallback = (error: unknown) => void | Promise<void>;
386
386
  ## Exports
387
387
 
388
388
  ```typescript
389
- // @jaypie/vocabulary/commander
389
+ // @jaypie/fabric/commander
390
390
  export { createCommanderOptions } from "./createCommanderOptions.js";
391
391
  export { parseCommanderOptions } from "./parseCommanderOptions.js";
392
- export { registerServiceCommand } from "./registerServiceCommand.js";
392
+ export { fabricCommand } from "./fabricCommand.js";
393
393
 
394
394
  export type {
395
395
  CommanderOptionOverride,
396
396
  CreateCommanderOptionsConfig,
397
397
  CreateCommanderOptionsResult,
398
+ FabricCommandConfig,
399
+ FabricCommandResult,
398
400
  OnCompleteCallback,
399
401
  OnErrorCallback,
400
402
  OnFatalCallback,
401
403
  OnMessageCallback,
402
404
  ParseCommanderOptionsConfig,
403
- RegisterServiceCommandConfig,
404
- RegisterServiceCommandResult,
405
405
  } from "./types.js";
406
406
  ```
407
407
 
408
408
  ## Related
409
409
 
410
410
  - [Jaypie_Commander_CLI_Package.md](Jaypie_Commander_CLI_Package.md) - Setting up a Commander CLI project from scratch
411
- - [Jaypie_Vocabulary_Package.md](Jaypie_Vocabulary_Package.md) - Core serviceHandler and type coercion
411
+ - [Jaypie_Fabric_Package.md](Jaypie_Fabric_Package.md) - Core fabricService and type conversion
@@ -1,27 +1,27 @@
1
1
  ---
2
- description: LLM tool creation from serviceHandler for use with @jaypie/llm Toolkit
2
+ description: LLM tool creation from fabricService for use with @jaypie/llm Toolkit
3
3
  ---
4
4
 
5
- # Jaypie Vocabulary LLM Adapter
5
+ # Jaypie Fabric LLM Adapter
6
6
 
7
- The LLM adapter (`@jaypie/vocabulary/llm`) creates LLM tools from Jaypie service handlers for use with `@jaypie/llm` Toolkit, automatically generating JSON Schema from input definitions.
7
+ The LLM adapter (`@jaypie/fabric/llm`) creates LLM tools from Jaypie service handlers for use with `@jaypie/llm` Toolkit, automatically generating JSON Schema from input definitions.
8
8
 
9
- **See also:** [Jaypie_Vocabulary_Package.md](Jaypie_Vocabulary_Package.md) for core serviceHandler documentation.
9
+ **See also:** [Jaypie_Fabric_Package.md](Jaypie_Fabric_Package.md) for core fabricService documentation.
10
10
 
11
11
  ## Installation
12
12
 
13
13
  ```bash
14
- npm install @jaypie/vocabulary @jaypie/llm
14
+ npm install @jaypie/fabric @jaypie/llm
15
15
  ```
16
16
 
17
17
  ## Quick Start
18
18
 
19
19
  ```typescript
20
- import { serviceHandler } from "@jaypie/vocabulary";
21
- import { createLlmTool } from "@jaypie/vocabulary/llm";
20
+ import { fabricService } from "@jaypie/fabric";
21
+ import { fabricTool } from "@jaypie/fabric/llm";
22
22
  import { Toolkit } from "@jaypie/llm";
23
23
 
24
- const handler = serviceHandler({
24
+ const handler = fabricService({
25
25
  alias: "greet",
26
26
  description: "Greet a user by name",
27
27
  input: {
@@ -34,19 +34,19 @@ const handler = serviceHandler({
34
34
  },
35
35
  });
36
36
 
37
- const { tool } = createLlmTool({ handler });
37
+ const { tool } = fabricTool({ service: handler });
38
38
  const toolkit = new Toolkit([tool]);
39
39
  ```
40
40
 
41
- ## createLlmTool
41
+ ## fabricTool
42
42
 
43
- Creates an LLM tool from a serviceHandler.
43
+ Creates an LLM tool from a fabricService.
44
44
 
45
45
  ### Options
46
46
 
47
47
  | Option | Type | Description |
48
48
  |--------|------|-------------|
49
- | `handler` | `ServiceHandlerFunction` | Required. The service handler to adapt |
49
+ | `service` | `Service` | Required. The service handler to adapt |
50
50
  | `name` | `string` | Override tool name (defaults to handler.alias) |
51
51
  | `description` | `string` | Override tool description (defaults to handler.description) |
52
52
  | `message` | `string \| function` | Custom message for logging |
@@ -59,10 +59,10 @@ Creates an LLM tool from a serviceHandler.
59
59
  ### Basic Usage
60
60
 
61
61
  ```typescript
62
- import { serviceHandler } from "@jaypie/vocabulary";
63
- import { createLlmTool } from "@jaypie/vocabulary/llm";
62
+ import { fabricService } from "@jaypie/fabric";
63
+ import { fabricTool } from "@jaypie/fabric/llm";
64
64
 
65
- const calculateHandler = serviceHandler({
65
+ const calculateHandler = fabricService({
66
66
  alias: "calculate",
67
67
  description: "Perform a mathematical calculation",
68
68
  input: {
@@ -80,7 +80,7 @@ const calculateHandler = serviceHandler({
80
80
  },
81
81
  });
82
82
 
83
- const { tool } = createLlmTool({ handler: calculateHandler });
83
+ const { tool } = fabricTool({ service: calculateHandler });
84
84
 
85
85
  // Tool has these properties:
86
86
  // tool.name: "calculate"
@@ -92,8 +92,8 @@ const { tool } = createLlmTool({ handler: calculateHandler });
92
92
  ### Overriding Name and Description
93
93
 
94
94
  ```typescript
95
- const { tool } = createLlmTool({
96
- handler,
95
+ const { tool } = fabricTool({
96
+ service: handler,
97
97
  name: "math_calculator",
98
98
  description: "A tool for performing basic math operations",
99
99
  });
@@ -102,7 +102,7 @@ const { tool } = createLlmTool({
102
102
  ### Excluding Fields
103
103
 
104
104
  ```typescript
105
- const handler = serviceHandler({
105
+ const handler = fabricService({
106
106
  alias: "search",
107
107
  input: {
108
108
  query: { type: String },
@@ -112,8 +112,8 @@ const handler = serviceHandler({
112
112
  service: async (params) => { /* ... */ },
113
113
  });
114
114
 
115
- const { tool } = createLlmTool({
116
- handler,
115
+ const { tool } = fabricTool({
116
+ service: handler,
117
117
  exclude: ["_internalId"], // Not exposed to LLM
118
118
  });
119
119
  ```
@@ -123,7 +123,7 @@ const { tool } = createLlmTool({
123
123
  Services can use context callbacks to report progress, errors, and completion:
124
124
 
125
125
  ```typescript
126
- const handler = serviceHandler({
126
+ const handler = fabricService({
127
127
  alias: "evaluate",
128
128
  input: { jobId: { type: String } },
129
129
  service: async ({ jobId }, context) => {
@@ -139,8 +139,8 @@ const handler = serviceHandler({
139
139
  },
140
140
  });
141
141
 
142
- const { tool } = createLlmTool({
143
- handler,
142
+ const { tool } = fabricTool({
143
+ service: handler,
144
144
  onComplete: (result) => console.log("Tool completed:", result),
145
145
  onError: (error) => console.warn("Recoverable error:", error),
146
146
  onFatal: (error) => console.error("Fatal error:", error),
@@ -152,10 +152,10 @@ const { tool } = createLlmTool({
152
152
 
153
153
  ## inputToJsonSchema
154
154
 
155
- Converts vocabulary input definitions to JSON Schema:
155
+ Converts fabric input definitions to JSON Schema:
156
156
 
157
157
  ```typescript
158
- import { inputToJsonSchema } from "@jaypie/vocabulary/llm";
158
+ import { inputToJsonSchema } from "@jaypie/fabric/llm";
159
159
 
160
160
  const schema = inputToJsonSchema({
161
161
  userName: { type: String, description: "User's name" },
@@ -177,8 +177,8 @@ const schema = inputToJsonSchema({
177
177
 
178
178
  ### Type Mappings
179
179
 
180
- | Vocabulary Type | JSON Schema |
181
- |-----------------|-------------|
180
+ | Fabric Type | JSON Schema |
181
+ |-------------|-------------|
182
182
  | `String` | `{ type: "string" }` |
183
183
  | `Number` | `{ type: "number" }` |
184
184
  | `Boolean` | `{ type: "boolean" }` |
@@ -201,12 +201,12 @@ const schema = inputToJsonSchema(handler.input, {
201
201
  ## Complete Example
202
202
 
203
203
  ```typescript
204
- import { serviceHandler } from "@jaypie/vocabulary";
205
- import { createLlmTool } from "@jaypie/vocabulary/llm";
204
+ import { fabricService } from "@jaypie/fabric";
205
+ import { fabricTool } from "@jaypie/fabric/llm";
206
206
  import { Llm, Toolkit } from "@jaypie/llm";
207
207
 
208
208
  // Define service handlers
209
- const weatherHandler = serviceHandler({
209
+ const weatherHandler = fabricService({
210
210
  alias: "get_weather",
211
211
  description: "Get current weather for a location",
212
212
  input: {
@@ -224,7 +224,7 @@ const weatherHandler = serviceHandler({
224
224
  },
225
225
  });
226
226
 
227
- const searchHandler = serviceHandler({
227
+ const searchHandler = fabricService({
228
228
  alias: "search_web",
229
229
  description: "Search the web for information",
230
230
  input: {
@@ -237,8 +237,8 @@ const searchHandler = serviceHandler({
237
237
  });
238
238
 
239
239
  // Create tools
240
- const { tool: weatherTool } = createLlmTool({ handler: weatherHandler });
241
- const { tool: searchTool } = createLlmTool({ handler: searchHandler });
240
+ const { tool: weatherTool } = fabricTool({ service: weatherHandler });
241
+ const { tool: searchTool } = fabricTool({ service: searchHandler });
242
242
 
243
243
  // Use with Toolkit
244
244
  const toolkit = new Toolkit([weatherTool, searchTool]);
@@ -251,14 +251,14 @@ const response = await llm.ask("What's the weather in Tokyo?");
251
251
 
252
252
  ```typescript
253
253
  import type {
254
- CreateLlmToolConfig,
255
- CreateLlmToolResult,
254
+ FabricToolConfig,
255
+ FabricToolResult,
256
256
  LlmTool,
257
257
  OnCompleteCallback,
258
258
  OnErrorCallback,
259
259
  OnFatalCallback,
260
260
  OnMessageCallback,
261
- } from "@jaypie/vocabulary/llm";
261
+ } from "@jaypie/fabric/llm";
262
262
  ```
263
263
 
264
264
  ### Type Definitions
@@ -271,8 +271,8 @@ interface LlmTool {
271
271
  function: (params: Record<string, unknown>) => Promise<unknown>;
272
272
  }
273
273
 
274
- interface CreateLlmToolConfig {
275
- handler: ServiceHandlerFunction;
274
+ interface FabricToolConfig {
275
+ service: Service;
276
276
  name?: string;
277
277
  description?: string;
278
278
  message?: string | ((params: Record<string, unknown>) => string);
@@ -283,7 +283,7 @@ interface CreateLlmToolConfig {
283
283
  onMessage?: OnMessageCallback;
284
284
  }
285
285
 
286
- interface CreateLlmToolResult {
286
+ interface FabricToolResult {
287
287
  tool: LlmTool;
288
288
  }
289
289
  ```
@@ -291,13 +291,13 @@ interface CreateLlmToolResult {
291
291
  ## Exports
292
292
 
293
293
  ```typescript
294
- // @jaypie/vocabulary/llm
295
- export { createLlmTool } from "./createLlmTool.js";
294
+ // @jaypie/fabric/llm
295
+ export { fabricTool } from "./fabricTool.js";
296
296
  export { inputToJsonSchema } from "./inputToJsonSchema.js";
297
297
 
298
298
  export type {
299
- CreateLlmToolConfig,
300
- CreateLlmToolResult,
299
+ FabricToolConfig,
300
+ FabricToolResult,
301
301
  LlmTool,
302
302
  OnCompleteCallback,
303
303
  OnErrorCallback,
@@ -308,5 +308,5 @@ export type {
308
308
 
309
309
  ## Related
310
310
 
311
- - [Jaypie_Vocabulary_Package.md](Jaypie_Vocabulary_Package.md) - Core serviceHandler and type coercion
311
+ - [Jaypie_Fabric_Package.md](Jaypie_Fabric_Package.md) - Core fabricService and type conversion
312
312
  - [Jaypie_Llm_Tools.md](Jaypie_Llm_Tools.md) - LLM tools and Toolkit usage