webmcp-types 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +16 -0
  2. package/index.d.ts +6 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -64,3 +64,19 @@ you may need the following in `webpack.config.js`:
64
64
  ```js
65
65
  "types": ["webmcp-types"]
66
66
  ```
67
+
68
+ ### Publish a new npm package version
69
+
70
+ (only for people who have npm publish access)
71
+
72
+ * Make sure you are in the upstream repo, not your forked one. And make sure you are synced to latest commit intended for publish
73
+ - `git checkout main`
74
+ - `git pull https://github.com/webmachinelearning/webmcp-types.git main`
75
+ - (If you are using HTTPS regularly. You can use remote names like `origin`, just make sure you are referring to the right repo)
76
+ * Create the version tag and commit, and push
77
+ - `npm version patch`
78
+ - `git push https://github.com/webmachinelearning/webmcp-types.git main --tags`
79
+ * publish the package
80
+ - `npm publish --otp=<code>`
81
+ - Replace `<code>` with the one-time password from your authenticator, since two-factors authentication is required to publish.
82
+ - If you are doing for the first time, you will do `npm adduser` first and it will guide you through adding the npm account.
package/index.d.ts CHANGED
@@ -2,12 +2,17 @@
2
2
  * The WebMCP API enables web apps to provide JavaScript-based tools to AI agents.
3
3
  */
4
4
  declare namespace WebMCP {
5
+ /**
6
+ * Value that may be returned synchronously or via Promise.
7
+ */
8
+ type MaybePromise<T> = T | Promise<T>;
9
+
5
10
  /**
6
11
  * Callback for tool execution.
7
12
  * @param input The input parameters for the tool, as defined by its inputSchema.
8
13
  * @returns A promise that resolves with the tool's output.
9
14
  */
10
- type ToolExecuteCallback = (input: object) => Promise<any>;
15
+ type ToolExecuteCallback<T extends Record<string, unknown>> = (input: T) => MaybePromise<unknown>;
11
16
 
12
17
  /**
13
18
  * Metadata about a tool's behavior.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webmcp-types",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "repository": "webmachinelearning/webmcp-types",
5
5
  "homepage": "https://github.com/webmachinelearning/webmcp-types",
6
6
  "bugs": "https://github.com/webmachinelearning/webmcp-types/issues",