{"_id":"webmcp-types@0.2.0","bugs":{"url":"https://github.com/webmachinelearning/webmcp-types/issues"},"dist":{"shasum":"ab8b58f580d52e74e76e6e396d4f826335371e21","tarball":"http://registry-npm.ywwl.com/webmcp-types/download/webmcp-types-0.2.0.tgz","fileCount":4,"integrity":"sha512-YPuBdkpZbmOKHwH00buRfqNfYWK9o85iL53dn9KLSBAzMPMFVQ3xwtBqKv855lPwlMwAoHFUm7ypreiTPgyrng==","signatures":[{"sig":"MEUCIQCRNdI3rsvKIVEJlVFLFoiK9YJn6b+KM4ah43zpqmxiaAIgAWIuDYvCVOQ4Phi5XNqhvLRs/NdI9wUIlzCqau6lE5E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCSpn/SRaviMIhKgkhCIycGQAH8gql1O2KSLX0usxaaTQIgbNMc8A6/myaf88VwwlZz23jgltTYwr6zJO29Iz1Ka6U="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/webmcp-types@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":19546,"size":5901,"noattachment":false,"key":"/webmcp-types/-/webmcp-types-0.2.0.tgz"},"main":"","name":"webmcp-types","types":"index.d.ts","gitHead":"c7c48de0dfb9a2f87f0028cdd80b53a1ccfc2b9f","license":"MIT","scripts":{"test":"vitest run --typecheck.only && tsc -p tsconfig.json --strictNullChecks false"},"version":"0.2.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"06caa6b2-dd97-4de5-85cd-73264deef93f"}},"homepage":"https://github.com/webmachinelearning/webmcp-types","keywords":["webmcp","typescript","types"],"repository":{"url":"git+https://github.com/webmachinelearning/webmcp-types.git","type":"git"},"_npmVersion":"11.19.1","description":"TypeScript type definitions for WebMCP","directories":{},"maintainers":[{"name":"fbeaufort","email":"fbeaufort@google.com"}],"_nodeVersion":"24.22.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.11","typescript":"7.0.2"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/webmcp-types_0.2.0_1795166209590_0.7022760121406604"},"readme":"# Typescript Type Definitions for WebMCP\n\nThis package defines Typescript types (`.d.ts`) for the [WebMCP specification](https://webmachinelearning.github.io/webmcp).\n\nUse this package to augment the ambient [`\"dom\"`](https://www.typescriptlang.org/docs/handbook/compiler-options.html#compiler-options) type definitions with the new definitions for WebMCP.\n\n## What are declaration files?\n\nSee the [TypeScript handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html).\n\n\n## How can I use them?\n\n### Install\n\n- npm: `npm install --save-dev webmcp-types`\n- yarn: `yarn add --dev webmcp-types`\n- pnpm: `pnpm add -D webmcp-types`\n\nThis package requires TypeScript 5.0 or newer.\n\n### Configure\n\nSince this package is outside DefinitelyTyped, the dependency won't be picked up automatically.\nThere are several ways to add a additional TypeScript type definition dependencies to your TypeScript project:\n\n#### TypeScript `tsc` and `tsc`-based bundlers\n\nIn `tsconfig.json`:\n\n```js\n{\n  // ...\n  \"compilerOptions\": {\n    // ...\n    \"types\": [\"webmcp-types\"]\n  }\n}\n```\n\nOr you can use `typeRoots`:\n\n```js\n{\n  // ...\n  \"compilerOptions\": {\n    // ...\n    \"typeRoots\": [\"./node_modules/webmcp-types\", \"./node_modules/@types\"]\n  }\n}\n```\n\n#### Inline in TypeScript\n\nThis may work better if your toolchain doesn't read `tsconfig.json`.\n\n```ts\n/// <reference types=\"webmcp-types\" />\n```\n\n#### Webpack\n\nIf you use Webpack and the options above aren't sufficient (this has not been verified),\nyou may need the following in `webpack.config.js`:\n\n```js\n\"types\": [\"webmcp-types\"]\n```\n\n### Infer types from schemas\n\nWhen `inputSchema` and `outputSchema` are written inline, `registerTool()` infers the type of\n`execute`'s input and checks its return value against the output schema:\n\n```ts\ndocument.modelContext?.registerTool({\n  name: \"search\",\n  description: \"Searches the catalog.\",\n  inputSchema: {\n    type: \"object\",\n    properties: { query: { type: \"string\" }, limit: { type: \"integer\" } },\n    required: [\"query\"],\n  },\n  outputSchema: {\n    type: \"object\",\n    properties: { results: { type: \"array\", items: { type: \"string\" } } },\n    required: [\"results\"],\n  },\n  // input: { query: string; limit?: number }\n  // return type: { results: string[] } (or a Promise of it)\n  execute: async (input) => ({ results: [input.query] }),\n});\n```\n\nTools without schemas, or whose schemas are typed as a plain `object`, fall back to a\n`Record<string, unknown>` input and an `unknown` return type.\n\n> [!NOTE]\n> If `execute` declares no parameters (e.g. `() => ({ status: \"ok\" })`), TypeScript checks it before\n> inferring the output schema, so returned `enum`/`const` values are widened (e.g. to `string`) and\n> rejected. Declaring the input parameter (e.g. `(input) => ...`) avoids this.\n\n### Run the type tests\n\n- `npm install`\n- `npm test`\n\nThe tests in `index.test-d.ts` are statically checked with [Vitest typecheck mode](https://vitest.dev/guide/testing-types) against `tsconfig.json`; they are never executed.\n\n### Publish a new npm package version\n\n[Release Please](https://github.com/googleapis/release-please) keeps a release pull request open with the next version and changelog, based on [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) on `main`. Merging it creates the GitHub release and publishes to npm through [trusted publishing](https://docs.npmjs.com/trusted-publishers/); no npm token or local publish step is needed.\n","publish_time":1795166209659,"_cnpm_publish_time":1795166209659,"dist-tags":{"latest":"0.2.0"}}