@jaypie/mcp 0.7.46 → 0.8.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.
Files changed (40) hide show
  1. package/dist/suite.d.ts +1 -3
  2. package/dist/suite.js +1 -9
  3. package/dist/suite.js.map +1 -1
  4. package/dist/suites/docs/index.js +2 -9
  5. package/dist/suites/docs/index.js.map +1 -1
  6. package/package.json +1 -2
  7. package/release-notes/constructs/1.2.36.md +9 -0
  8. package/release-notes/mcp/0.8.0.md +21 -0
  9. package/skills/agents.md +4 -3
  10. package/skills/aws.md +1 -6
  11. package/skills/contents.md +1 -1
  12. package/skills/datadog.md +3 -3
  13. package/skills/dynamodb.md +1 -6
  14. package/skills/fabric.md +1 -1
  15. package/skills/llm.md +1 -0
  16. package/skills/{tools-datadog.md → mcp-datadog.md} +4 -4
  17. package/skills/mcp.md +63 -0
  18. package/skills/meta.md +3 -3
  19. package/skills/practice.md +10 -0
  20. package/skills/skills.md +2 -2
  21. package/skills/tildeskill.md +1 -1
  22. package/skills/tools.md +170 -85
  23. package/dist/suites/aws/aws.d.ts +0 -207
  24. package/dist/suites/aws/aws.js +0 -369
  25. package/dist/suites/aws/aws.js.map +0 -1
  26. package/dist/suites/aws/help.md +0 -87
  27. package/dist/suites/aws/index.d.ts +0 -68
  28. package/dist/suites/aws/index.js +0 -397
  29. package/dist/suites/aws/index.js.map +0 -1
  30. package/dist/suites/llm/help.md +0 -58
  31. package/dist/suites/llm/index.d.ts +0 -2
  32. package/dist/suites/llm/index.js +0 -77
  33. package/dist/suites/llm/index.js.map +0 -1
  34. package/dist/suites/llm/llm.d.ts +0 -53
  35. package/dist/suites/llm/llm.js +0 -111
  36. package/dist/suites/llm/llm.js.map +0 -1
  37. package/skills/index.md +0 -18
  38. package/skills/tools-aws.md +0 -208
  39. package/skills/tools-dynamodb.md +0 -179
  40. package/skills/tools-llm.md +0 -109
package/skills/tools.md CHANGED
@@ -1,115 +1,200 @@
1
1
  ---
2
- description: Available MCP tools reference
3
- related: tools-aws, tools-datadog, tools-dynamodb, tools-llm, debugging
2
+ description: Writing LLM tools with Toolkit, Fabric services, and best practices
3
+ related: fabric, llm, mcp, services
4
4
  ---
5
5
 
6
- # MCP Tools Reference
6
+ # Writing Tools
7
+
8
+ Define tools for LLM agents using `@jaypie/llm` Toolkit or Fabric services.
9
+
10
+ ## Toolkit Tool Definition
11
+
12
+ ```typescript
13
+ import { Toolkit } from "@jaypie/llm";
14
+
15
+ const toolkit = new Toolkit([
16
+ {
17
+ name: "get_order",
18
+ description: "Look up an order by ID",
19
+ type: "function",
20
+ parameters: {
21
+ type: "object",
22
+ properties: {
23
+ orderId: { type: "string", description: "Order ID" },
24
+ },
25
+ required: ["orderId"],
26
+ },
27
+ call: async ({ orderId }) => {
28
+ return getOrder(orderId);
29
+ },
30
+ },
31
+ ]);
32
+ ```
7
33
 
8
- Tools available through the Jaypie MCP server. All tools use a unified router-style API.
34
+ ## Fabric Service as Tool
35
+
36
+ Define once, use as LLM tool, MCP tool, Lambda handler, or CLI command:
37
+
38
+ ```typescript
39
+ import { fabricService } from "@jaypie/fabric";
40
+ import { fabricLlmTool } from "@jaypie/fabric";
41
+ import { Toolkit } from "@jaypie/llm";
42
+
43
+ const orderService = fabricService({
44
+ alias: "get_order",
45
+ description: "Look up an order by ID",
46
+ input: {
47
+ orderId: {
48
+ type: String,
49
+ required: true,
50
+ description: "Order ID to look up",
51
+ },
52
+ },
53
+ service: async ({ orderId }) => {
54
+ return getOrder(orderId);
55
+ },
56
+ });
57
+
58
+ // As LLM tool
59
+ const toolkit = new Toolkit([fabricLlmTool(orderService)]);
60
+
61
+ // As MCP tool
62
+ fabricMcp({ service: orderService, server });
63
+ ```
9
64
 
