opentool 0.8.5 → 0.8.6

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 CHANGED
@@ -103,6 +103,11 @@ POST-only (one-off)
103
103
  // tools/aave-unstake.ts
104
104
  import { z } from "zod";
105
105
 
106
+ export const profile = {
107
+ description: "Unstake USDC on demand",
108
+ notifyEmail: true,
109
+ };
110
+
106
111
  export const schema = z.object({
107
112
  amount: z.string(),
108
113
  token: z.string().default("USDC"),
@@ -115,10 +120,16 @@ export async function POST(req: Request) {
115
120
  }
116
121
  ```
117
122
 
123
+ ### Email notifications for one-off tools
124
+
125
+ - POST-only tools can set `profile.notifyEmail = true` to request an email when the tool runs.
126
+ - Scheduled tools should continue to use `profile.schedule.notifyEmail`.
127
+
118
128
  ### Cron schedules (`profile.schedule`)
119
129
 
120
130
  - GET-only tools require `profile.schedule` with a standard 5–6 field cron expression (e.g., `0 12 * * *` or `0 0 ? * MON-FRI *`).
121
131
  - Build validates the cron shape and emits `.well-known/opentool/cron.json` capturing each scheduled tool (`toolName`, `toolPath`, `scheduleExpression`). Enabled defaults to `false` even if authors set it to `true` in code. Deployment targets can translate these cron strings to their provider format (e.g., EventBridge) downstream.
132
+ - Use `profile.schedule.notifyEmail = true` to request email delivery on schedule runs.
122
133
 
123
134
  ### Public tools: Add x402 payments (optional)
124
135
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { M as Metadata, I as InternalToolDefinition } from '../validate-BJ5-5n8h.js';
3
- export { G as GenerateMetadataOptions, a as GenerateMetadataResult, V as ValidateOptions, b as generateMetadata, g as generateMetadataCommand, l as loadAndValidateTools, v as validateCommand, c as validateFullCommand } from '../validate-BJ5-5n8h.js';
2
+ import { M as Metadata, I as InternalToolDefinition } from '../validate-D5sE9GUm.js';
3
+ export { G as GenerateMetadataOptions, a as GenerateMetadataResult, V as ValidateOptions, b as generateMetadata, g as generateMetadataCommand, l as loadAndValidateTools, v as validateCommand, c as validateFullCommand } from '../validate-D5sE9GUm.js';
4
4
  import 'zod';
5
5
  import '../x402/index.js';
6
6
  import 'viem';
package/dist/cli/index.js CHANGED
@@ -154,7 +154,8 @@ var ToolSchema = z.object({
154
154
  annotations: McpAnnotationsSchema.optional(),
155
155
  payment: PaymentConfigSchema.optional(),
156
156
  discovery: DiscoveryMetadataSchema.optional(),
157
- chains: z.array(z.union([z.string(), z.number()])).optional()
157
+ chains: z.array(z.union([z.string(), z.number()])).optional(),
158
+ notifyEmail: z.boolean().optional()
158
159
  }).strict();
159
160
  var MetadataSchema = z.object({
160
161
  metadataSpecVersion: z.string().optional(),
@@ -357,6 +358,10 @@ async function buildMetadataArtifact(options) {
357
358
  if (toolChains) {
358
359
  toolDefinition.chains = toolChains;
359
360
  }
361
+ const notifyEmail = tool.notifyEmail ?? tool.schedule?.notifyEmail;
362
+ if (notifyEmail !== void 0) {
363
+ toolDefinition.notifyEmail = notifyEmail;
364
+ }
360
365
  return toolDefinition;
361
366
  });
362
367
  const metadata = BuildMetadataSchema.parse({
@@ -1093,6 +1098,7 @@ async function loadAndValidateTools(toolsDir, options = {}) {
1093
1098
  }
1094
1099
  let normalizedSchedule = null;
1095
1100
  const schedule = toolModule?.profile?.schedule;
1101
+ const profileNotifyEmail = typeof toolModule?.profile?.notifyEmail === "boolean" ? toolModule.profile.notifyEmail : void 0;
1096
1102
  if (hasGET && schedule && typeof schedule.cron === "string" && schedule.cron.trim().length > 0) {
1097
1103
  normalizedSchedule = normalizeScheduleExpression(schedule.cron, file);
1098
1104
  if (typeof schedule.enabled === "boolean") {
@@ -1162,6 +1168,7 @@ async function loadAndValidateTools(toolsDir, options = {}) {
1162
1168
  handler: async (params) => adapter(params),
1163
1169
  payment: paymentExport ?? null,
1164
1170
  schedule: normalizedSchedule,
1171
+ ...profileNotifyEmail !== void 0 ? { notifyEmail: profileNotifyEmail } : {},
1165
1172
  profileDescription: typeof toolModule?.profile?.description === "string" ? toolModule.profile?.description ?? null : null
1166
1173
  };
1167
1174
  tools.push(tool);