10
- ## Documentation Tools
65
+ ## Service-Backed Tools
66
+
67
+ Keep business logic in services, tools as thin wrappers:
68
+
69
+ ```typescript
70
+ // services/order.ts
71
+ import { log, NotFoundError } from "jaypie";
72
+ import { Order } from "../models/order.js";
73
+
74
+ export async function getOrder(orderId: string) {
75
+ log.debug("Looking up order", { orderId });
76
+ const order = await Order.findById(orderId);
77
+ if (!order) {
78
+ throw new NotFoundError(`Order ${orderId} not found`);
79
+ }
80
+ return order;
81
+ }
82
+
83
+ export async function listOrders({ status, limit = 10 }: {
84
+ status?: string;
85
+ limit?: number;
86
+ } = {}) {
87
+ log.debug("Listing orders", { status, limit });
88
+ return Order.find({ ...(status && { status }) }, { limit });
89
+ }
90
+ ```
11
91
 
12
- | Tool | Description |
13
- |------|-------------|
14
- | `skill` | Access Jaypie skill documentation |
15
- | `version` | Get MCP server version |
16
- | `release_notes` | Browse package release notes |
92
+ ```typescript
93
+ // tools/order.ts
94
+ import { fabricService } from "@jaypie/fabric";
95
+ import { getOrder, listOrders } from "../services/order.js";
96
+
97
+ export const getOrderService = fabricService({
98
+ alias: "get_order",
99
+ description: "Look up an order by ID",
100
+ input: {
101
+ orderId: { type: String, required: true, description: "Order ID" },
102
+ },
103
+ service: async ({ orderId }) => getOrder(orderId),
104
+ });
105
+
106
+ export const listOrdersService = fabricService({
107
+ alias: "list_orders",
108
+ description: "List orders, optionally filtered by status",
109
+ input: {
110
+ status: { type: String, required: false, description: "Filter by status" },
111
+ limit: { type: Number, required: false, description: "Max results (default 10)" },
112
+ },
113
+ service: async ({ status, limit }) => listOrders({ status, limit }),
114
+ });
115
+ ```
17
116
 
18
- ### Using Skills
117
+ ## Wiring Tools to LLM
19
118
 
20
- ```
21
- skill("index") # List all skills
22
- skill("jaypie") # Jaypie overview
23
- skill("tests") # Testing patterns
24
- ```
119
+ ```typescript
120
+ import Llm, { Toolkit } from "@jaypie/llm";
121
+ import { fabricLlmTool } from "@jaypie/fabric";
122
+ import { getOrderService, listOrdersService } from "./tools/order.js";
25
123
 
26
- ### Release Notes
124
+ const toolkit = new Toolkit([
125
+ fabricLlmTool(getOrderService),
126
+ fabricLlmTool(listOrdersService),
127
+ ]);
27
128
 
28
- ```
29
- release_notes() # Show help
30
- release_notes("list") # List all release notes
31
- release_notes("list", { package: "mcp" }) # Filter by package
32
- release_notes("read", { package: "mcp", version: "0.5.0" }) # Read specific note
129
+ const response = await Llm.operate("Find all pending orders", {
130
+ model: "claude-sonnet-4",
131
+ tools: toolkit,
132
+ turns: 3,
133
+ });
33
134
  ```
34
135
 
35
- ## AWS Tool
136
+ ## Built-in Tools
36
137
 
37
- Unified tool for Lambda, S3, SQS, CloudWatch Logs, Step Functions, CloudFormation, and DynamoDB.
138
+ ```typescript
139
+ import Llm, { tools, JaypieToolkit } from "@jaypie/llm";
38
140
 
39
- See **tools-aws** for complete documentation.
141
+ // Individual built-in tools: random, roll, time, weather
142
+ const response = await Llm.operate("Roll 2d6", {
143
+ model: "gpt-5.1",
144
+ tools,
145
+ });
40
146
 
147
+ // Or use the pre-configured toolkit
148
+ const toolkit = new JaypieToolkit();
41
149
  ```
42
- aws() # Show help with all commands
43
- aws("list_profiles") # List AWS profiles
44
- aws("lambda_list_functions", { region: "us-east-1" })
45
- aws("dynamodb_query", { tableName: "...", keyConditionExpression: "..." })
46
- ```
47
-
48
- | Command | Description |
49
- |---------|-------------|
50
- | `list_profiles` | List AWS profiles from ~/.aws |
51
- | `lambda_list_functions`, `lambda_get_function` | Lambda management |
52
- | `logs_filter_log_events` | CloudWatch Logs search |
53
- | `s3_list_objects` | S3 bucket operations |
54
- | `sqs_list_queues`, `sqs_get_queue_attributes`, `sqs_receive_message`, `sqs_purge_queue` | SQS operations |
55
- | `stepfunctions_list_executions`, `stepfunctions_stop_execution` | Step Functions |
56
- | `cloudformation_describe_stack` | CloudFormation stack details |
57
- | `dynamodb_describe_table`, `dynamodb_query`, `dynamodb_scan`, `dynamodb_get_item` | DynamoDB |
58
150
 
59
- ## Datadog Tool
151
+ ## Explain Mode
60
152
 
61
- Unified tool for logs, monitors, metrics, synthetics, and RUM.
153
+ Require the LLM to state its reasoning before each tool call:
62
154
 
63
- See **tools-datadog** for complete documentation.
155
+ ```typescript
156
+ const toolkit = new Toolkit([myTool], { explain: true });
64
157
 
158
+ // Or per-call
159
+ const response = await Llm.operate("What's the weather?", {
160
+ model: "gpt-5.1",
161
+ tools: myTools,
162
+ explain: true,
163
+ });
65
164
  ```
66
- datadog() # Show help with all commands
67
- datadog("logs", { query: "status:error", from: "now-1h" })
68
- datadog("monitors", { status: ["Alert", "Warn"] })
69
- ```
70
-
71
- | Command | Description |
72
- |---------|-------------|
73
- | `logs` | Search log entries |
74
- | `log_analytics` | Aggregate logs with groupBy |
75
- | `monitors` | List and check monitors |
76
- | `synthetics` | List synthetic tests |
77
- | `metrics` | Query timeseries metrics |
78
- | `rum` | Search RUM events |
79
165
 
80
- ## LLM Tool
166
+ The `__Explanation` parameter is stripped before the tool executes.
81
167
 
82
- Debug and inspect LLM provider responses.
168
+ ## Input Types
83
169
 
84
- See **tools-llm** for complete documentation.
170
+ Fabric services validate inputs automatically:
85
171
 
172
+ ```typescript
173
+ input: {
174
+ name: { type: String, required: true, description: "User name" },
175
+ count: { type: Number, required: false, description: "Result limit" },
176
+ status: {
177
+ type: ["active", "inactive"] as const,
178
+ required: false,
179
+ description: "Filter by status",
180
+ },
181
+ }
86
182
  ```
87
- llm() # Show help
88
- llm("list_providers") # List available LLM providers
89
- llm("debug_call", { provider: "openai", message: "Hello" })
90
- ```
91
-
92
- | Command | Description |
93
- |---------|-------------|
94
- | `list_providers` | List available LLM providers |
95
- | `debug_call` | Debug LLM API call |
96
-
97
- ## Environment Variables
98
183
 
99
- ### AWS Tools
100
- - `AWS_PROFILE` - Default profile
101
- - `AWS_REGION` - Default region
184
+ ## Best Practices
102
185
 
103
- ### Datadog Tools
104
- - `DATADOG_API_KEY` or `DD_API_KEY` - API key
105
- - `DATADOG_APP_KEY` or `DD_APP_KEY` - App key
106
- - `DD_ENV` - Default environment filter
107
- - `DD_SERVICE` - Default service filter
108
- - `DD_SOURCE` - Default log source
186
+ 1. **Service layer first** -- business logic in services, tools are thin adapters
187
+ 2. **One tool, one action** -- each tool does one thing
188
+ 3. **Descriptive names** -- use `noun_verb` format (`order_get`, `user_list`)
189
+ 4. **Clear descriptions** -- LLMs choose tools based on description text
190
+ 5. **Document parameters** -- every input needs a description
191
+ 6. **Return JSON-serializable data** -- tools return data, not formatted text
192
+ 7. **Use Jaypie errors** -- `NotFoundError`, `BadRequestError` for clear failure signals
193
+ 8. **Set turns > 1** -- multi-tool workflows need room to loop
109
194
 
110
- ### LLM Tools
111
- - `OPENAI_API_KEY` - OpenAI API key
112
- - `ANTHROPIC_API_KEY` - Anthropic API key
113
- - `GOOGLE_API_KEY` - Google/Gemini API key
114
- - `OPENROUTER_API_KEY` - OpenRouter API key
195
+ ## See Also
115
196
 
197
+ - **`skill("fabric")`** -- Fabric service pattern and adapters
198
+ - **`skill("llm")`** -- Full `@jaypie/llm` reference
199
+ - **`skill("services")`** -- Service layer architecture
200
+ - **`skill("mcp")`** -- Jaypie MCP server tools
@@ -1,207 +0,0 @@
1
- interface Logger {
2
- info: (message: string, ...args: unknown[]) => void;
3
- error: (message: string, ...args: unknown[]) => void;
4
- }
5
- export interface AwsCommandOptions {
6
- profile?: string;
7
- region?: string;
8
- }
9
- export interface AwsCommandResult<T> {
10
- success: boolean;
11
- data?: T;
12
- error?: string;
13
- }
14
- export interface StepFunctionExecution {
15
- executionArn: string;
16
- stateMachineArn: string;
17
- name: string;
18
- status: string;
19
- startDate: string;
20
- stopDate?: string;
21
- }
22
- export interface StepFunctionsListExecutionsOptions extends AwsCommandOptions {
23
- stateMachineArn: string;
24
- statusFilter?: "RUNNING" | "SUCCEEDED" | "FAILED" | "TIMED_OUT" | "ABORTED" | "PENDING_REDRIVE";
25
- maxResults?: number;
26
- }
27
- export interface StepFunctionsStopExecutionOptions extends AwsCommandOptions {
28
- executionArn: string;
29
- cause?: string;
30
- }
31
- export interface LambdaFunction {
32
- FunctionName: string;
33
- FunctionArn: string;
34
- Runtime?: string;
35
- Handler?: string;
36
- CodeSize: number;
37
- Description?: string;
38
- Timeout?: number;
39
- MemorySize?: number;
40
- LastModified: string;
41
- Version?: string;
42
- }
43
- export interface LambdaListFunctionsOptions extends AwsCommandOptions {
44
- functionNamePrefix?: string;
45
- maxResults?: number;
46
- }
47
- export interface LambdaGetFunctionOptions extends AwsCommandOptions {
48
- functionName: string;
49
- }
50
- export interface LogEvent {
51
- timestamp: number;
52
- message: string;
53
- ingestionTime?: number;
54
- logStreamName?: string;
55
- }
56
- export interface CloudWatchLogsFilterOptions extends AwsCommandOptions {
57
- logGroupName: string;
58
- filterPattern?: string;
59
- startTime?: string;
60
- endTime?: string;
61
- limit?: number;
62
- }
63
- export interface S3Object {
64
- Key: string;
65
- LastModified: string;
66
- ETag: string;
67
- Size: number;
68
- StorageClass: string;
69
- }
70
- export interface S3ListObjectsOptions extends AwsCommandOptions {
71
- bucket: string;
72
- prefix?: string;
73
- maxResults?: number;
74
- }
75
- export interface CloudFormationStack {
76
- StackName: string;
77
- StackId: string;
78
- StackStatus: string;
79
- StackStatusReason?: string;
80
- CreationTime: string;
81
- LastUpdatedTime?: string;
82
- Description?: string;
83
- Outputs?: Array<{
84
- OutputKey: string;
85
- OutputValue: string;
86
- Description?: string;
87
- }>;
88
- Parameters?: Array<{
89
- ParameterKey: string;
90
- ParameterValue: string;
91
- }>;
92
- }
93
- export interface CloudFormationDescribeStackOptions extends AwsCommandOptions {
94
- stackName: string;
95
- }
96
- export interface DynamoDBDescribeTableOptions extends AwsCommandOptions {
97
- tableName: string;
98
- }
99
- export interface DynamoDBScanOptions extends AwsCommandOptions {
100
- tableName: string;
101
- filterExpression?: string;
102
- expressionAttributeValues?: string;
103
- limit?: number;
104
- }
105
- export interface DynamoDBQueryOptions extends AwsCommandOptions {
106
- tableName: string;
107
- keyConditionExpression: string;
108
- expressionAttributeValues: string;
109
- indexName?: string;
110
- filterExpression?: string;
111
- limit?: number;
112
- scanIndexForward?: boolean;
113
- }
114
- export interface DynamoDBGetItemOptions extends AwsCommandOptions {
115
- tableName: string;
116
- key: string;
117
- }
118
- export interface SQSQueue {
119
- QueueUrl: string;
120
- }
121
- export interface SQSListQueuesOptions extends AwsCommandOptions {
122
- queueNamePrefix?: string;
123
- }
124
- export interface SQSGetQueueAttributesOptions extends AwsCommandOptions {
125
- queueUrl: string;
126
- }
127
- export interface SQSReceiveMessageOptions extends AwsCommandOptions {
128
- queueUrl: string;
129
- maxNumberOfMessages?: number;
130
- visibilityTimeout?: number;
131
- }
132
- export interface SQSPurgeQueueOptions extends AwsCommandOptions {
133
- queueUrl: string;
134
- }
135
- export interface AwsProfile {
136
- name: string;
137
- source: "config" | "credentials";
138
- region?: string;
139
- sso_start_url?: string;
140
- }
141
- export interface AwsValidationResult {
142
- success: boolean;
143
- cliAvailable: boolean;
144
- cliVersion?: string;
145
- profiles: AwsProfile[];
146
- }
147
- /**
148
- * Execute an AWS CLI command and return parsed JSON output
149
- */
150
- export declare function executeAwsCommand<T>(service: string, command: string, args: string[], options?: AwsCommandOptions, logger?: Logger): Promise<AwsCommandResult<T>>;
151
- /**
152
- * Validate AWS setup without making API calls
153
- */
154
- export declare function validateAwsSetup(): Promise<AwsValidationResult>;
155
- /**
156
- * List available AWS profiles from ~/.aws/config and ~/.aws/credentials
157
- */
158
- export declare function listAwsProfiles(logger?: Logger): Promise<AwsCommandResult<AwsProfile[]>>;
159
- export declare function listStepFunctionExecutions(options: StepFunctionsListExecutionsOptions, logger?: Logger): Promise<AwsCommandResult<{
160
- executions: StepFunctionExecution[];
161
- }>>;
162
- export declare function stopStepFunctionExecution(options: StepFunctionsStopExecutionOptions, logger?: Logger): Promise<AwsCommandResult<{
163
- stopDate: string;
164
- }>>;
165
- export declare function listLambdaFunctions(options?: LambdaListFunctionsOptions, logger?: Logger): Promise<AwsCommandResult<{
166
- Functions: LambdaFunction[];
167
- }>>;
168
- export declare function getLambdaFunction(options: LambdaGetFunctionOptions, logger?: Logger): Promise<AwsCommandResult<{
169
- Configuration: LambdaFunction;
170
- }>>;
171
- export declare function filterLogEvents(options: CloudWatchLogsFilterOptions, logger?: Logger): Promise<AwsCommandResult<{
172
- events: LogEvent[];
173
- }>>;
174
- export declare function listS3Objects(options: S3ListObjectsOptions, logger?: Logger): Promise<AwsCommandResult<{
175
- Contents: S3Object[];
176
- }>>;
177
- export declare function describeStack(options: CloudFormationDescribeStackOptions, logger?: Logger): Promise<AwsCommandResult<{
178
- Stacks: CloudFormationStack[];
179
- }>>;
180
- export declare function describeDynamoDBTable(options: DynamoDBDescribeTableOptions, logger?: Logger): Promise<AwsCommandResult<{
181
- Table: Record<string, unknown>;
182
- }>>;
183
- export declare function scanDynamoDB(options: DynamoDBScanOptions, logger?: Logger): Promise<AwsCommandResult<{
184
- Items: Record<string, unknown>[];
185
- }>>;
186
- export declare function queryDynamoDB(options: DynamoDBQueryOptions, logger?: Logger): Promise<AwsCommandResult<{
187
- Items: Record<string, unknown>[];
188
- }>>;
189
- export declare function getDynamoDBItem(options: DynamoDBGetItemOptions, logger?: Logger): Promise<AwsCommandResult<{
190
- Item: Record<string, unknown>;
191
- }>>;
192
- export declare function listSQSQueues(options?: SQSListQueuesOptions, logger?: Logger): Promise<AwsCommandResult<{
193
- QueueUrls: string[];
194
- }>>;
195
- export declare function getSQSQueueAttributes(options: SQSGetQueueAttributesOptions, logger?: Logger): Promise<AwsCommandResult<{
196
- Attributes: Record<string, string>;
197
- }>>;
198
- export declare function receiveSQSMessage(options: SQSReceiveMessageOptions, logger?: Logger): Promise<AwsCommandResult<{
199
- Messages: Array<{
200
- MessageId: string;
201
- ReceiptHandle: string;
202
- Body: string;
203
- Attributes?: Record<string, string>;
204
- }>;
205
- }>>;
206
- export declare function purgeSQSQueue(options: SQSPurgeQueueOptions, logger?: Logger): Promise<AwsCommandResult<void>>;
207
- export {};