diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d77a383..6fb9f10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' - name: Bootstrap run: ./scripts/bootstrap @@ -46,7 +46,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' - name: Bootstrap run: ./scripts/bootstrap @@ -68,6 +68,15 @@ jobs: AUTH: ${{ steps.github-oidc.outputs.github_token }} SHA: ${{ github.sha }} run: ./scripts/utils/upload-artifact.sh + + - name: Upload MCP Server tarball + if: github.repository == 'stainless-sdks/hyperswitch-typescript' + env: + URL: https://pkg.stainless.com/s?subpackage=mcp-server + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + BUILD_PATH: packages/mcp-server/dist + run: ./scripts/utils/upload-artifact.sh test: timeout-minutes: 10 name: test diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 063a4ae..d7a8735 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.1-alpha.1" + ".": "0.1.0-alpha.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 118e076..6c30d06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,63 @@ # Changelog +## 0.1.0-alpha.1 (2025-08-29) + +Full Changelog: [v0.0.1-alpha.1...v0.1.0-alpha.1](https://github.com/gorakhnathy7/hs-mcp/compare/v0.0.1-alpha.1...v0.1.0-alpha.1) + +### Features + +* clean up environment call outs ([67f1a1d](https://github.com/gorakhnathy7/hs-mcp/commit/67f1a1d670e8e6345a78f14eb4e358a9af00050b)) +* **mcp:** add code execution tool ([28a0bd0](https://github.com/gorakhnathy7/hs-mcp/commit/28a0bd05e0c5988e1cc36f8e5db6090a6b35ee7d)) +* **mcp:** add logging when environment variable is set ([3f111e0](https://github.com/gorakhnathy7/hs-mcp/commit/3f111e072ea107f1a95355e4be21eb12be1286fd)) +* **mcp:** add option to infer mcp client ([f767f94](https://github.com/gorakhnathy7/hs-mcp/commit/f767f9418c3a828254d31132a1ea487aedb46056)) +* **mcp:** add unix socket option for remote MCP ([21a5331](https://github.com/gorakhnathy7/hs-mcp/commit/21a5331ea0916bbf264b58cb2c71a67020a565b5)) +* **mcp:** parse query string as mcp client options in mcp server ([c569945](https://github.com/gorakhnathy7/hs-mcp/commit/c5699456c5ea54f776c37e38979f1d108c4fe7c7)) +* **mcp:** remote server with passthru auth ([3e8772b](https://github.com/gorakhnathy7/hs-mcp/commit/3e8772b34da07e178818095c96c1439ba4f859b2)) + + +### Bug Fixes + +* **mcp:** avoid sending `jq_filter` to base API ([5d9293a](https://github.com/gorakhnathy7/hs-mcp/commit/5d9293ae60f78233ec2f879ac873299eb69fcec3)) +* **mcp:** fix bug in header handling ([2e52a55](https://github.com/gorakhnathy7/hs-mcp/commit/2e52a55ba19a293660d678184e6ebefc6b4ad95a)) +* **mcp:** fix tool description of jq_filter ([93d9fc6](https://github.com/gorakhnathy7/hs-mcp/commit/93d9fc6e4c0b78d09ccebc5f43723a5b280f209e)) +* **mcp:** generate additionalProperties=true for map schemas to avoid validation issues ([1f09439](https://github.com/gorakhnathy7/hs-mcp/commit/1f0943926f80c18063262273840e96fc6bc98876)) +* **mcp:** include required section for top-level properties and support naming transformations ([c80d7e4](https://github.com/gorakhnathy7/hs-mcp/commit/c80d7e4087257b9b45fc3d53deffec0f5c2c37ac)) +* **mcp:** reverse validJson capability option and limit scope ([7524d52](https://github.com/gorakhnathy7/hs-mcp/commit/7524d520dcbaaaed1d6cf8bcb2c15ab0276e8783)) +* **mcp:** support jq filtering on cloudflare workers ([c564d5b](https://github.com/gorakhnathy7/hs-mcp/commit/c564d5bc3893c126fa175fe6cfe14cbb4d3048e2)) + + +### Chores + +* add docs to RequestOptions type ([b19a4e9](https://github.com/gorakhnathy7/hs-mcp/commit/b19a4e9c549f751fe6c53f15a7888a530bb0fa56)) +* add package to package.json ([a69ea91](https://github.com/gorakhnathy7/hs-mcp/commit/a69ea91d5e8d4ed628ad043af7dfe9bd7bed4904)) +* **client:** qualify global Blob ([32af13d](https://github.com/gorakhnathy7/hs-mcp/commit/32af13dd4600728cf05e934461b7d02e062197f5)) +* **deps:** update dependency @types/node to v20.17.58 ([d4a921b](https://github.com/gorakhnathy7/hs-mcp/commit/d4a921b33249431274fe01f2e8e71b1df30599dc)) +* **internal:** codegen related update ([5c85e43](https://github.com/gorakhnathy7/hs-mcp/commit/5c85e4364844fca77e314541db6152542b899c29)) +* **internal:** codegen related update ([2d8c2f4](https://github.com/gorakhnathy7/hs-mcp/commit/2d8c2f4a2e49baa2cc793b2ee01089971a775241)) +* **internal:** codegen related update ([247a7c8](https://github.com/gorakhnathy7/hs-mcp/commit/247a7c81d0ed517450132ac5bb42a7c0865b1d1c)) +* **internal:** codegen related update ([e0977be](https://github.com/gorakhnathy7/hs-mcp/commit/e0977bea956db2822da1a4fa1585273e1bd99e77)) +* **internal:** codegen related update ([1eba97c](https://github.com/gorakhnathy7/hs-mcp/commit/1eba97c82c9501f1be5d958502e9d069bb99cc0a)) +* **internal:** formatting change ([019bda1](https://github.com/gorakhnathy7/hs-mcp/commit/019bda15e6c9cb65b27081ea17832deccb08d0f1)) +* **internal:** make mcp-server publishing public by defaut ([c61ae9b](https://github.com/gorakhnathy7/hs-mcp/commit/c61ae9b0861a98460adcb0b0e0f926d9c38aff0d)) +* **internal:** move publish config ([fa09aca](https://github.com/gorakhnathy7/hs-mcp/commit/fa09aca8fab54a0bcd7cf5ccbdc10bf40913ff01)) +* **internal:** refactor array check ([ce949f6](https://github.com/gorakhnathy7/hs-mcp/commit/ce949f6cad7f4226d9742e6b7d71463a18814083)) +* **internal:** remove redundant imports config ([a1e0b4a](https://github.com/gorakhnathy7/hs-mcp/commit/a1e0b4a0cccd7fd08cf779e0a889a4a5ece9201c)) +* **internal:** update comment in script ([9753a3d](https://github.com/gorakhnathy7/hs-mcp/commit/9753a3d0305ae850c5f89449e4a66e34545818a6)) +* **internal:** update global Error reference ([b17a4e5](https://github.com/gorakhnathy7/hs-mcp/commit/b17a4e526619f0f359673e4e337f75de862ecb30)) +* make some internal functions async ([a4cd427](https://github.com/gorakhnathy7/hs-mcp/commit/a4cd42713bbe37d5c2b1441359676a5cb2dd50c2)) +* **mcp:** add cors to oauth metadata route ([b34d42b](https://github.com/gorakhnathy7/hs-mcp/commit/b34d42bad22fb1dc838bd3aa08e57a47162a3d6d)) +* **mcp:** document remote server in README.md ([23045e5](https://github.com/gorakhnathy7/hs-mcp/commit/23045e5f3a564d3daa3b1256636a6b7395de0ed0)) +* **mcp:** formatting ([60e25ff](https://github.com/gorakhnathy7/hs-mcp/commit/60e25ff32e3fa9efd1f8eec0358d04119c6b031f)) +* **mcp:** minor cleanup of types and package.json ([83fdd3e](https://github.com/gorakhnathy7/hs-mcp/commit/83fdd3e24c87d99e52db624917a1dd85d5fd5952)) +* **mcp:** refactor streamable http transport ([7ea0e98](https://github.com/gorakhnathy7/hs-mcp/commit/7ea0e9801d973e095c1aad8115ba01aa0b73bdce)) +* **mcp:** rework imports in tools ([39f8847](https://github.com/gorakhnathy7/hs-mcp/commit/39f8847d28feb43481d28cd454f3d6d470fbfbc6)) +* **mcp:** update package.json ([a6a6b0c](https://github.com/gorakhnathy7/hs-mcp/commit/a6a6b0c2f1fc9f56fe40173ad3f8b4914149927f)) +* **mcp:** update README ([8cda3b4](https://github.com/gorakhnathy7/hs-mcp/commit/8cda3b47c7257a21fc81209d3a99458885d36ac5)) +* **mcp:** update types ([1d02aa6](https://github.com/gorakhnathy7/hs-mcp/commit/1d02aa64c1b9fdd69668ed0618b2e9f9ed580de8)) +* **ts:** reorder package.json imports ([bb5d6c1](https://github.com/gorakhnathy7/hs-mcp/commit/bb5d6c1a9a216f6bb9c0b80d4e1636ce359e10d6)) +* update @stainless-api/prism-cli to v5.15.0 ([f7386b8](https://github.com/gorakhnathy7/hs-mcp/commit/f7386b839fd22de3b3da4103f96dbdd98caa5cd3)) +* update CI script ([9e50c83](https://github.com/gorakhnathy7/hs-mcp/commit/9e50c83d0f409cf619ea703a08b411aa36e46a97)) + ## 0.0.1-alpha.1 (2025-07-01) Full Changelog: [v0.0.1-alpha.0...v0.0.1-alpha.1](https://github.com/gorakhnathy7/hs-mcp/compare/v0.0.1-alpha.0...v0.0.1-alpha.1) diff --git a/README.md b/README.md index d823d56..0dd9b84 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,6 @@ import Hyperswitch from 'hyperswitch'; const client = new Hyperswitch({ apiKey: process.env['HYPERSWITCH_API_KEY'], // This is the default and can be omitted - ephemeralKey: process.env['HYPERSWITCH_EPHEMERAL_KEY'], // This is the default and can be omitted - jwtKey: process.env['HYPERSWITCH_JWT_KEY'], // This is the default and can be omitted - publishableKey: process.env['HYPERSWITCH_PUBLISHABLE_KEY'], // This is the default and can be omitted }); const paymentsCreateResponseOpenAPI = await client.payments.create({ amount: 6540, currency: 'USD' }); @@ -47,9 +44,6 @@ import Hyperswitch from 'hyperswitch'; const client = new Hyperswitch({ apiKey: process.env['HYPERSWITCH_API_KEY'], // This is the default and can be omitted - ephemeralKey: process.env['HYPERSWITCH_EPHEMERAL_KEY'], // This is the default and can be omitted - jwtKey: process.env['HYPERSWITCH_JWT_KEY'], // This is the default and can be omitted - publishableKey: process.env['HYPERSWITCH_PUBLISHABLE_KEY'], // This is the default and can be omitted }); const params: Hyperswitch.PaymentCreateParams = { amount: 6540, currency: 'USD' }; diff --git a/bin/publish-npm b/bin/publish-npm index fa2243d..45e8aa8 100644 --- a/bin/publish-npm +++ b/bin/publish-npm @@ -58,4 +58,4 @@ else fi # Publish with the appropriate tag -yarn publish --access public --tag "$TAG" +yarn publish --tag "$TAG" diff --git a/package.json b/package.json index 31557d7..341430a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hyperswitch", - "version": "0.0.1-alpha.1", + "version": "0.1.0-alpha.1", "description": "The official TypeScript library for the Hyperswitch API", "author": "Hyperswitch ", "types": "dist/index.d.ts", @@ -13,6 +13,9 @@ "**/*" ], "private": false, + "publishConfig": { + "access": "public" + }, "scripts": { "test": "./scripts/test", "build": "./scripts/build", @@ -30,7 +33,6 @@ "@swc/jest": "^0.2.29", "@types/jest": "^29.4.0", "@types/node": "^20.17.6", - "typescript-eslint": "8.31.1", "@typescript-eslint/eslint-plugin": "8.31.1", "@typescript-eslint/parser": "8.31.1", "eslint": "^9.20.1", @@ -42,13 +44,11 @@ "publint": "^0.2.12", "ts-jest": "^29.1.0", "ts-node": "^10.5.0", - "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz", + "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz", "tsconfig-paths": "^4.0.0", - "typescript": "5.8.3" - }, - "imports": { - "hyperswitch": ".", - "hyperswitch/*": "./src/*" + "tslib": "^2.8.1", + "typescript": "5.8.3", + "typescript-eslint": "8.31.1" }, "exports": { ".": { diff --git a/packages/mcp-server/README.md b/packages/mcp-server/README.md index f34ecc4..9159029 100644 --- a/packages/mcp-server/README.md +++ b/packages/mcp-server/README.md @@ -147,6 +147,48 @@ over time, you can manually enable or disable certain capabilities: --resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards ``` +## Running remotely + +Launching the client with `--transport=http` launches the server as a remote server using Streamable HTTP transport. The `--port` setting can choose the port it will run on, and the `--socket` setting allows it to run on a Unix socket. + +Authorization can be provided via the `Authorization` header using the Bearer scheme. + +Additionally, authorization can be provided via the following headers: +| Header | Equivalent client option | Security scheme | +| ----------------------- | ------------------------ | --------------- | +| `api-key` | `apiKey` | api_key | +| `api-key` | `ephemeralKey` | ephemeral_key | +| `x-hyperswitch-jwt-key` | `jwtKey` | jwt_key | +| `api-key` | `publishableKey` | publishable_key | + +A configuration JSON for this server might look like this, assuming the server is hosted at `http://localhost:3000`: + +```json +{ + "mcpServers": { + "hyperswitch_api": { + "url": "http://localhost:3000", + "headers": { + "Authorization": "Bearer " + } + } + } +} +``` + +The command-line arguments for filtering tools and specifying clients can also be used as query parameters in the URL. +For example, to exclude specific tools while including others, use the URL: + +``` +http://localhost:3000?resource=cards&resource=accounts&no_tool=create_cards +``` + +Or, to configure for the Cursor client, with a custom max tool name length, use the URL: + +``` +http://localhost:3000?client=cursor&capability=tool-name-length%3D40 +``` + ## Importing the tools and server individually ```js diff --git a/packages/mcp-server/package.json b/packages/mcp-server/package.json index cc291df..22a89ed 100644 --- a/packages/mcp-server/package.json +++ b/packages/mcp-server/package.json @@ -1,6 +1,6 @@ { "name": "hyperswitch-mcp", - "version": "0.0.1-alpha.1", + "version": "0.1.0-alpha.1", "description": "The official MCP Server for the Hyperswitch API", "author": "Hyperswitch ", "types": "dist/index.d.ts", @@ -15,6 +15,9 @@ "license": "Apache-2.0", "packageManager": "yarn@1.22.22", "private": false, + "publishConfig": { + "access": "public" + }, "scripts": { "test": "jest", "build": "bash ./build", @@ -28,17 +31,27 @@ }, "dependencies": { "hyperswitch": "file:../../dist/", + "@cloudflare/cabidela": "^0.2.4", "@modelcontextprotocol/sdk": "^1.11.5", + "@valtown/deno-http-worker": "^0.0.21", + "cors": "^2.8.5", + "express": "^5.1.0", + "jq-web": "https://github.com/stainless-api/jq-web/releases/download/v0.8.6/jq-web.tar.gz", + "qs": "^6.14.0", "yargs": "^17.7.2", - "@cloudflare/cabidela": "^0.2.4", "zod": "^3.25.20", - "zod-to-json-schema": "^3.24.5" + "zod-to-json-schema": "^3.24.5", + "zod-validation-error": "^4.0.1" }, "bin": { "mcp-server": "dist/index.js" }, "devDependencies": { + "@types/cors": "^2.8.19", + "@types/express": "^5.0.3", "@types/jest": "^29.4.0", + "@types/qs": "^6.14.0", + "@types/yargs": "^17.0.8", "@typescript-eslint/eslint-plugin": "8.31.1", "@typescript-eslint/parser": "8.31.1", "eslint": "^8.49.0", @@ -49,7 +62,7 @@ "ts-jest": "^29.1.0", "ts-morph": "^19.0.0", "ts-node": "^10.5.0", - "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz", + "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz", "tsconfig-paths": "^4.0.0", "typescript": "5.8.3" }, diff --git a/packages/mcp-server/src/code-tool-paths.cts b/packages/mcp-server/src/code-tool-paths.cts new file mode 100644 index 0000000..15ce7f5 --- /dev/null +++ b/packages/mcp-server/src/code-tool-paths.cts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export const workerPath = require.resolve('./code-tool-worker.mjs'); diff --git a/packages/mcp-server/src/code-tool-types.ts b/packages/mcp-server/src/code-tool-types.ts new file mode 100644 index 0000000..da0e05f --- /dev/null +++ b/packages/mcp-server/src/code-tool-types.ts @@ -0,0 +1,14 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { ClientOptions } from 'hyperswitch'; + +export type WorkerInput = { + opts: ClientOptions; + code: string; +}; +export type WorkerSuccess = { + result: unknown | null; + logLines: string[]; + errLines: string[]; +}; +export type WorkerError = { message: string | undefined }; diff --git a/packages/mcp-server/src/code-tool-worker.ts b/packages/mcp-server/src/code-tool-worker.ts new file mode 100644 index 0000000..d86928b --- /dev/null +++ b/packages/mcp-server/src/code-tool-worker.ts @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import util from 'node:util'; +import { WorkerInput, WorkerSuccess, WorkerError } from './code-tool-types'; +import { Hyperswitch } from 'hyperswitch'; + +const fetch = async (req: Request): Promise => { + const { opts, code } = (await req.json()) as WorkerInput; + const client = new Hyperswitch({ + ...opts, + }); + + const logLines: string[] = []; + const errLines: string[] = []; + const console = { + log: (...args: unknown[]) => { + logLines.push(util.format(...args)); + }, + error: (...args: unknown[]) => { + errLines.push(util.format(...args)); + }, + }; + try { + let run_ = async (client: any) => {}; + eval(` + ${code} + run_ = run; + `); + const result = await run_(client); + return Response.json({ + result, + logLines, + errLines, + } satisfies WorkerSuccess); + } catch (e) { + const message = e instanceof Error ? e.message : undefined; + return Response.json( + { + message, + } satisfies WorkerError, + { status: 400, statusText: 'Code execution error' }, + ); + } +}; + +export default { fetch }; diff --git a/packages/mcp-server/src/code-tool.ts b/packages/mcp-server/src/code-tool.ts new file mode 100644 index 0000000..028cfad --- /dev/null +++ b/packages/mcp-server/src/code-tool.ts @@ -0,0 +1,147 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { dirname } from 'node:path'; +import { pathToFileURL } from 'node:url'; +import Hyperswitch, { ClientOptions } from 'hyperswitch'; +import { Endpoint, ContentBlock, Metadata } from './tools/types'; + +import { Tool } from '@modelcontextprotocol/sdk/types.js'; + +import { newDenoHTTPWorker } from '@valtown/deno-http-worker'; +import { WorkerInput, WorkerError, WorkerSuccess } from './code-tool-types'; +import { workerPath } from './code-tool-paths.cjs'; + +/** + * A tool that runs code against a copy of the SDK. + * + * Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once, + * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then + * a generic endpoint that can be used to invoke any endpoint with the provided arguments. + * + * @param endpoints - The endpoints to include in the list. + */ +export function codeTool(): Endpoint { + const metadata: Metadata = { resource: 'all', operation: 'write', tags: [] }; + const tool: Tool = { + name: 'execute', + description: + 'Runs Typescript code to interact with the API.\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized client, and it will be run.\nDo not initialize a client, but instead use the client that you are given as a parameter.\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.', + inputSchema: { type: 'object', properties: { code: { type: 'string' } } }, + }; + + const handler = async (client: Hyperswitch, args: unknown) => { + const baseURLHostname = new URL(client.baseURL).hostname; + const { code } = args as { code: string }; + + const worker = await newDenoHTTPWorker(pathToFileURL(workerPath), { + runFlags: [ + `--node-modules-dir=manual`, + `--allow-read=code-tool-worker.mjs,${workerPath.replace(/([\/\\]node_modules)[\/\\].+$/, '$1')}/`, + `--allow-net=${baseURLHostname}`, + // Allow environment variables because instantiating the client will try to read from them, + // even though they are not set. + '--allow-env', + ], + printOutput: true, + spawnOptions: { + cwd: dirname(workerPath), + }, + }); + + try { + const resp = await new Promise((resolve, reject) => { + worker.addEventListener('exit', (exitCode) => { + reject(new Error(`Worker exited with code ${exitCode}`)); + }); + + const opts: ClientOptions = { + baseURL: client.baseURL, + apiKey: client.apiKey, + ephemeralKey: client.ephemeralKey, + jwtKey: client.jwtKey, + publishableKey: client.publishableKey, + defaultHeaders: { + 'X-Stainless-MCP': 'true', + }, + }; + + const req = worker.request( + 'http://localhost', + { + headers: { + 'content-type': 'application/json', + }, + method: 'POST', + }, + (resp) => { + const body: Uint8Array[] = []; + resp.on('error', (err) => { + reject(err); + }); + resp.on('data', (chunk) => { + body.push(chunk); + }); + resp.on('end', () => { + resolve( + new Response(Buffer.concat(body).toString(), { + status: resp.statusCode ?? 200, + headers: resp.headers as any, + }), + ); + }); + }, + ); + + const body = JSON.stringify({ + opts, + code, + } satisfies WorkerInput); + + req.write(body, (err) => { + if (err !== null && err !== undefined) { + reject(err); + } + }); + + req.end(); + }); + + if (resp.status === 200) { + const { result, logLines, errLines } = (await resp.json()) as WorkerSuccess; + const returnOutput: ContentBlock | null = + result === null ? null + : result === undefined ? null + : { + type: 'text', + text: typeof result === 'string' ? (result as string) : JSON.stringify(result), + }; + const logOutput: ContentBlock | null = + logLines.length === 0 ? + null + : { + type: 'text', + text: logLines.join('\n'), + }; + const errOutput: ContentBlock | null = + errLines.length === 0 ? + null + : { + type: 'text', + text: 'Error output:\n' + errLines.join('\n'), + }; + return { + content: [returnOutput, logOutput, errOutput].filter((block) => block !== null), + }; + } else { + const { message } = (await resp.json()) as WorkerError; + throw new Error(message); + } + } catch (e) { + throw e; + } finally { + worker.terminate(); + } + }; + + return { metadata, tool, handler }; +} diff --git a/packages/mcp-server/src/compat.ts b/packages/mcp-server/src/compat.ts index ff0d6d4..f84053c 100644 --- a/packages/mcp-server/src/compat.ts +++ b/packages/mcp-server/src/compat.ts @@ -1,4 +1,5 @@ import { Tool } from '@modelcontextprotocol/sdk/types.js'; +import { z } from 'zod'; import { Endpoint } from './tools'; export interface ClientCapabilities { @@ -19,12 +20,13 @@ export const defaultClientCapabilities: ClientCapabilities = { toolNameLength: undefined, }; -export type ClientType = 'openai-agents' | 'claude' | 'claude-code' | 'cursor'; +export const ClientType = z.enum(['openai-agents', 'claude', 'claude-code', 'cursor', 'infer']); +export type ClientType = z.infer; // Client presets for compatibility // Note that these could change over time as models get better, so this is // a best effort. -export const knownClients: Record = { +export const knownClients: Record, ClientCapabilities> = { 'openai-agents': { topLevelUnions: false, validJson: true, @@ -70,8 +72,11 @@ export function parseEmbeddedJSON(args: Record, schema: Record< if (typeof value === 'string') { try { const parsed = JSON.parse(value); - newArgs[key] = parsed; - updated = true; + // Only parse if result is a plain object (not array, null, or primitive) + if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) { + newArgs[key] = parsed; + updated = true; + } } catch (e) { // Not valid JSON, leave as is } diff --git a/packages/mcp-server/src/filtering.ts b/packages/mcp-server/src/filtering.ts new file mode 100644 index 0000000..1aa9a40 --- /dev/null +++ b/packages/mcp-server/src/filtering.ts @@ -0,0 +1,14 @@ +// @ts-nocheck +import initJq from 'jq-web'; + +export async function maybeFilter(jqFilter: unknown | undefined, response: any): Promise { + if (jqFilter && typeof jqFilter === 'string') { + return await jq(response, jqFilter); + } else { + return response; + } +} + +async function jq(json: any, jqFilter: string) { + return (await initJq).json(json, jqFilter); +} diff --git a/packages/mcp-server/src/headers.ts b/packages/mcp-server/src/headers.ts new file mode 100644 index 0000000..115a2cc --- /dev/null +++ b/packages/mcp-server/src/headers.ts @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { IncomingMessage } from 'node:http'; +import { ClientOptions } from 'hyperswitch'; + +export const parseAuthHeaders = (req: IncomingMessage): Partial => { + if (req.headers.authorization) { + const scheme = req.headers.authorization.split(' ')[0]!; + const value = req.headers.authorization.slice(scheme.length + 1); + switch (scheme) { + case 'Bearer': + return { jwtKey: req.headers.authorization.slice('Bearer '.length) }; + default: + throw new Error(`Unsupported authorization scheme`); + } + } + + const apiKey = Array.isArray(req.headers['api-key']) ? req.headers['api-key'][0] : req.headers['api-key']; + const ephemeralKey = + Array.isArray(req.headers['api-key']) ? req.headers['api-key'][0] : req.headers['api-key']; + const jwtKey = + Array.isArray(req.headers['x-hyperswitch-jwt-key']) ? + req.headers['x-hyperswitch-jwt-key'][0] + : req.headers['x-hyperswitch-jwt-key']; + const publishableKey = + Array.isArray(req.headers['api-key']) ? req.headers['api-key'][0] : req.headers['api-key']; + return { apiKey, ephemeralKey, jwtKey, publishableKey }; +}; diff --git a/packages/mcp-server/src/http.ts b/packages/mcp-server/src/http.ts new file mode 100644 index 0000000..c11185b --- /dev/null +++ b/packages/mcp-server/src/http.ts @@ -0,0 +1,115 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { McpServer } from '@modelcontextprotocol/sdk/server/mcp'; +import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'; + +import express from 'express'; +import { fromError } from 'zod-validation-error/v3'; +import { McpOptions, parseQueryOptions } from './options'; +import { initMcpServer, newMcpServer } from './server'; +import { parseAuthHeaders } from './headers'; + +const newServer = ( + defaultMcpOptions: McpOptions, + req: express.Request, + res: express.Response, +): McpServer | null => { + const server = newMcpServer(); + + let mcpOptions: McpOptions; + try { + mcpOptions = parseQueryOptions(defaultMcpOptions, req.query); + } catch (error) { + res.status(400).json({ + jsonrpc: '2.0', + error: { + code: -32000, + message: `Invalid request: ${fromError(error)}`, + }, + }); + return null; + } + + try { + const authOptions = parseAuthHeaders(req); + initMcpServer({ + server: server, + clientOptions: { + ...authOptions, + defaultHeaders: { + 'X-Stainless-MCP': 'true', + }, + }, + mcpOptions, + }); + } catch { + res.status(401).json({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Unauthorized', + }, + }); + return null; + } + + return server; +}; + +const post = (defaultOptions: McpOptions) => async (req: express.Request, res: express.Response) => { + const server = newServer(defaultOptions, req, res); + // If we return null, we already set the authorization error. + if (server === null) return; + const transport = new StreamableHTTPServerTransport({ + // Stateless server + sessionIdGenerator: undefined, + }); + await server.connect(transport); + await transport.handleRequest(req, res, req.body); +}; + +const get = async (req: express.Request, res: express.Response) => { + res.status(405).json({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Method not supported', + }, + }); +}; + +const del = async (req: express.Request, res: express.Response) => { + res.status(405).json({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Method not supported', + }, + }); +}; + +export const streamableHTTPApp = (options: McpOptions): express.Express => { + const app = express(); + app.set('query parser', 'extended'); + app.use(express.json()); + + app.get('/', get); + app.post('/', post(options)); + app.delete('/', del); + + return app; +}; + +export const launchStreamableHTTPServer = async (options: McpOptions, port: number | string | undefined) => { + const app = streamableHTTPApp(options); + const server = app.listen(port); + const address = server.address(); + + if (typeof address === 'string') { + console.error(`MCP Server running on streamable HTTP at ${address}`); + } else if (address !== null) { + console.error(`MCP Server running on streamable HTTP on port ${address.port}`); + } else { + console.error(`MCP Server running on streamable HTTP on port ${port}`); + } +}; diff --git a/packages/mcp-server/src/index.ts b/packages/mcp-server/src/index.ts index 0621357..c450e4b 100644 --- a/packages/mcp-server/src/index.ts +++ b/packages/mcp-server/src/index.ts @@ -1,9 +1,10 @@ #!/usr/bin/env node -import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; -import { init, selectTools, server } from './server'; +import { selectTools } from './server'; import { Endpoint, endpoints } from './tools'; -import { McpOptions, parseOptions } from './options'; +import { McpOptions, parseCLIOptions } from './options'; +import { launchStdioServer } from './stdio'; +import { launchStreamableHTTPServer } from './http'; async function main() { const options = parseOptionsOrError(); @@ -13,18 +14,21 @@ async function main() { return; } - const includedTools = selectToolsOrError(endpoints, options); + const selectedTools = selectToolsOrError(endpoints, options); console.error( - `MCP Server starting with ${includedTools.length} tools:`, - includedTools.map((e) => e.tool.name), + `MCP Server starting with ${selectedTools.length} tools:`, + selectedTools.map((e) => e.tool.name), ); - init({ server, endpoints: includedTools }); - - const transport = new StdioServerTransport(); - await server.connect(transport); - console.error('MCP Server running on stdio'); + switch (options.transport) { + case 'stdio': + await launchStdioServer(options); + break; + case 'http': + await launchStreamableHTTPServer(options, options.port ?? options.socket); + break; + } } if (require.main === module) { @@ -36,14 +40,14 @@ if (require.main === module) { function parseOptionsOrError() { try { - return parseOptions(); + return parseCLIOptions(); } catch (error) { console.error('Error parsing options:', error); process.exit(1); } } -function selectToolsOrError(endpoints: Endpoint[], options: McpOptions) { +function selectToolsOrError(endpoints: Endpoint[], options: McpOptions): Endpoint[] { try { const includedTools = selectTools(endpoints, options); if (includedTools.length === 0) { diff --git a/packages/mcp-server/src/options.ts b/packages/mcp-server/src/options.ts index c075101..2100cf5 100644 --- a/packages/mcp-server/src/options.ts +++ b/packages/mcp-server/src/options.ts @@ -1,18 +1,24 @@ +import qs from 'qs'; import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; +import z from 'zod'; import { endpoints, Filter } from './tools'; import { ClientCapabilities, knownClients, ClientType } from './compat'; export type CLIOptions = McpOptions & { list: boolean; + transport: 'stdio' | 'http'; + port: number | undefined; + socket: string | undefined; }; export type McpOptions = { - client: ClientType | undefined; - includeDynamicTools: boolean | undefined; - includeAllTools: boolean | undefined; - filters: Filter[]; - capabilities?: Partial; + client?: ClientType | undefined; + includeDynamicTools?: boolean | undefined; + includeAllTools?: boolean | undefined; + includeCodeTools?: boolean | undefined; + filters?: Filter[] | undefined; + capabilities?: Partial | undefined; }; const CAPABILITY_CHOICES = [ @@ -44,18 +50,18 @@ function parseCapabilityValue(cap: string): { name: Capability; value?: number } return { name: cap as Capability }; } -export function parseOptions(): CLIOptions { +export function parseCLIOptions(): CLIOptions { const opts = yargs(hideBin(process.argv)) .option('tools', { type: 'string', array: true, - choices: ['dynamic', 'all'], + choices: ['dynamic', 'all', 'code'], description: 'Use dynamic tools or all tools', }) .option('no-tools', { type: 'string', array: true, - choices: ['dynamic', 'all'], + choices: ['dynamic', 'all', 'code'], description: 'Do not use any dynamic or all tools', }) .option('tool', { @@ -129,6 +135,20 @@ export function parseOptions(): CLIOptions { type: 'boolean', description: 'Print detailed explanation of client capabilities and exit', }) + .option('transport', { + type: 'string', + choices: ['stdio', 'http'], + default: 'stdio', + description: 'What transport to use; stdio for local servers or http for remote servers', + }) + .option('port', { + type: 'number', + description: 'Port to serve on if using http transport', + }) + .option('socket', { + type: 'string', + description: 'Unix socket to serve on if using http transport', + }) .help(); for (const [command, desc] of examples()) { @@ -184,14 +204,7 @@ export function parseOptions(): CLIOptions { } // Parse client capabilities - const clientCapabilities: ClientCapabilities = { - topLevelUnions: true, - validJson: true, - refs: true, - unions: true, - formats: true, - toolNameLength: undefined, - }; + const clientCapabilities: Partial = {}; // Apply individual capability overrides if (Array.isArray(argv.capability)) { @@ -232,20 +245,144 @@ export function parseOptions(): CLIOptions { } } + const shouldIncludeToolType = (toolType: 'dynamic' | 'all' | 'code') => + explicitTools ? argv.tools?.includes(toolType) && !argv.noTools?.includes(toolType) : undefined; + const explicitTools = Boolean(argv.tools || argv.noTools); - const includeDynamicTools = - explicitTools ? argv.tools?.includes('dynamic') && !argv.noTools?.includes('dynamic') : undefined; - const includeAllTools = - explicitTools ? argv.tools?.includes('all') && !argv.noTools?.includes('all') : undefined; + const includeDynamicTools = shouldIncludeToolType('dynamic'); + const includeAllTools = shouldIncludeToolType('all'); + const includeCodeTools = shouldIncludeToolType('code'); + + const transport = argv.transport as 'stdio' | 'http'; const client = argv.client as ClientType; return { - client: client && knownClients[client] ? client : undefined, + client: client && client !== 'infer' && knownClients[client] ? client : undefined, includeDynamicTools, includeAllTools, + includeCodeTools, filters, capabilities: clientCapabilities, list: argv.list || false, + transport, + port: argv.port, + socket: argv.socket, + }; +} + +const coerceArray = (zodType: T) => + z.preprocess( + (val) => + Array.isArray(val) ? val + : val ? [val] + : val, + z.array(zodType).optional(), + ); + +const QueryOptions = z.object({ + tools: coerceArray(z.enum(['dynamic', 'all'])).describe('Use dynamic tools or all tools'), + no_tools: coerceArray(z.enum(['dynamic', 'all'])).describe('Do not use dynamic tools or all tools'), + tool: coerceArray(z.string()).describe('Include tools matching the specified names'), + resource: coerceArray(z.string()).describe('Include tools matching the specified resources'), + operation: coerceArray(z.enum(['read', 'write'])).describe( + 'Include tools matching the specified operations', + ), + tag: coerceArray(z.string()).describe('Include tools with the specified tags'), + no_tool: coerceArray(z.string()).describe('Exclude tools matching the specified names'), + no_resource: coerceArray(z.string()).describe('Exclude tools matching the specified resources'), + no_operation: coerceArray(z.enum(['read', 'write'])).describe( + 'Exclude tools matching the specified operations', + ), + no_tag: coerceArray(z.string()).describe('Exclude tools with the specified tags'), + client: ClientType.optional().describe('Specify the MCP client being used'), + capability: coerceArray(z.string()).describe('Specify client capabilities'), + no_capability: coerceArray(z.enum(CAPABILITY_CHOICES)).describe('Unset client capabilities'), +}); + +export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): McpOptions { + const queryObject = typeof query === 'string' ? qs.parse(query) : query; + const queryOptions = QueryOptions.parse(queryObject); + + const filters: Filter[] = [...(defaultOptions.filters ?? [])]; + + for (const resource of queryOptions.resource || []) { + filters.push({ type: 'resource', op: 'include', value: resource }); + } + for (const operation of queryOptions.operation || []) { + filters.push({ type: 'operation', op: 'include', value: operation }); + } + for (const tag of queryOptions.tag || []) { + filters.push({ type: 'tag', op: 'include', value: tag }); + } + for (const tool of queryOptions.tool || []) { + filters.push({ type: 'tool', op: 'include', value: tool }); + } + for (const resource of queryOptions.no_resource || []) { + filters.push({ type: 'resource', op: 'exclude', value: resource }); + } + for (const operation of queryOptions.no_operation || []) { + filters.push({ type: 'operation', op: 'exclude', value: operation }); + } + for (const tag of queryOptions.no_tag || []) { + filters.push({ type: 'tag', op: 'exclude', value: tag }); + } + for (const tool of queryOptions.no_tool || []) { + filters.push({ type: 'tool', op: 'exclude', value: tool }); + } + + // Parse client capabilities + const clientCapabilities: Partial = { ...defaultOptions.capabilities }; + + for (const cap of queryOptions.capability || []) { + const parsed = parseCapabilityValue(cap); + if (parsed.name === 'top-level-unions') { + clientCapabilities.topLevelUnions = true; + } else if (parsed.name === 'valid-json') { + clientCapabilities.validJson = true; + } else if (parsed.name === 'refs') { + clientCapabilities.refs = true; + } else if (parsed.name === 'unions') { + clientCapabilities.unions = true; + } else if (parsed.name === 'formats') { + clientCapabilities.formats = true; + } else if (parsed.name === 'tool-name-length') { + clientCapabilities.toolNameLength = parsed.value; + } + } + + for (const cap of queryOptions.no_capability || []) { + if (cap === 'top-level-unions') { + clientCapabilities.topLevelUnions = false; + } else if (cap === 'valid-json') { + clientCapabilities.validJson = false; + } else if (cap === 'refs') { + clientCapabilities.refs = false; + } else if (cap === 'unions') { + clientCapabilities.unions = false; + } else if (cap === 'formats') { + clientCapabilities.formats = false; + } else if (cap === 'tool-name-length') { + clientCapabilities.toolNameLength = undefined; + } + } + + let dynamicTools: boolean | undefined = + queryOptions.no_tools && !queryOptions.no_tools?.includes('dynamic') ? false + : queryOptions.tools?.includes('dynamic') ? true + : defaultOptions.includeDynamicTools; + + let allTools: boolean | undefined = + queryOptions.no_tools && !queryOptions.no_tools?.includes('all') ? false + : queryOptions.tools?.includes('all') ? true + : defaultOptions.includeAllTools; + + return { + client: queryOptions.client ?? defaultOptions.client, + includeDynamicTools: dynamicTools, + includeAllTools: allTools, + includeCodeTools: undefined, + filters, + capabilities: clientCapabilities, }; } diff --git a/packages/mcp-server/src/server.ts b/packages/mcp-server/src/server.ts index bd89239..5eb6080 100644 --- a/packages/mcp-server/src/server.ts +++ b/packages/mcp-server/src/server.ts @@ -3,7 +3,12 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { Endpoint, endpoints, HandlerFunction, query } from './tools'; -import { CallToolRequestSchema, ListToolsRequestSchema, Tool } from '@modelcontextprotocol/sdk/types.js'; +import { + CallToolRequestSchema, + Implementation, + ListToolsRequestSchema, + Tool, +} from '@modelcontextprotocol/sdk/types.js'; import { ClientOptions } from 'hyperswitch'; import Hyperswitch from 'hyperswitch'; import { @@ -14,6 +19,7 @@ import { parseEmbeddedJSON, } from './compat'; import { dynamicTools } from './dynamic-tools'; +import { codeTool } from './code-tool'; import { McpOptions } from './options'; export { McpOptions } from './options'; @@ -22,18 +28,17 @@ export { Filter } from './tools'; export { ClientOptions } from 'hyperswitch'; export { endpoints } from './tools'; -// Create server instance -export const server = new McpServer( - { - name: 'hyperswitch_api', - version: '0.0.1-alpha.1', - }, - { - capabilities: { - tools: {}, +export const newMcpServer = () => + new McpServer( + { + name: 'hyperswitch_api', + version: '0.1.0-alpha.1', }, - }, -); + { capabilities: { tools: {}, logging: {} } }, + ); + +// Create server instance +export const server = newMcpServer(); /** * Initializes the provided MCP Server with the given tools and handlers. @@ -41,72 +46,102 @@ export const server = new McpServer( */ export function initMcpServer(params: { server: Server | McpServer; - clientOptions: ClientOptions; - mcpOptions: McpOptions; - endpoints?: { tool: Tool; handler: HandlerFunction }[]; -}) { - const transformedEndpoints = selectTools(endpoints, params.mcpOptions); - const client = new Hyperswitch(params.clientOptions); - const capabilities = { - ...defaultClientCapabilities, - ...(params.mcpOptions.client ? knownClients[params.mcpOptions.client] : params.mcpOptions.capabilities), - }; - init({ server: params.server, client, endpoints: transformedEndpoints, capabilities }); -} - -export function init(params: { - server: Server | McpServer; - client?: Hyperswitch; - endpoints?: { tool: Tool; handler: HandlerFunction }[]; - capabilities?: Partial; + clientOptions?: ClientOptions; + mcpOptions?: McpOptions; }) { const server = params.server instanceof McpServer ? params.server.server : params.server; - const providedEndpoints = params.endpoints || endpoints; + const mcpOptions = params.mcpOptions ?? {}; + + let providedEndpoints: Endpoint[] | null = null; + let endpointMap: Record | null = null; + + const initTools = (implementation?: Implementation) => { + if (implementation && (!mcpOptions.client || mcpOptions.client === 'infer')) { + mcpOptions.client = + implementation.name.toLowerCase().includes('claude') ? 'claude' + : implementation.name.toLowerCase().includes('cursor') ? 'cursor' + : undefined; + mcpOptions.capabilities = { + ...(mcpOptions.client && knownClients[mcpOptions.client]), + ...mcpOptions.capabilities, + }; + } + providedEndpoints = selectTools(endpoints, mcpOptions); + endpointMap = Object.fromEntries(providedEndpoints.map((endpoint) => [endpoint.tool.name, endpoint])); + }; - const endpointMap = Object.fromEntries(providedEndpoints.map((endpoint) => [endpoint.tool.name, endpoint])); + const logAtLevel = + (level: 'debug' | 'info' | 'warning' | 'error') => + (message: string, ...rest: unknown[]) => { + void server.sendLoggingMessage({ + level, + data: { message, rest }, + }); + }; + const logger = { + debug: logAtLevel('debug'), + info: logAtLevel('info'), + warn: logAtLevel('warning'), + error: logAtLevel('error'), + }; - const client = params.client || new Hyperswitch({ defaultHeaders: { 'X-Stainless-MCP': 'true' } }); + const client = new Hyperswitch({ + logger, + ...params.clientOptions, + defaultHeaders: { + ...params.clientOptions?.defaultHeaders, + 'X-Stainless-MCP': 'true', + }, + }); server.setRequestHandler(ListToolsRequestSchema, async () => { + if (providedEndpoints === null) { + initTools(server.getClientVersion()); + } return { - tools: providedEndpoints.map((endpoint) => endpoint.tool), + tools: providedEndpoints!.map((endpoint) => endpoint.tool), }; }); server.setRequestHandler(CallToolRequestSchema, async (request) => { + if (endpointMap === null) { + initTools(server.getClientVersion()); + } const { name, arguments: args } = request.params; - const endpoint = endpointMap[name]; + const endpoint = endpointMap![name]; if (!endpoint) { throw new Error(`Unknown tool: ${name}`); } - return executeHandler(endpoint.tool, endpoint.handler, client, args, params.capabilities); + return executeHandler(endpoint.tool, endpoint.handler, client, args, mcpOptions.capabilities); }); } /** * Selects the tools to include in the MCP Server based on the provided options. */ -export function selectTools(endpoints: Endpoint[], options: McpOptions) { - const filteredEndpoints = query(options.filters, endpoints); +export function selectTools(endpoints: Endpoint[], options?: McpOptions): Endpoint[] { + const filteredEndpoints = query(options?.filters ?? [], endpoints); let includedTools = filteredEndpoints; if (includedTools.length > 0) { - if (options.includeDynamicTools) { + if (options?.includeDynamicTools) { includedTools = dynamicTools(includedTools); } } else { - if (options.includeAllTools) { + if (options?.includeAllTools) { includedTools = endpoints; - } else if (options.includeDynamicTools) { + } else if (options?.includeDynamicTools) { includedTools = dynamicTools(endpoints); + } else if (options?.includeCodeTools) { + includedTools = [codeTool()]; } else { includedTools = endpoints; } } - const capabilities = { ...defaultClientCapabilities, ...options.capabilities }; + const capabilities = { ...defaultClientCapabilities, ...options?.capabilities }; return applyCompatibilityTransformations(includedTools, capabilities); } @@ -121,7 +156,7 @@ export async function executeHandler( compatibilityOptions?: Partial, ) { const options = { ...defaultClientCapabilities, ...compatibilityOptions }; - if (options.validJson && args) { + if (!options.validJson && args) { args = parseEmbeddedJSON(args, tool.inputSchema); } return await handler(client, args || {}); diff --git a/packages/mcp-server/src/stdio.ts b/packages/mcp-server/src/stdio.ts new file mode 100644 index 0000000..d902a5b --- /dev/null +++ b/packages/mcp-server/src/stdio.ts @@ -0,0 +1,13 @@ +import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; +import { initMcpServer, newMcpServer } from './server'; +import { McpOptions } from './options'; + +export const launchStdioServer = async (options: McpOptions) => { + const server = newMcpServer(); + + initMcpServer({ server, mcpOptions: options }); + + const transport = new StdioServerTransport(); + await server.connect(transport); + console.error('MCP Server running on stdio'); +}; diff --git a/packages/mcp-server/src/tools/accounts/business-profile/create-accounts-business-profile.ts b/packages/mcp-server/src/tools/accounts/business-profile/create-accounts-business-profile.ts index f0244b2..20236c2 100644 --- a/packages/mcp-server/src/tools/accounts/business-profile/create-accounts-business-profile.ts +++ b/packages/mcp-server/src/tools/accounts/business-profile/create-accounts-business-profile.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -51,6 +50,7 @@ export const tool: Tool = { authentication_product_ids: { type: 'object', description: 'Product authentication ids', + additionalProperties: true, }, card_testing_guard_config: { $ref: '#/$defs/card_testing_guard_config', @@ -76,6 +76,7 @@ export const tool: Tool = { frm_routing_algorithm: { type: 'object', description: "The frm routing algorithm to be used for routing payments to desired FRM's", + additionalProperties: true, }, intent_fulfillment_time: { type: 'integer', @@ -133,11 +134,13 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, outgoing_webhook_custom_http_headers: { type: 'object', description: 'These key-value pairs are sent as additional custom headers in the outgoing webhook request. It is recommended not to use more than four key-value pairs.', + additionalProperties: true, }, payment_link_config: { $ref: '#/$defs/business_payment_link_config', @@ -168,6 +171,7 @@ export const tool: Tool = { routing_algorithm: { type: 'object', description: 'The routing algorithm to be used for routing payments to desired connectors', + additionalProperties: true, }, session_expiry: { type: 'integer', @@ -186,6 +190,7 @@ export const tool: Tool = { $ref: '#/$defs/webhook_details', }, }, + required: ['account_id'], $defs: { authentication_connector_details: { type: 'object', @@ -653,6 +658,7 @@ export const tool: Tool = { payment_link_ui_rules: { type: 'object', description: 'Payment link configuration rules', + additionalProperties: true, }, sdk_layout: { type: 'string', @@ -661,6 +667,7 @@ export const tool: Tool = { sdk_ui_rules: { type: 'object', description: 'SDK configuration rules', + additionalProperties: true, }, seller_name: { type: 'string', @@ -712,14 +719,12 @@ export const tool: Tool = { description: 'Position of the key-value pair in the UI', }, }, - required: [], }, }, required: ['key', 'value'], }, }, }, - required: [], }, business_payout_link_config: { allOf: [ @@ -754,7 +759,6 @@ export const tool: Tool = { description: 'Primary color to be used in the form represented in hex format', }, }, - required: [], }, static_routing_algorithm: { anyOf: [ @@ -816,6 +820,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -866,6 +871,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -1092,6 +1098,7 @@ export const tool: Tool = { type: 'object', description: 'Additional metadata that the Static Analyzer and Backend does not touch.\nThis can be used to store useful information for the frontend and is required for communication\nbetween the static analyzer and the frontend.', + additionalProperties: true, }, value: { anyOf: [ @@ -1359,6 +1366,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/accounts/business-profile/delete-accounts-business-profile.ts b/packages/mcp-server/src/tools/accounts/business-profile/delete-accounts-business-profile.ts index 2984f13..9bf3099 100644 --- a/packages/mcp-server/src/tools/accounts/business-profile/delete-accounts-business-profile.ts +++ b/packages/mcp-server/src/tools/accounts/business-profile/delete-accounts-business-profile.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'delete_accounts_business_profile', - description: 'Delete the *profile*', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nDelete the *profile*\n\n# Response Schema\n```json\n{\n type: 'boolean'\n}\n```", inputSchema: { type: 'object', properties: { @@ -27,13 +28,25 @@ export const tool: Tool = { profile_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['account_id', 'profile_id'], + }, + annotations: { + idempotentHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { profile_id, ...body } = args as any; - return asTextContentResult(await client.accounts.businessProfile.delete(profile_id, body)); + const { profile_id, jq_filter, ...body } = args as any; + return asTextContentResult( + await maybeFilter(jq_filter, await client.accounts.businessProfile.delete(profile_id, body)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/contracts/toggle-dynamic-routing-business-profile-accounts-contracts.ts b/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/contracts/toggle-dynamic-routing-business-profile-accounts-contracts.ts index 7829510..521cef5 100644 --- a/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/contracts/toggle-dynamic-routing-business-profile-accounts-contracts.ts +++ b/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/contracts/toggle-dynamic-routing-business-profile-accounts-contracts.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'toggle_dynamic_routing_business_profile_accounts_contracts', - description: 'Create a Contract based dynamic routing algorithm', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nCreate a Contract based dynamic routing algorithm\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/routing_dictionary_record',\n $defs: {\n routing_dictionary_record: {\n type: 'object',\n properties: {\n id: {\n type: 'string'\n },\n created_at: {\n type: 'integer'\n },\n description: {\n type: 'string'\n },\n kind: {\n type: 'string',\n enum: [ 'single',\n 'priority',\n 'volume_split',\n 'advanced',\n 'dynamic',\n 'three_ds_decision_rule'\n ]\n },\n modified_at: {\n type: 'integer'\n },\n name: {\n type: 'string'\n },\n profile_id: {\n type: 'string'\n },\n algorithm_for: {\n $ref: '#/$defs/transaction_type'\n },\n decision_engine_routing_id: {\n type: 'string'\n }\n },\n required: [ 'id',\n 'created_at',\n 'description',\n 'kind',\n 'modified_at',\n 'name',\n 'profile_id'\n ]\n },\n transaction_type: {\n type: 'string',\n enum: [ 'payment',\n 'payout',\n 'three_ds_authentication'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -44,7 +45,6 @@ export const tool: Tool = { enum: ['day', 'month'], }, }, - required: [], }, label_info: { type: 'array', @@ -67,7 +67,14 @@ export const tool: Tool = { required: ['label', 'mca_id', 'target_count', 'target_time'], }, }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['account_id', 'profile_id', 'enable'], $defs: { dynamic_routing_features: { type: 'string', @@ -75,12 +82,16 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { profile_id, ...body } = args as any; + const { profile_id, jq_filter, ...body } = args as any; return asTextContentResult( - await client.accounts.businessProfile.dynamicRouting.contracts.toggle(profile_id, body), + await maybeFilter( + jq_filter, + await client.accounts.businessProfile.dynamicRouting.contracts.toggle(profile_id, body), + ), ); }; diff --git a/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/contracts/update-config-dynamic-routing-business-profile-accounts-contracts.ts b/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/contracts/update-config-dynamic-routing-business-profile-accounts-contracts.ts index 778341b..2e3c77d 100644 --- a/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/contracts/update-config-dynamic-routing-business-profile-accounts-contracts.ts +++ b/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/contracts/update-config-dynamic-routing-business-profile-accounts-contracts.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -18,7 +18,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_config_dynamic_routing_business_profile_accounts_contracts', - description: 'Update contract based dynamic routing algorithm', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nUpdate contract based dynamic routing algorithm\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/routing_dictionary_record',\n $defs: {\n routing_dictionary_record: {\n type: 'object',\n properties: {\n id: {\n type: 'string'\n },\n created_at: {\n type: 'integer'\n },\n description: {\n type: 'string'\n },\n kind: {\n type: 'string',\n enum: [ 'single',\n 'priority',\n 'volume_split',\n 'advanced',\n 'dynamic',\n 'three_ds_decision_rule'\n ]\n },\n modified_at: {\n type: 'integer'\n },\n name: {\n type: 'string'\n },\n profile_id: {\n type: 'string'\n },\n algorithm_for: {\n $ref: '#/$defs/transaction_type'\n },\n decision_engine_routing_id: {\n type: 'string'\n }\n },\n required: [ 'id',\n 'created_at',\n 'description',\n 'kind',\n 'modified_at',\n 'name',\n 'profile_id'\n ]\n },\n transaction_type: {\n type: 'string',\n enum: [ 'payment',\n 'payout',\n 'three_ds_authentication'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -45,7 +46,6 @@ export const tool: Tool = { enum: ['day', 'month'], }, }, - required: [], }, label_info: { type: 'array', @@ -68,14 +68,25 @@ export const tool: Tool = { required: ['label', 'mca_id', 'target_count', 'target_time'], }, }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['account_id', 'profile_id', 'algorithm_id'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { algorithm_id, ...body } = args as any; + const { algorithm_id, jq_filter, ...body } = args as any; return asTextContentResult( - await client.accounts.businessProfile.dynamicRouting.contracts.updateConfig(algorithm_id, body), + await maybeFilter( + jq_filter, + await client.accounts.businessProfile.dynamicRouting.contracts.updateConfig(algorithm_id, body), + ), ); }; diff --git a/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/elimination/toggle-dynamic-routing-business-profile-accounts-elimination.ts b/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/elimination/toggle-dynamic-routing-business-profile-accounts-elimination.ts index fa675ce..e2402c7 100644 --- a/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/elimination/toggle-dynamic-routing-business-profile-accounts-elimination.ts +++ b/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/elimination/toggle-dynamic-routing-business-profile-accounts-elimination.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'toggle_dynamic_routing_business_profile_accounts_elimination', - description: 'Create a elimination based dynamic routing algorithm', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nCreate a elimination based dynamic routing algorithm\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/routing_dictionary_record',\n $defs: {\n routing_dictionary_record: {\n type: 'object',\n properties: {\n id: {\n type: 'string'\n },\n created_at: {\n type: 'integer'\n },\n description: {\n type: 'string'\n },\n kind: {\n type: 'string',\n enum: [ 'single',\n 'priority',\n 'volume_split',\n 'advanced',\n 'dynamic',\n 'three_ds_decision_rule'\n ]\n },\n modified_at: {\n type: 'integer'\n },\n name: {\n type: 'string'\n },\n profile_id: {\n type: 'string'\n },\n algorithm_for: {\n $ref: '#/$defs/transaction_type'\n },\n decision_engine_routing_id: {\n type: 'string'\n }\n },\n required: [ 'id',\n 'created_at',\n 'description',\n 'kind',\n 'modified_at',\n 'name',\n 'profile_id'\n ]\n },\n transaction_type: {\n type: 'string',\n enum: [ 'payment',\n 'payout',\n 'three_ds_authentication'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -30,7 +31,14 @@ export const tool: Tool = { enable: { $ref: '#/$defs/dynamic_routing_features', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['account_id', 'profile_id', 'enable'], $defs: { dynamic_routing_features: { type: 'string', @@ -38,12 +46,16 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { profile_id, ...body } = args as any; + const { profile_id, jq_filter, ...body } = args as any; return asTextContentResult( - await client.accounts.businessProfile.dynamicRouting.elimination.toggle(profile_id, body), + await maybeFilter( + jq_filter, + await client.accounts.businessProfile.dynamicRouting.elimination.toggle(profile_id, body), + ), ); }; diff --git a/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/success-based/toggle-dynamic-routing-business-profile-accounts-success-based.ts b/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/success-based/toggle-dynamic-routing-business-profile-accounts-success-based.ts index d196453..ae0a798 100644 --- a/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/success-based/toggle-dynamic-routing-business-profile-accounts-success-based.ts +++ b/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/success-based/toggle-dynamic-routing-business-profile-accounts-success-based.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'toggle_dynamic_routing_business_profile_accounts_success_based', - description: 'Create a success based dynamic routing algorithm', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nCreate a success based dynamic routing algorithm\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/routing_dictionary_record',\n $defs: {\n routing_dictionary_record: {\n type: 'object',\n properties: {\n id: {\n type: 'string'\n },\n created_at: {\n type: 'integer'\n },\n description: {\n type: 'string'\n },\n kind: {\n type: 'string',\n enum: [ 'single',\n 'priority',\n 'volume_split',\n 'advanced',\n 'dynamic',\n 'three_ds_decision_rule'\n ]\n },\n modified_at: {\n type: 'integer'\n },\n name: {\n type: 'string'\n },\n profile_id: {\n type: 'string'\n },\n algorithm_for: {\n $ref: '#/$defs/transaction_type'\n },\n decision_engine_routing_id: {\n type: 'string'\n }\n },\n required: [ 'id',\n 'created_at',\n 'description',\n 'kind',\n 'modified_at',\n 'name',\n 'profile_id'\n ]\n },\n transaction_type: {\n type: 'string',\n enum: [ 'payment',\n 'payout',\n 'three_ds_authentication'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -30,7 +31,14 @@ export const tool: Tool = { enable: { $ref: '#/$defs/dynamic_routing_features', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['account_id', 'profile_id', 'enable'], $defs: { dynamic_routing_features: { type: 'string', @@ -38,12 +46,16 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { profile_id, ...body } = args as any; + const { profile_id, jq_filter, ...body } = args as any; return asTextContentResult( - await client.accounts.businessProfile.dynamicRouting.successBased.toggle(profile_id, body), + await maybeFilter( + jq_filter, + await client.accounts.businessProfile.dynamicRouting.successBased.toggle(profile_id, body), + ), ); }; diff --git a/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/success-based/update-config-dynamic-routing-business-profile-accounts-success-based.ts b/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/success-based/update-config-dynamic-routing-business-profile-accounts-success-based.ts index 3bb58a3..24dbc09 100644 --- a/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/success-based/update-config-dynamic-routing-business-profile-accounts-success-based.ts +++ b/packages/mcp-server/src/tools/accounts/business-profile/dynamic-routing/success-based/update-config-dynamic-routing-business-profile-accounts-success-based.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -18,7 +18,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_config_dynamic_routing_business_profile_accounts_success_based', - description: 'Update success based dynamic routing algorithm', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nUpdate success based dynamic routing algorithm\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/routing_dictionary_record',\n $defs: {\n routing_dictionary_record: {\n type: 'object',\n properties: {\n id: {\n type: 'string'\n },\n created_at: {\n type: 'integer'\n },\n description: {\n type: 'string'\n },\n kind: {\n type: 'string',\n enum: [ 'single',\n 'priority',\n 'volume_split',\n 'advanced',\n 'dynamic',\n 'three_ds_decision_rule'\n ]\n },\n modified_at: {\n type: 'integer'\n },\n name: {\n type: 'string'\n },\n profile_id: {\n type: 'string'\n },\n algorithm_for: {\n $ref: '#/$defs/transaction_type'\n },\n decision_engine_routing_id: {\n type: 'string'\n }\n },\n required: [ 'id',\n 'created_at',\n 'description',\n 'kind',\n 'modified_at',\n 'name',\n 'profile_id'\n ]\n },\n transaction_type: {\n type: 'string',\n enum: [ 'payment',\n 'payout',\n 'three_ds_authentication'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -88,11 +89,9 @@ export const tool: Tool = { type: 'number', }, }, - required: [], }, }, }, - required: [], }, config: { type: 'object', @@ -107,7 +106,6 @@ export const tool: Tool = { type: 'integer', }, }, - required: [], }, default_success_rate: { type: 'number', @@ -129,7 +127,6 @@ export const tool: Tool = { enum: ['merchant', 'global'], }, }, - required: [], }, params: { type: 'array', @@ -137,7 +134,14 @@ export const tool: Tool = { $ref: '#/$defs/dynamic_routing_config_params', }, }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['account_id', 'profile_id', 'algorithm_id', 'decision_engine_configs'], $defs: { decision_engine_gateway_wise_extra_score: { type: 'object', @@ -165,12 +169,16 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { algorithm_id, ...body } = args as any; + const { algorithm_id, jq_filter, ...body } = args as any; return asTextContentResult( - await client.accounts.businessProfile.dynamicRouting.successBased.updateConfig(algorithm_id, body), + await maybeFilter( + jq_filter, + await client.accounts.businessProfile.dynamicRouting.successBased.updateConfig(algorithm_id, body), + ), ); }; diff --git a/packages/mcp-server/src/tools/accounts/business-profile/list-accounts-business-profile.ts b/packages/mcp-server/src/tools/accounts/business-profile/list-accounts-business-profile.ts index 0f73acb..4a6a5f1 100644 --- a/packages/mcp-server/src/tools/accounts/business-profile/list-accounts-business-profile.ts +++ b/packages/mcp-server/src/tools/accounts/business-profile/list-accounts-business-profile.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -25,6 +24,10 @@ export const tool: Tool = { type: 'string', }, }, + required: ['account_id'], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/accounts/business-profile/retrieve-accounts-business-profile.ts b/packages/mcp-server/src/tools/accounts/business-profile/retrieve-accounts-business-profile.ts index 5959baa..3d53199 100644 --- a/packages/mcp-server/src/tools/accounts/business-profile/retrieve-accounts-business-profile.ts +++ b/packages/mcp-server/src/tools/accounts/business-profile/retrieve-accounts-business-profile.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -28,6 +27,10 @@ export const tool: Tool = { type: 'string', }, }, + required: ['account_id', 'profile_id'], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/accounts/business-profile/update-accounts-business-profile.ts b/packages/mcp-server/src/tools/accounts/business-profile/update-accounts-business-profile.ts index 90f4dc6..5e75862 100644 --- a/packages/mcp-server/src/tools/accounts/business-profile/update-accounts-business-profile.ts +++ b/packages/mcp-server/src/tools/accounts/business-profile/update-accounts-business-profile.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -54,6 +53,7 @@ export const tool: Tool = { authentication_product_ids: { type: 'object', description: 'Product authentication ids', + additionalProperties: true, }, card_testing_guard_config: { $ref: '#/$defs/card_testing_guard_config', @@ -79,6 +79,7 @@ export const tool: Tool = { frm_routing_algorithm: { type: 'object', description: "The frm routing algorithm to be used for routing payments to desired FRM's", + additionalProperties: true, }, intent_fulfillment_time: { type: 'integer', @@ -136,11 +137,13 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, outgoing_webhook_custom_http_headers: { type: 'object', description: 'These key-value pairs are sent as additional custom headers in the outgoing webhook request. It is recommended not to use more than four key-value pairs.', + additionalProperties: true, }, payment_link_config: { $ref: '#/$defs/business_payment_link_config', @@ -171,6 +174,7 @@ export const tool: Tool = { routing_algorithm: { type: 'object', description: 'The routing algorithm to be used for routing payments to desired connectors', + additionalProperties: true, }, session_expiry: { type: 'integer', @@ -189,6 +193,7 @@ export const tool: Tool = { $ref: '#/$defs/webhook_details', }, }, + required: ['account_id', 'profile_id'], $defs: { authentication_connector_details: { type: 'object', @@ -656,6 +661,7 @@ export const tool: Tool = { payment_link_ui_rules: { type: 'object', description: 'Payment link configuration rules', + additionalProperties: true, }, sdk_layout: { type: 'string', @@ -664,6 +670,7 @@ export const tool: Tool = { sdk_ui_rules: { type: 'object', description: 'SDK configuration rules', + additionalProperties: true, }, seller_name: { type: 'string', @@ -715,14 +722,12 @@ export const tool: Tool = { description: 'Position of the key-value pair in the UI', }, }, - required: [], }, }, required: ['key', 'value'], }, }, }, - required: [], }, business_payout_link_config: { allOf: [ @@ -757,7 +762,6 @@ export const tool: Tool = { description: 'Primary color to be used in the form represented in hex format', }, }, - required: [], }, static_routing_algorithm: { anyOf: [ @@ -819,6 +823,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -869,6 +874,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -1095,6 +1101,7 @@ export const tool: Tool = { type: 'object', description: 'Additional metadata that the Static Analyzer and Backend does not touch.\nThis can be used to store useful information for the frontend and is required for communication\nbetween the static analyzer and the frontend.', + additionalProperties: true, }, value: { anyOf: [ @@ -1362,6 +1369,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/accounts/connectors/create-accounts-connectors.ts b/packages/mcp-server/src/tools/accounts/connectors/create-accounts-connectors.ts index 03f7415..4bb88b4 100644 --- a/packages/mcp-server/src/tools/accounts/connectors/create-accounts-connectors.ts +++ b/packages/mcp-server/src/tools/accounts/connectors/create-accounts-connectors.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -80,6 +79,7 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, payment_methods_enabled: { type: 'array', @@ -91,6 +91,7 @@ export const tool: Tool = { }, pm_auth_config: { type: 'object', + additionalProperties: true, }, profile_id: { type: 'string', @@ -106,6 +107,7 @@ export const tool: Tool = { 'A boolean value to indicate if the connector is in Test mode. By default, its value is false.', }, }, + required: ['account_id', 'connector_name', 'connector_type'], $defs: { connector: { type: 'string', @@ -742,13 +744,14 @@ export const tool: Tool = { type: 'object', description: 'Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.', + additionalProperties: true, }, metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, }, - required: [], }, connector_wallet_details: { type: 'object', @@ -757,26 +760,30 @@ export const tool: Tool = { type: 'object', description: 'This field is for our legacy Apple Pay flow that contains the Apple Pay certificates and credentials for only iOS Apple Pay flow', + additionalProperties: true, }, apple_pay_combined: { type: 'object', description: 'This field contains the Apple Pay certificates and credentials for iOS and Web Apple Pay flow', + additionalProperties: true, }, google_pay: { type: 'object', description: 'This field contains the Google Pay certificates and credentials', + additionalProperties: true, }, paze: { type: 'object', description: 'This field contains the Paze certificates and credentials', + additionalProperties: true, }, samsung_pay: { type: 'object', description: 'This field contains the Samsung Pay certificates and credentials', + additionalProperties: true, }, }, - required: [], }, merchant_connector_webhook_details: { type: 'object', @@ -1345,6 +1352,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/accounts/connectors/delete-accounts-connectors.ts b/packages/mcp-server/src/tools/accounts/connectors/delete-accounts-connectors.ts index 266a843..44e8ffc 100644 --- a/packages/mcp-server/src/tools/accounts/connectors/delete-accounts-connectors.ts +++ b/packages/mcp-server/src/tools/accounts/connectors/delete-accounts-connectors.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'delete_accounts_connectors', - description: 'Delete or Detach a Merchant Connector from Merchant Account', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nDelete or Detach a Merchant Connector from Merchant Account\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n deleted: {\n type: 'boolean',\n description: 'If the connector is deleted or not'\n },\n merchant_connector_id: {\n type: 'string',\n description: 'Unique ID of the connector'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account'\n }\n },\n required: [ 'deleted',\n 'merchant_connector_id',\n 'merchant_id'\n ]\n}\n```", inputSchema: { type: 'object', properties: { @@ -27,13 +28,25 @@ export const tool: Tool = { merchant_connector_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['account_id', 'merchant_connector_id'], + }, + annotations: { + idempotentHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { merchant_connector_id, ...body } = args as any; - return asTextContentResult(await client.accounts.connectors.delete(merchant_connector_id, body)); + const { merchant_connector_id, jq_filter, ...body } = args as any; + return asTextContentResult( + await maybeFilter(jq_filter, await client.accounts.connectors.delete(merchant_connector_id, body)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/accounts/connectors/list-accounts-connectors.ts b/packages/mcp-server/src/tools/accounts/connectors/list-accounts-connectors.ts index 6d32fb7..97ab42d 100644 --- a/packages/mcp-server/src/tools/accounts/connectors/list-accounts-connectors.ts +++ b/packages/mcp-server/src/tools/accounts/connectors/list-accounts-connectors.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -25,6 +24,10 @@ export const tool: Tool = { type: 'string', }, }, + required: ['account_id'], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/accounts/connectors/retrieve-accounts-connectors.ts b/packages/mcp-server/src/tools/accounts/connectors/retrieve-accounts-connectors.ts index 31bfc99..d6bd9d0 100644 --- a/packages/mcp-server/src/tools/accounts/connectors/retrieve-accounts-connectors.ts +++ b/packages/mcp-server/src/tools/accounts/connectors/retrieve-accounts-connectors.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -28,6 +27,10 @@ export const tool: Tool = { type: 'string', }, }, + required: ['account_id', 'merchant_connector_id'], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/accounts/connectors/update-accounts-connectors.ts b/packages/mcp-server/src/tools/accounts/connectors/update-accounts-connectors.ts index 5130de8..8dc70f5 100644 --- a/packages/mcp-server/src/tools/accounts/connectors/update-accounts-connectors.ts +++ b/packages/mcp-server/src/tools/accounts/connectors/update-accounts-connectors.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -66,6 +65,7 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, payment_methods_enabled: { type: 'array', @@ -79,6 +79,7 @@ export const tool: Tool = { type: 'object', description: 'pm_auth_config will relate MCA records to their respective chosen auth services, based on payment_method and pmt', + additionalProperties: true, }, test_mode: { type: 'boolean', @@ -86,6 +87,7 @@ export const tool: Tool = { 'A boolean value to indicate if the connector is in Test mode. By default, its value is false.', }, }, + required: ['account_id', 'merchant_connector_id', 'connector_type', 'status'], $defs: { connector_type: { type: 'string', @@ -360,13 +362,14 @@ export const tool: Tool = { type: 'object', description: 'Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.', + additionalProperties: true, }, metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, }, - required: [], }, connector_wallet_details: { type: 'object', @@ -375,26 +378,30 @@ export const tool: Tool = { type: 'object', description: 'This field is for our legacy Apple Pay flow that contains the Apple Pay certificates and credentials for only iOS Apple Pay flow', + additionalProperties: true, }, apple_pay_combined: { type: 'object', description: 'This field contains the Apple Pay certificates and credentials for iOS and Web Apple Pay flow', + additionalProperties: true, }, google_pay: { type: 'object', description: 'This field contains the Google Pay certificates and credentials', + additionalProperties: true, }, paze: { type: 'object', description: 'This field contains the Paze certificates and credentials', + additionalProperties: true, }, samsung_pay: { type: 'object', description: 'This field contains the Samsung Pay certificates and credentials', + additionalProperties: true, }, }, - required: [], }, merchant_connector_webhook_details: { type: 'object', @@ -1213,6 +1220,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/accounts/create-accounts.ts b/packages/mcp-server/src/tools/accounts/create-accounts.ts index 28ace54..864ff6b 100644 --- a/packages/mcp-server/src/tools/accounts/create-accounts.ts +++ b/packages/mcp-server/src/tools/accounts/create-accounts.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -33,6 +32,7 @@ export const tool: Tool = { frm_routing_algorithm: { type: 'object', description: "The frm routing algorithm to be used for routing payments to desired FRM's", + additionalProperties: true, }, locker_id: { type: 'string', @@ -52,6 +52,7 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object', + additionalProperties: true, }, organization_id: { type: 'string', @@ -102,6 +103,7 @@ export const tool: Tool = { $ref: '#/$defs/webhook_details', }, }, + required: ['merchant_id'], $defs: { merchant_details: { type: 'object', @@ -142,7 +144,6 @@ export const tool: Tool = { description: 'The business website of the merchant', }, }, - required: [], }, address_details: { type: 'object', @@ -185,7 +186,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, country_alpha2: { type: 'string', @@ -501,6 +501,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -551,6 +552,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -777,6 +779,7 @@ export const tool: Tool = { type: 'object', description: 'Additional metadata that the Static Analyzer and Backend does not touch.\nThis can be used to store useful information for the frontend and is required for communication\nbetween the static analyzer and the frontend.', + additionalProperties: true, }, value: { anyOf: [ @@ -981,7 +984,6 @@ export const tool: Tool = { description: 'Primary color to be used in the form represented in hex format', }, }, - required: [], }, primary_business_details: { type: 'object', @@ -1095,6 +1097,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/accounts/delete-accounts.ts b/packages/mcp-server/src/tools/accounts/delete-accounts.ts index 76aa969..8397ff0 100644 --- a/packages/mcp-server/src/tools/accounts/delete-accounts.ts +++ b/packages/mcp-server/src/tools/accounts/delete-accounts.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,31 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'delete_accounts', - description: 'Delete a *merchant* account', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nDelete a *merchant* account\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n deleted: {\n type: 'boolean',\n description: 'If the connector is deleted or not'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account'\n }\n },\n required: [ 'deleted',\n 'merchant_id'\n ]\n}\n```", inputSchema: { type: 'object', properties: { account_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['account_id'], + }, + annotations: { + idempotentHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { account_id, ...body } = args as any; - return asTextContentResult(await client.accounts.delete(account_id)); + const { account_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.accounts.delete(account_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/accounts/kv-accounts.ts b/packages/mcp-server/src/tools/accounts/kv-accounts.ts index 290a5db..672189e 100644 --- a/packages/mcp-server/src/tools/accounts/kv-accounts.ts +++ b/packages/mcp-server/src/tools/accounts/kv-accounts.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'kv_accounts', - description: 'Toggle KV mode for the Merchant Account', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nToggle KV mode for the Merchant Account\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n kv_enabled: {\n type: 'boolean',\n description: 'Status of KV for the specific merchant'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account'\n }\n },\n required: [ 'kv_enabled',\n 'merchant_id'\n ]\n}\n```", inputSchema: { type: 'object', properties: { @@ -28,13 +29,21 @@ export const tool: Tool = { type: 'boolean', description: 'Status of KV for the specific merchant', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['account_id', 'kv_enabled'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { account_id, ...body } = args as any; - return asTextContentResult(await client.accounts.kv(account_id, body)); + const { account_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.accounts.kv(account_id, body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/accounts/list-payment-methods-accounts.ts b/packages/mcp-server/src/tools/accounts/list-payment-methods-accounts.ts index 65d3720..e3e7060 100644 --- a/packages/mcp-server/src/tools/accounts/list-payment-methods-accounts.ts +++ b/packages/mcp-server/src/tools/accounts/list-payment-methods-accounts.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -65,6 +64,7 @@ export const tool: Tool = { description: 'Indicates whether the payment method is eligible for recurring payments', }, }, + required: [], $defs: { country_alpha2: { type: 'string', @@ -510,6 +510,9 @@ export const tool: Tool = { }, }, }, + annotations: { + readOnlyHint: true, + }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/accounts/retrieve-accounts.ts b/packages/mcp-server/src/tools/accounts/retrieve-accounts.ts index 1402366..5f847d3 100644 --- a/packages/mcp-server/src/tools/accounts/retrieve-accounts.ts +++ b/packages/mcp-server/src/tools/accounts/retrieve-accounts.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -25,6 +24,10 @@ export const tool: Tool = { type: 'string', }, }, + required: ['account_id'], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/accounts/update-accounts.ts b/packages/mcp-server/src/tools/accounts/update-accounts.ts index 9538db5..2080659 100644 --- a/packages/mcp-server/src/tools/accounts/update-accounts.ts +++ b/packages/mcp-server/src/tools/accounts/update-accounts.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -40,6 +39,7 @@ export const tool: Tool = { frm_routing_algorithm: { type: 'object', description: "The frm routing algorithm to be used for routing payments to desired FRM's", + additionalProperties: true, }, locker_id: { type: 'string', @@ -55,6 +55,7 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, parent_merchant_id: { type: 'string', @@ -99,6 +100,7 @@ export const tool: Tool = { $ref: '#/$defs/webhook_details', }, }, + required: ['account_id', 'merchant_id'], $defs: { merchant_details: { type: 'object', @@ -139,7 +141,6 @@ export const tool: Tool = { description: 'The business website of the merchant', }, }, - required: [], }, address_details: { type: 'object', @@ -182,7 +183,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, country_alpha2: { type: 'string', @@ -498,6 +498,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -548,6 +549,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -774,6 +776,7 @@ export const tool: Tool = { type: 'object', description: 'Additional metadata that the Static Analyzer and Backend does not touch.\nThis can be used to store useful information for the frontend and is required for communication\nbetween the static analyzer and the frontend.', + additionalProperties: true, }, value: { anyOf: [ @@ -978,7 +981,6 @@ export const tool: Tool = { description: 'Primary color to be used in the form represented in hex format', }, }, - required: [], }, primary_business_details: { type: 'object', @@ -1088,6 +1090,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/api-keys/create-api-keys.ts b/packages/mcp-server/src/tools/api-keys/create-api-keys.ts index 722d161..fc6a767 100644 --- a/packages/mcp-server/src/tools/api-keys/create-api-keys.ts +++ b/packages/mcp-server/src/tools/api-keys/create-api-keys.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_api_keys', description: - 'Create a new API Key for accessing our APIs from your servers. The plaintext API Key will be\ndisplayed only once on creation, so ensure you store it securely.', + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nCreate a new API Key for accessing our APIs from your servers. The plaintext API Key will be\ndisplayed only once on creation, so ensure you store it securely.\n\n# Response Schema\n```json\n{\n type: 'object',\n description: 'The response body for creating an API Key.',\n properties: {\n api_key: {\n type: 'string',\n description: 'The plaintext API Key used for server-side API access. Ensure you store the API Key\\nsecurely as you will not be able to see it again.'\n },\n created: {\n type: 'string',\n description: 'The time at which the API Key was created.',\n format: 'date-time'\n },\n expiration: {\n $ref: '#/$defs/api_key_expiration'\n },\n key_id: {\n type: 'string',\n description: 'The identifier for the API Key.'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account.'\n },\n name: {\n type: 'string',\n description: 'The unique name for the API Key to help you identify it.'\n },\n description: {\n type: 'string',\n description: 'The description to provide more context about the API Key.'\n }\n },\n required: [ 'api_key',\n 'created',\n 'expiration',\n 'key_id',\n 'merchant_id',\n 'name'\n ],\n $defs: {\n api_key_expiration: {\n anyOf: [ {\n type: 'string',\n enum: [ 'never'\n ]\n },\n {\n type: 'string',\n format: 'date-time'\n }\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -36,7 +36,14 @@ export const tool: Tool = { type: 'string', description: 'A description to provide more context about the API Key.', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['merchant_id', 'expiration', 'name'], $defs: { api_key_expiration: { anyOf: [ @@ -52,11 +59,12 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { merchant_id, ...body } = args as any; - return asTextContentResult(await client.apiKeys.create(merchant_id, body)); + const { merchant_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.apiKeys.create(merchant_id, body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/api-keys/list-api-keys.ts b/packages/mcp-server/src/tools/api-keys/list-api-keys.ts index 7cbe8b4..a5714c3 100644 --- a/packages/mcp-server/src/tools/api-keys/list-api-keys.ts +++ b/packages/mcp-server/src/tools/api-keys/list-api-keys.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_api_keys', - description: 'List all the API Keys associated to a merchant account.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nList all the API Keys associated to a merchant account.\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/retrieve_api_key'\n },\n $defs: {\n retrieve_api_key: {\n type: 'object',\n description: 'The response body for retrieving an API Key.',\n properties: {\n created: {\n type: 'string',\n description: 'The time at which the API Key was created.',\n format: 'date-time'\n },\n expiration: {\n $ref: '#/$defs/api_key_expiration'\n },\n key_id: {\n type: 'string',\n description: 'The identifier for the API Key.'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account.'\n },\n name: {\n type: 'string',\n description: 'The unique name for the API Key to help you identify it.'\n },\n prefix: {\n type: 'string',\n description: 'The first few characters of the plaintext API Key to help you identify it.'\n },\n description: {\n type: 'string',\n description: 'The description to provide more context about the API Key.'\n }\n },\n required: [ 'created',\n 'expiration',\n 'key_id',\n 'merchant_id',\n 'name',\n 'prefix'\n ]\n },\n api_key_expiration: {\n anyOf: [ {\n type: 'string',\n enum: [ 'never'\n ]\n },\n {\n type: 'string',\n format: 'date-time'\n }\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -32,13 +33,23 @@ export const tool: Tool = { type: 'integer', description: 'The number of API Keys to skip when retrieving the list of API keys.', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['merchant_id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { merchant_id, ...body } = args as any; - return asTextContentResult(await client.apiKeys.list(merchant_id, body)); + const { merchant_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.apiKeys.list(merchant_id, body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/api-keys/retrieve-api-keys.ts b/packages/mcp-server/src/tools/api-keys/retrieve-api-keys.ts index ab52916..6a3d858 100644 --- a/packages/mcp-server/src/tools/api-keys/retrieve-api-keys.ts +++ b/packages/mcp-server/src/tools/api-keys/retrieve-api-keys.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_api_keys', - description: 'Retrieve information about the specified API Key.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieve information about the specified API Key.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/retrieve_api_key',\n $defs: {\n retrieve_api_key: {\n type: 'object',\n description: 'The response body for retrieving an API Key.',\n properties: {\n created: {\n type: 'string',\n description: 'The time at which the API Key was created.',\n format: 'date-time'\n },\n expiration: {\n $ref: '#/$defs/api_key_expiration'\n },\n key_id: {\n type: 'string',\n description: 'The identifier for the API Key.'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account.'\n },\n name: {\n type: 'string',\n description: 'The unique name for the API Key to help you identify it.'\n },\n prefix: {\n type: 'string',\n description: 'The first few characters of the plaintext API Key to help you identify it.'\n },\n description: {\n type: 'string',\n description: 'The description to provide more context about the API Key.'\n }\n },\n required: [ 'created',\n 'expiration',\n 'key_id',\n 'merchant_id',\n 'name',\n 'prefix'\n ]\n },\n api_key_expiration: {\n anyOf: [ {\n type: 'string',\n enum: [ 'never'\n ]\n },\n {\n type: 'string',\n format: 'date-time'\n }\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -27,13 +28,23 @@ export const tool: Tool = { key_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['merchant_id', 'key_id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { key_id, ...body } = args as any; - return asTextContentResult(await client.apiKeys.retrieve(key_id, body)); + const { key_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.apiKeys.retrieve(key_id, body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/api-keys/revoke-api-keys.ts b/packages/mcp-server/src/tools/api-keys/revoke-api-keys.ts index 8cc5291..db60f9f 100644 --- a/packages/mcp-server/src/tools/api-keys/revoke-api-keys.ts +++ b/packages/mcp-server/src/tools/api-keys/revoke-api-keys.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'revoke_api_keys', description: - 'Revoke the specified API Key. Once revoked, the API Key can no longer be used for\nauthenticating with our APIs.', + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRevoke the specified API Key. Once revoked, the API Key can no longer be used for\nauthenticating with our APIs.\n\n# Response Schema\n```json\n{\n type: 'object',\n description: 'The response body for revoking an API Key.',\n properties: {\n key_id: {\n type: 'string',\n description: 'The identifier for the API Key.'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account.'\n },\n revoked: {\n type: 'boolean',\n description: 'Indicates whether the API key was revoked or not.'\n }\n },\n required: [ 'key_id',\n 'merchant_id',\n 'revoked'\n ]\n}\n```", inputSchema: { type: 'object', properties: { @@ -28,13 +28,23 @@ export const tool: Tool = { key_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['merchant_id', 'key_id'], + }, + annotations: { + idempotentHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { key_id, ...body } = args as any; - return asTextContentResult(await client.apiKeys.revoke(key_id, body)); + const { key_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.apiKeys.revoke(key_id, body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/api-keys/update-api-keys.ts b/packages/mcp-server/src/tools/api-keys/update-api-keys.ts index 766c9dc..7b02869 100644 --- a/packages/mcp-server/src/tools/api-keys/update-api-keys.ts +++ b/packages/mcp-server/src/tools/api-keys/update-api-keys.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_api_keys', - description: 'Update information for the specified API Key.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nUpdate information for the specified API Key.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/retrieve_api_key',\n $defs: {\n retrieve_api_key: {\n type: 'object',\n description: 'The response body for retrieving an API Key.',\n properties: {\n created: {\n type: 'string',\n description: 'The time at which the API Key was created.',\n format: 'date-time'\n },\n expiration: {\n $ref: '#/$defs/api_key_expiration'\n },\n key_id: {\n type: 'string',\n description: 'The identifier for the API Key.'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account.'\n },\n name: {\n type: 'string',\n description: 'The unique name for the API Key to help you identify it.'\n },\n prefix: {\n type: 'string',\n description: 'The first few characters of the plaintext API Key to help you identify it.'\n },\n description: {\n type: 'string',\n description: 'The description to provide more context about the API Key.'\n }\n },\n required: [ 'created',\n 'expiration',\n 'key_id',\n 'merchant_id',\n 'name',\n 'prefix'\n ]\n },\n api_key_expiration: {\n anyOf: [ {\n type: 'string',\n enum: [ 'never'\n ]\n },\n {\n type: 'string',\n format: 'date-time'\n }\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -38,7 +39,14 @@ export const tool: Tool = { type: 'string', description: 'A unique name for the API Key to help you identify it.', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['merchant_id', 'key_id'], $defs: { api_key_expiration: { anyOf: [ @@ -54,11 +62,12 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { key_id, ...body } = args as any; - return asTextContentResult(await client.apiKeys.update(key_id, body)); + const { key_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.apiKeys.update(key_id, body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/authentication/create-authentication.ts b/packages/mcp-server/src/tools/authentication/create-authentication.ts index 7ed18a1..f92e33a 100644 --- a/packages/mcp-server/src/tools/authentication/create-authentication.ts +++ b/packages/mcp-server/src/tools/authentication/create-authentication.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -57,6 +56,7 @@ export const tool: Tool = { description: 'The URL to which the user should be redirected after authentication.', }, }, + required: ['amount', 'currency'], $defs: { currency: { type: 'string', @@ -241,7 +241,6 @@ export const tool: Tool = { description: 'The merchant id of the card.', }, }, - required: [], }, authentication_connectors: { type: 'string', @@ -290,6 +289,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/blocklist/create-blocklist.ts b/packages/mcp-server/src/tools/blocklist/create-blocklist.ts index a4a9132..3650ba1 100644 --- a/packages/mcp-server/src/tools/blocklist/create-blocklist.ts +++ b/packages/mcp-server/src/tools/blocklist/create-blocklist.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_blocklist', - description: '', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/blocklist_response',\n $defs: {\n blocklist_response: {\n type: 'object',\n properties: {\n created_at: {\n type: 'string',\n format: 'date-time'\n },\n data_kind: {\n $ref: '#/$defs/blocklist_data_kind'\n },\n fingerprint_id: {\n type: 'string'\n }\n },\n required: [ 'created_at',\n 'data_kind',\n 'fingerprint_id'\n ]\n },\n blocklist_data_kind: {\n type: 'string',\n enum: [ 'payment_method',\n 'card_bin',\n 'extended_card_bin'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', anyOf: [ @@ -32,6 +33,7 @@ export const tool: Tool = { enum: ['card_bin'], }, }, + required: ['data', 'type'], }, { type: 'object', @@ -44,6 +46,7 @@ export const tool: Tool = { enum: ['fingerprint'], }, }, + required: ['data', 'type'], }, { type: 'object', @@ -56,14 +59,24 @@ export const tool: Tool = { enum: ['extended_card_bin'], }, }, + required: ['data', 'type'], }, ], + properties: { + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, + }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.blocklist.create(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.blocklist.create(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/blocklist/delete-blocklist.ts b/packages/mcp-server/src/tools/blocklist/delete-blocklist.ts index 72cf4ae..cb5ead6 100644 --- a/packages/mcp-server/src/tools/blocklist/delete-blocklist.ts +++ b/packages/mcp-server/src/tools/blocklist/delete-blocklist.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'delete_blocklist', - description: '', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/blocklist_response',\n $defs: {\n blocklist_response: {\n type: 'object',\n properties: {\n created_at: {\n type: 'string',\n format: 'date-time'\n },\n data_kind: {\n $ref: '#/$defs/blocklist_data_kind'\n },\n fingerprint_id: {\n type: 'string'\n }\n },\n required: [ 'created_at',\n 'data_kind',\n 'fingerprint_id'\n ]\n },\n blocklist_data_kind: {\n type: 'string',\n enum: [ 'payment_method',\n 'card_bin',\n 'extended_card_bin'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', anyOf: [ @@ -32,6 +33,7 @@ export const tool: Tool = { enum: ['card_bin'], }, }, + required: ['data', 'type'], }, { type: 'object', @@ -44,6 +46,7 @@ export const tool: Tool = { enum: ['fingerprint'], }, }, + required: ['data', 'type'], }, { type: 'object', @@ -56,14 +59,26 @@ export const tool: Tool = { enum: ['extended_card_bin'], }, }, + required: ['data', 'type'], }, ], + properties: { + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, + }, + }, + annotations: { + idempotentHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.blocklist.delete(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.blocklist.delete(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/blocklist/retrieve-blocklist.ts b/packages/mcp-server/src/tools/blocklist/retrieve-blocklist.ts index ad638e0..a5272bc 100644 --- a/packages/mcp-server/src/tools/blocklist/retrieve-blocklist.ts +++ b/packages/mcp-server/src/tools/blocklist/retrieve-blocklist.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,14 +17,22 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_blocklist', - description: '', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/blocklist_response',\n $defs: {\n blocklist_response: {\n type: 'object',\n properties: {\n created_at: {\n type: 'string',\n format: 'date-time'\n },\n data_kind: {\n $ref: '#/$defs/blocklist_data_kind'\n },\n fingerprint_id: {\n type: 'string'\n }\n },\n required: [ 'created_at',\n 'data_kind',\n 'fingerprint_id'\n ]\n },\n blocklist_data_kind: {\n type: 'string',\n enum: [ 'payment_method',\n 'card_bin',\n 'extended_card_bin'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { data_kind: { $ref: '#/$defs/blocklist_data_kind', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['data_kind'], $defs: { blocklist_data_kind: { type: 'string', @@ -32,11 +40,14 @@ export const tool: Tool = { }, }, }, + annotations: { + readOnlyHint: true, + }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.blocklist.retrieve(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.blocklist.retrieve(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/blocklist/toggle-blocklist.ts b/packages/mcp-server/src/tools/blocklist/toggle-blocklist.ts index 009196c..349ff4d 100644 --- a/packages/mcp-server/src/tools/blocklist/toggle-blocklist.ts +++ b/packages/mcp-server/src/tools/blocklist/toggle-blocklist.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'toggle_blocklist', - description: '', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\n\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n blocklist_guard_status: {\n type: 'string'\n }\n },\n required: [ 'blocklist_guard_status'\n ]\n}\n```", inputSchema: { type: 'object', properties: { @@ -25,13 +26,21 @@ export const tool: Tool = { type: 'boolean', description: 'Boolean value to enable/disable blocklist', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['status'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.blocklist.toggle(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.blocklist.toggle(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/customers/create-customers.ts b/packages/mcp-server/src/tools/customers/create-customers.ts index 12f7bfb..f52b459 100644 --- a/packages/mcp-server/src/tools/customers/create-customers.ts +++ b/packages/mcp-server/src/tools/customers/create-customers.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -42,6 +41,7 @@ export const tool: Tool = { type: 'object', description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500\ncharacters long. Metadata is useful for storing additional, structured information on an\nobject.', + additionalProperties: true, }, name: { type: 'string', @@ -56,6 +56,7 @@ export const tool: Tool = { description: 'The country code for the customer phone number', }, }, + required: [], $defs: { address_details: { type: 'object', @@ -98,7 +99,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, country_alpha2: { type: 'string', @@ -356,6 +356,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/customers/delete-customers.ts b/packages/mcp-server/src/tools/customers/delete-customers.ts index 51e5f15..1ae8156 100644 --- a/packages/mcp-server/src/tools/customers/delete-customers.ts +++ b/packages/mcp-server/src/tools/customers/delete-customers.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,31 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'delete_customers', - description: 'Delete a customer record.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nDelete a customer record.\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n address_deleted: {\n type: 'boolean',\n description: 'Whether address was deleted or not'\n },\n customer_deleted: {\n type: 'boolean',\n description: 'Whether customer was deleted or not'\n },\n customer_id: {\n type: 'string',\n description: 'The identifier for the customer object'\n },\n payment_methods_deleted: {\n type: 'boolean',\n description: 'Whether payment methods deleted or not'\n }\n },\n required: [ 'address_deleted',\n 'customer_deleted',\n 'customer_id',\n 'payment_methods_deleted'\n ]\n}\n```", inputSchema: { type: 'object', properties: { customer_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['customer_id'], + }, + annotations: { + idempotentHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { customer_id, ...body } = args as any; - return asTextContentResult(await client.customers.delete(customer_id)); + const { customer_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.customers.delete(customer_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/customers/list-customers.ts b/packages/mcp-server/src/tools/customers/list-customers.ts index f115f17..51eba2b 100644 --- a/packages/mcp-server/src/tools/customers/list-customers.ts +++ b/packages/mcp-server/src/tools/customers/list-customers.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_customers', - description: 'Lists all the customers for a particular merchant id.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nLists all the customers for a particular merchant id.\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/customer'\n },\n $defs: {\n customer: {\n type: 'object',\n properties: {\n created_at: {\n type: 'string',\n description: 'A timestamp (ISO 8601 code) that determines when the customer was created',\n format: 'date-time'\n },\n customer_id: {\n type: 'string',\n description: 'The identifier for the customer object'\n },\n address: {\n $ref: '#/$defs/address_details'\n },\n default_payment_method_id: {\n type: 'string',\n description: 'The identifier for the default payment method.'\n },\n description: {\n type: 'string',\n description: 'An arbitrary string that you can attach to a customer object.'\n },\n email: {\n type: 'string',\n description: 'The customer\\'s email address'\n },\n metadata: {\n type: 'object',\n description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500\\ncharacters long. Metadata is useful for storing additional, structured information on an\\nobject.',\n additionalProperties: true\n },\n name: {\n type: 'string',\n description: 'The customer\\'s name'\n },\n phone: {\n type: 'string',\n description: 'The customer\\'s phone number'\n },\n phone_country_code: {\n type: 'string',\n description: 'The country code for the customer phone number'\n }\n },\n required: [ 'created_at',\n 'customer_id'\n ]\n },\n address_details: {\n type: 'object',\n description: 'Address details',\n properties: {\n city: {\n type: 'string',\n description: 'The city, district, suburb, town, or village of the address.'\n },\n country: {\n $ref: '#/$defs/country_alpha2'\n },\n first_name: {\n type: 'string',\n description: 'The first name for the address'\n },\n last_name: {\n type: 'string',\n description: 'The last name for the address'\n },\n line1: {\n type: 'string',\n description: 'The first line of the street address or P.O. Box.'\n },\n line2: {\n type: 'string',\n description: 'The second line of the street address or P.O. Box (e.g., apartment, suite, unit, or building).'\n },\n line3: {\n type: 'string',\n description: 'The third line of the street address, if applicable.'\n },\n state: {\n type: 'string',\n description: 'The address state'\n },\n zip: {\n type: 'string',\n description: 'The zip/postal code for the address'\n }\n }\n },\n country_alpha2: {\n type: 'string',\n enum: [ 'AF',\n 'AX',\n 'AL',\n 'DZ',\n 'AS',\n 'AD',\n 'AO',\n 'AI',\n 'AQ',\n 'AG',\n 'AR',\n 'AM',\n 'AW',\n 'AU',\n 'AT',\n 'AZ',\n 'BS',\n 'BH',\n 'BD',\n 'BB',\n 'BY',\n 'BE',\n 'BZ',\n 'BJ',\n 'BM',\n 'BT',\n 'BO',\n 'BQ',\n 'BA',\n 'BW',\n 'BV',\n 'BR',\n 'IO',\n 'BN',\n 'BG',\n 'BF',\n 'BI',\n 'KH',\n 'CM',\n 'CA',\n 'CV',\n 'KY',\n 'CF',\n 'TD',\n 'CL',\n 'CN',\n 'CX',\n 'CC',\n 'CO',\n 'KM',\n 'CG',\n 'CD',\n 'CK',\n 'CR',\n 'CI',\n 'HR',\n 'CU',\n 'CW',\n 'CY',\n 'CZ',\n 'DK',\n 'DJ',\n 'DM',\n 'DO',\n 'EC',\n 'EG',\n 'SV',\n 'GQ',\n 'ER',\n 'EE',\n 'ET',\n 'FK',\n 'FO',\n 'FJ',\n 'FI',\n 'FR',\n 'GF',\n 'PF',\n 'TF',\n 'GA',\n 'GM',\n 'GE',\n 'DE',\n 'GH',\n 'GI',\n 'GR',\n 'GL',\n 'GD',\n 'GP',\n 'GU',\n 'GT',\n 'GG',\n 'GN',\n 'GW',\n 'GY',\n 'HT',\n 'HM',\n 'VA',\n 'HN',\n 'HK',\n 'HU',\n 'IS',\n 'IN',\n 'ID',\n 'IR',\n 'IQ',\n 'IE',\n 'IM',\n 'IL',\n 'IT',\n 'JM',\n 'JP',\n 'JE',\n 'JO',\n 'KZ',\n 'KE',\n 'KI',\n 'KP',\n 'KR',\n 'KW',\n 'KG',\n 'LA',\n 'LV',\n 'LB',\n 'LS',\n 'LR',\n 'LY',\n 'LI',\n 'LT',\n 'LU',\n 'MO',\n 'MK',\n 'MG',\n 'MW',\n 'MY',\n 'MV',\n 'ML',\n 'MT',\n 'MH',\n 'MQ',\n 'MR',\n 'MU',\n 'YT',\n 'MX',\n 'FM',\n 'MD',\n 'MC',\n 'MN',\n 'ME',\n 'MS',\n 'MA',\n 'MZ',\n 'MM',\n 'NA',\n 'NR',\n 'NP',\n 'NL',\n 'NC',\n 'NZ',\n 'NI',\n 'NE',\n 'NG',\n 'NU',\n 'NF',\n 'MP',\n 'NO',\n 'OM',\n 'PK',\n 'PW',\n 'PS',\n 'PA',\n 'PG',\n 'PY',\n 'PE',\n 'PH',\n 'PN',\n 'PL',\n 'PT',\n 'PR',\n 'QA',\n 'RE',\n 'RO',\n 'RU',\n 'RW',\n 'BL',\n 'SH',\n 'KN',\n 'LC',\n 'MF',\n 'PM',\n 'VC',\n 'WS',\n 'SM',\n 'ST',\n 'SA',\n 'SN',\n 'RS',\n 'SC',\n 'SL',\n 'SG',\n 'SX',\n 'SK',\n 'SI',\n 'SB',\n 'SO',\n 'ZA',\n 'GS',\n 'SS',\n 'ES',\n 'LK',\n 'SD',\n 'SR',\n 'SJ',\n 'SZ',\n 'SE',\n 'CH',\n 'SY',\n 'TW',\n 'TJ',\n 'TZ',\n 'TH',\n 'TL',\n 'TG',\n 'TK',\n 'TO',\n 'TT',\n 'TN',\n 'TR',\n 'TM',\n 'TC',\n 'TV',\n 'UG',\n 'UA',\n 'AE',\n 'GB',\n 'UM',\n 'UY',\n 'UZ',\n 'VU',\n 'VE',\n 'VN',\n 'VG',\n 'VI',\n 'WF',\n 'EH',\n 'YE',\n 'ZM',\n 'ZW',\n 'US'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -29,13 +30,23 @@ export const tool: Tool = { type: 'integer', description: 'Offset for pagination', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: [], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.customers.list(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.customers.list(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/customers/list-mandates-customers.ts b/packages/mcp-server/src/tools/customers/list-mandates-customers.ts index 063f27c..06046d4 100644 --- a/packages/mcp-server/src/tools/customers/list-mandates-customers.ts +++ b/packages/mcp-server/src/tools/customers/list-mandates-customers.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,31 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_mandates_customers', - description: 'Lists all the mandates for a particular customer id.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nLists all the mandates for a particular customer id.\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/mandate_response'\n },\n $defs: {\n mandate_response: {\n type: 'object',\n properties: {\n mandate_id: {\n type: 'string',\n description: 'The identifier for mandate'\n },\n payment_method: {\n type: 'string',\n description: 'The payment method'\n },\n payment_method_id: {\n type: 'string',\n description: 'The identifier for payment method'\n },\n status: {\n $ref: '#/$defs/mandate_status'\n },\n card: {\n type: 'object',\n properties: {\n card_exp_month: {\n type: 'string',\n description: 'The expiry month of card'\n },\n card_exp_year: {\n type: 'string',\n description: 'The expiry year of card'\n },\n card_fingerprint: {\n type: 'string',\n description: 'A unique identifier alias to identify a particular card'\n },\n card_holder_name: {\n type: 'string',\n description: 'The card holder name'\n },\n card_isin: {\n type: 'string',\n description: 'The first 6 digits of card'\n },\n card_issuer: {\n type: 'string',\n description: 'The bank that issued the card'\n },\n card_network: {\n $ref: '#/$defs/card_network'\n },\n card_token: {\n type: 'string',\n description: 'The token from card locker'\n },\n card_type: {\n type: 'string',\n description: 'The type of the payment card'\n },\n issuer_country: {\n type: 'string',\n description: 'The country code in in which the card was issued'\n },\n last4_digits: {\n type: 'string',\n description: 'The last 4 digits of card'\n },\n nick_name: {\n type: 'string',\n description: 'The nick_name of the card holder'\n },\n scheme: {\n type: 'string',\n description: 'The card scheme network for the particular card'\n }\n }\n },\n customer_acceptance: {\n $ref: '#/$defs/customer_acceptance'\n },\n payment_method_type: {\n type: 'string',\n description: 'The payment method type'\n }\n },\n required: [ 'mandate_id',\n 'payment_method',\n 'payment_method_id',\n 'status'\n ]\n },\n mandate_status: {\n type: 'string',\n description: 'The status of the mandate, which indicates whether it can be used to initiate a payment.',\n enum: [ 'active',\n 'inactive',\n 'pending',\n 'revoked'\n ]\n },\n card_network: {\n type: 'string',\n description: 'Indicates the card network.',\n enum: [ 'Visa',\n 'Mastercard',\n 'AmericanExpress',\n 'JCB',\n 'DinersClub',\n 'Discover',\n 'CartesBancaires',\n 'UnionPay',\n 'Interac',\n 'RuPay',\n 'Maestro',\n 'Star',\n 'Pulse',\n 'Accel',\n 'Nyce'\n ]\n },\n customer_acceptance: {\n type: 'object',\n description: 'This \"CustomerAcceptance\" object is passed during Payments-Confirm request, it enlists the type, time, and mode of acceptance properties related to an acceptance done by the customer. The customer_acceptance sub object is usually passed by the SDK or client.',\n properties: {\n acceptance_type: {\n type: 'string',\n description: 'This is used to indicate if the mandate was accepted online or offline',\n enum: [ 'online',\n 'offline'\n ]\n },\n accepted_at: {\n type: 'string',\n description: 'Specifying when the customer acceptance was provided',\n format: 'date-time'\n },\n online: {\n type: 'object',\n description: 'Details of online mandate',\n properties: {\n ip_address: {\n type: 'string',\n description: 'Ip address of the customer machine from which the mandate was created'\n },\n user_agent: {\n type: 'string',\n description: 'The user-agent of the customer\\'s browser'\n }\n },\n required: [ 'ip_address',\n 'user_agent'\n ]\n }\n },\n required: [ 'acceptance_type'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { customer_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['customer_id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { customer_id, ...body } = args as any; - return asTextContentResult(await client.customers.listMandates(customer_id)); + const { customer_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.customers.listMandates(customer_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/customers/payment-methods/list-customers-payment-methods.ts b/packages/mcp-server/src/tools/customers/payment-methods/list-customers-payment-methods.ts index 8db5c39..b327c05 100644 --- a/packages/mcp-server/src/tools/customers/payment-methods/list-customers-payment-methods.ts +++ b/packages/mcp-server/src/tools/customers/payment-methods/list-customers-payment-methods.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -67,6 +66,7 @@ export const tool: Tool = { description: 'Indicates whether the payment method is eligible for recurring payments', }, }, + required: ['customer_id'], $defs: { country_alpha2: { type: 'string', @@ -512,6 +512,9 @@ export const tool: Tool = { }, }, }, + annotations: { + readOnlyHint: true, + }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/customers/payment-methods/list-saved-customers-payment-methods.ts b/packages/mcp-server/src/tools/customers/payment-methods/list-saved-customers-payment-methods.ts index e34221f..a495170 100644 --- a/packages/mcp-server/src/tools/customers/payment-methods/list-saved-customers-payment-methods.ts +++ b/packages/mcp-server/src/tools/customers/payment-methods/list-saved-customers-payment-methods.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -65,6 +64,7 @@ export const tool: Tool = { description: 'Indicates whether the payment method is eligible for recurring payments', }, }, + required: [], $defs: { country_alpha2: { type: 'string', @@ -510,6 +510,9 @@ export const tool: Tool = { }, }, }, + annotations: { + readOnlyHint: true, + }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/customers/retrieve-customers.ts b/packages/mcp-server/src/tools/customers/retrieve-customers.ts index e9a47d6..929ab69 100644 --- a/packages/mcp-server/src/tools/customers/retrieve-customers.ts +++ b/packages/mcp-server/src/tools/customers/retrieve-customers.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,31 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_customers', - description: "Retrieves a customer's details.", + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieves a customer's details.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/customer',\n $defs: {\n customer: {\n type: 'object',\n properties: {\n created_at: {\n type: 'string',\n description: 'A timestamp (ISO 8601 code) that determines when the customer was created',\n format: 'date-time'\n },\n customer_id: {\n type: 'string',\n description: 'The identifier for the customer object'\n },\n address: {\n $ref: '#/$defs/address_details'\n },\n default_payment_method_id: {\n type: 'string',\n description: 'The identifier for the default payment method.'\n },\n description: {\n type: 'string',\n description: 'An arbitrary string that you can attach to a customer object.'\n },\n email: {\n type: 'string',\n description: 'The customer\\'s email address'\n },\n metadata: {\n type: 'object',\n description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500\\ncharacters long. Metadata is useful for storing additional, structured information on an\\nobject.',\n additionalProperties: true\n },\n name: {\n type: 'string',\n description: 'The customer\\'s name'\n },\n phone: {\n type: 'string',\n description: 'The customer\\'s phone number'\n },\n phone_country_code: {\n type: 'string',\n description: 'The country code for the customer phone number'\n }\n },\n required: [ 'created_at',\n 'customer_id'\n ]\n },\n address_details: {\n type: 'object',\n description: 'Address details',\n properties: {\n city: {\n type: 'string',\n description: 'The city, district, suburb, town, or village of the address.'\n },\n country: {\n $ref: '#/$defs/country_alpha2'\n },\n first_name: {\n type: 'string',\n description: 'The first name for the address'\n },\n last_name: {\n type: 'string',\n description: 'The last name for the address'\n },\n line1: {\n type: 'string',\n description: 'The first line of the street address or P.O. Box.'\n },\n line2: {\n type: 'string',\n description: 'The second line of the street address or P.O. Box (e.g., apartment, suite, unit, or building).'\n },\n line3: {\n type: 'string',\n description: 'The third line of the street address, if applicable.'\n },\n state: {\n type: 'string',\n description: 'The address state'\n },\n zip: {\n type: 'string',\n description: 'The zip/postal code for the address'\n }\n }\n },\n country_alpha2: {\n type: 'string',\n enum: [ 'AF',\n 'AX',\n 'AL',\n 'DZ',\n 'AS',\n 'AD',\n 'AO',\n 'AI',\n 'AQ',\n 'AG',\n 'AR',\n 'AM',\n 'AW',\n 'AU',\n 'AT',\n 'AZ',\n 'BS',\n 'BH',\n 'BD',\n 'BB',\n 'BY',\n 'BE',\n 'BZ',\n 'BJ',\n 'BM',\n 'BT',\n 'BO',\n 'BQ',\n 'BA',\n 'BW',\n 'BV',\n 'BR',\n 'IO',\n 'BN',\n 'BG',\n 'BF',\n 'BI',\n 'KH',\n 'CM',\n 'CA',\n 'CV',\n 'KY',\n 'CF',\n 'TD',\n 'CL',\n 'CN',\n 'CX',\n 'CC',\n 'CO',\n 'KM',\n 'CG',\n 'CD',\n 'CK',\n 'CR',\n 'CI',\n 'HR',\n 'CU',\n 'CW',\n 'CY',\n 'CZ',\n 'DK',\n 'DJ',\n 'DM',\n 'DO',\n 'EC',\n 'EG',\n 'SV',\n 'GQ',\n 'ER',\n 'EE',\n 'ET',\n 'FK',\n 'FO',\n 'FJ',\n 'FI',\n 'FR',\n 'GF',\n 'PF',\n 'TF',\n 'GA',\n 'GM',\n 'GE',\n 'DE',\n 'GH',\n 'GI',\n 'GR',\n 'GL',\n 'GD',\n 'GP',\n 'GU',\n 'GT',\n 'GG',\n 'GN',\n 'GW',\n 'GY',\n 'HT',\n 'HM',\n 'VA',\n 'HN',\n 'HK',\n 'HU',\n 'IS',\n 'IN',\n 'ID',\n 'IR',\n 'IQ',\n 'IE',\n 'IM',\n 'IL',\n 'IT',\n 'JM',\n 'JP',\n 'JE',\n 'JO',\n 'KZ',\n 'KE',\n 'KI',\n 'KP',\n 'KR',\n 'KW',\n 'KG',\n 'LA',\n 'LV',\n 'LB',\n 'LS',\n 'LR',\n 'LY',\n 'LI',\n 'LT',\n 'LU',\n 'MO',\n 'MK',\n 'MG',\n 'MW',\n 'MY',\n 'MV',\n 'ML',\n 'MT',\n 'MH',\n 'MQ',\n 'MR',\n 'MU',\n 'YT',\n 'MX',\n 'FM',\n 'MD',\n 'MC',\n 'MN',\n 'ME',\n 'MS',\n 'MA',\n 'MZ',\n 'MM',\n 'NA',\n 'NR',\n 'NP',\n 'NL',\n 'NC',\n 'NZ',\n 'NI',\n 'NE',\n 'NG',\n 'NU',\n 'NF',\n 'MP',\n 'NO',\n 'OM',\n 'PK',\n 'PW',\n 'PS',\n 'PA',\n 'PG',\n 'PY',\n 'PE',\n 'PH',\n 'PN',\n 'PL',\n 'PT',\n 'PR',\n 'QA',\n 'RE',\n 'RO',\n 'RU',\n 'RW',\n 'BL',\n 'SH',\n 'KN',\n 'LC',\n 'MF',\n 'PM',\n 'VC',\n 'WS',\n 'SM',\n 'ST',\n 'SA',\n 'SN',\n 'RS',\n 'SC',\n 'SL',\n 'SG',\n 'SX',\n 'SK',\n 'SI',\n 'SB',\n 'SO',\n 'ZA',\n 'GS',\n 'SS',\n 'ES',\n 'LK',\n 'SD',\n 'SR',\n 'SJ',\n 'SZ',\n 'SE',\n 'CH',\n 'SY',\n 'TW',\n 'TJ',\n 'TZ',\n 'TH',\n 'TL',\n 'TG',\n 'TK',\n 'TO',\n 'TT',\n 'TN',\n 'TR',\n 'TM',\n 'TC',\n 'TV',\n 'UG',\n 'UA',\n 'AE',\n 'GB',\n 'UM',\n 'UY',\n 'UZ',\n 'VU',\n 'VE',\n 'VN',\n 'VG',\n 'VI',\n 'WF',\n 'EH',\n 'YE',\n 'ZM',\n 'ZW',\n 'US'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { customer_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['customer_id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { customer_id, ...body } = args as any; - return asTextContentResult(await client.customers.retrieve(customer_id)); + const { customer_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.customers.retrieve(customer_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/customers/update-customers.ts b/packages/mcp-server/src/tools/customers/update-customers.ts index 2a25cd8..8b0a00d 100644 --- a/packages/mcp-server/src/tools/customers/update-customers.ts +++ b/packages/mcp-server/src/tools/customers/update-customers.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -39,6 +38,7 @@ export const tool: Tool = { type: 'object', description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500\ncharacters long. Metadata is useful for storing additional, structured information on an\nobject.', + additionalProperties: true, }, name: { type: 'string', @@ -53,6 +53,7 @@ export const tool: Tool = { description: 'The country code for the customer phone number', }, }, + required: ['customer_id'], $defs: { address_details: { type: 'object', @@ -95,7 +96,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, country_alpha2: { type: 'string', @@ -353,6 +353,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/disputes/list-disputes.ts b/packages/mcp-server/src/tools/disputes/list-disputes.ts index 1816e6b..18d9932 100644 --- a/packages/mcp-server/src/tools/disputes/list-disputes.ts +++ b/packages/mcp-server/src/tools/disputes/list-disputes.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_disputes', - description: 'Lists all the Disputes for a merchant', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nLists all the Disputes for a merchant\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/dispute_response'\n },\n $defs: {\n dispute_response: {\n type: 'object',\n properties: {\n amount: {\n type: 'string',\n description: 'Connector specific types to send'\n },\n attempt_id: {\n type: 'string',\n description: 'The identifier for payment_attempt'\n },\n connector: {\n type: 'string',\n description: 'connector to which dispute is associated with'\n },\n connector_dispute_id: {\n type: 'string',\n description: 'Dispute id sent by connector'\n },\n connector_status: {\n type: 'string',\n description: 'Status of the dispute sent by connector'\n },\n created_at: {\n type: 'string',\n description: 'Time at which dispute is received',\n format: 'date-time'\n },\n currency: {\n $ref: '#/$defs/currency'\n },\n dispute_id: {\n type: 'string',\n description: 'The identifier for dispute'\n },\n dispute_stage: {\n $ref: '#/$defs/dispute_stage'\n },\n dispute_status: {\n $ref: '#/$defs/dispute_status'\n },\n payment_id: {\n type: 'string',\n description: 'The identifier for payment_intent'\n },\n challenge_required_by: {\n type: 'string',\n description: 'Evidence deadline of dispute sent by connector',\n format: 'date-time'\n },\n connector_created_at: {\n type: 'string',\n description: 'Dispute created time sent by connector',\n format: 'date-time'\n },\n connector_reason: {\n type: 'string',\n description: 'Reason of dispute sent by connector'\n },\n connector_reason_code: {\n type: 'string',\n description: 'Reason code of dispute sent by connector'\n },\n connector_updated_at: {\n type: 'string',\n description: 'Dispute updated time sent by connector',\n format: 'date-time'\n },\n merchant_connector_id: {\n type: 'string',\n description: 'The `merchant_connector_id` of the connector / processor through which the dispute was processed'\n },\n profile_id: {\n type: 'string',\n description: 'The `profile_id` associated with the dispute'\n }\n },\n required: [ 'amount',\n 'attempt_id',\n 'connector',\n 'connector_dispute_id',\n 'connector_status',\n 'created_at',\n 'currency',\n 'dispute_id',\n 'dispute_stage',\n 'dispute_status',\n 'payment_id'\n ]\n },\n currency: {\n type: 'string',\n description: 'The three-letter ISO 4217 currency code (e.g., \"USD\", \"EUR\") for the payment amount. This field is mandatory for creating a payment.',\n enum: [ 'AED',\n 'AFN',\n 'ALL',\n 'AMD',\n 'ANG',\n 'AOA',\n 'ARS',\n 'AUD',\n 'AWG',\n 'AZN',\n 'BAM',\n 'BBD',\n 'BDT',\n 'BGN',\n 'BHD',\n 'BIF',\n 'BMD',\n 'BND',\n 'BOB',\n 'BRL',\n 'BSD',\n 'BTN',\n 'BWP',\n 'BYN',\n 'BZD',\n 'CAD',\n 'CDF',\n 'CHF',\n 'CLF',\n 'CLP',\n 'CNY',\n 'COP',\n 'CRC',\n 'CUC',\n 'CUP',\n 'CVE',\n 'CZK',\n 'DJF',\n 'DKK',\n 'DOP',\n 'DZD',\n 'EGP',\n 'ERN',\n 'ETB',\n 'EUR',\n 'FJD',\n 'FKP',\n 'GBP',\n 'GEL',\n 'GHS',\n 'GIP',\n 'GMD',\n 'GNF',\n 'GTQ',\n 'GYD',\n 'HKD',\n 'HNL',\n 'HRK',\n 'HTG',\n 'HUF',\n 'IDR',\n 'ILS',\n 'INR',\n 'IQD',\n 'IRR',\n 'ISK',\n 'JMD',\n 'JOD',\n 'JPY',\n 'KES',\n 'KGS',\n 'KHR',\n 'KMF',\n 'KPW',\n 'KRW',\n 'KWD',\n 'KYD',\n 'KZT',\n 'LAK',\n 'LBP',\n 'LKR',\n 'LRD',\n 'LSL',\n 'LYD',\n 'MAD',\n 'MDL',\n 'MGA',\n 'MKD',\n 'MMK',\n 'MNT',\n 'MOP',\n 'MRU',\n 'MUR',\n 'MVR',\n 'MWK',\n 'MXN',\n 'MYR',\n 'MZN',\n 'NAD',\n 'NGN',\n 'NIO',\n 'NOK',\n 'NPR',\n 'NZD',\n 'OMR',\n 'PAB',\n 'PEN',\n 'PGK',\n 'PHP',\n 'PKR',\n 'PLN',\n 'PYG',\n 'QAR',\n 'RON',\n 'RSD',\n 'RUB',\n 'RWF',\n 'SAR',\n 'SBD',\n 'SCR',\n 'SDG',\n 'SEK',\n 'SGD',\n 'SHP',\n 'SLE',\n 'SLL',\n 'SOS',\n 'SRD',\n 'SSP',\n 'STD',\n 'STN',\n 'SVC',\n 'SYP',\n 'SZL',\n 'THB',\n 'TJS',\n 'TMT',\n 'TND',\n 'TOP',\n 'TRY',\n 'TTD',\n 'TWD',\n 'TZS',\n 'UAH',\n 'UGX',\n 'USD',\n 'UYU',\n 'UZS',\n 'VES',\n 'VND',\n 'VUV',\n 'WST',\n 'XAF',\n 'XCD',\n 'XOF',\n 'XPF',\n 'YER',\n 'ZAR',\n 'ZMW',\n 'ZWL'\n ]\n },\n dispute_stage: {\n type: 'string',\n description: 'Stage of the dispute',\n enum: [ 'pre_dispute',\n 'dispute',\n 'pre_arbitration'\n ]\n },\n dispute_status: {\n type: 'string',\n description: 'Status of the dispute',\n enum: [ 'dispute_opened',\n 'dispute_expired',\n 'dispute_accepted',\n 'dispute_cancelled',\n 'dispute_challenged',\n 'dispute_won',\n 'dispute_lost'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -63,9 +64,15 @@ export const tool: Tool = { format: 'date-time', }, }, - required: [], + }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', }, }, + required: [], $defs: { dispute_stage: { type: 'string', @@ -87,11 +94,14 @@ export const tool: Tool = { }, }, }, + annotations: { + readOnlyHint: true, + }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.disputes.list(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.disputes.list(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/disputes/retrieve-disputes.ts b/packages/mcp-server/src/tools/disputes/retrieve-disputes.ts index 5affe8e..5662c9f 100644 --- a/packages/mcp-server/src/tools/disputes/retrieve-disputes.ts +++ b/packages/mcp-server/src/tools/disputes/retrieve-disputes.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,31 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_disputes', - description: 'Retrieves a dispute', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieves a dispute\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/dispute_response',\n $defs: {\n dispute_response: {\n type: 'object',\n properties: {\n amount: {\n type: 'string',\n description: 'Connector specific types to send'\n },\n attempt_id: {\n type: 'string',\n description: 'The identifier for payment_attempt'\n },\n connector: {\n type: 'string',\n description: 'connector to which dispute is associated with'\n },\n connector_dispute_id: {\n type: 'string',\n description: 'Dispute id sent by connector'\n },\n connector_status: {\n type: 'string',\n description: 'Status of the dispute sent by connector'\n },\n created_at: {\n type: 'string',\n description: 'Time at which dispute is received',\n format: 'date-time'\n },\n currency: {\n $ref: '#/$defs/currency'\n },\n dispute_id: {\n type: 'string',\n description: 'The identifier for dispute'\n },\n dispute_stage: {\n $ref: '#/$defs/dispute_stage'\n },\n dispute_status: {\n $ref: '#/$defs/dispute_status'\n },\n payment_id: {\n type: 'string',\n description: 'The identifier for payment_intent'\n },\n challenge_required_by: {\n type: 'string',\n description: 'Evidence deadline of dispute sent by connector',\n format: 'date-time'\n },\n connector_created_at: {\n type: 'string',\n description: 'Dispute created time sent by connector',\n format: 'date-time'\n },\n connector_reason: {\n type: 'string',\n description: 'Reason of dispute sent by connector'\n },\n connector_reason_code: {\n type: 'string',\n description: 'Reason code of dispute sent by connector'\n },\n connector_updated_at: {\n type: 'string',\n description: 'Dispute updated time sent by connector',\n format: 'date-time'\n },\n merchant_connector_id: {\n type: 'string',\n description: 'The `merchant_connector_id` of the connector / processor through which the dispute was processed'\n },\n profile_id: {\n type: 'string',\n description: 'The `profile_id` associated with the dispute'\n }\n },\n required: [ 'amount',\n 'attempt_id',\n 'connector',\n 'connector_dispute_id',\n 'connector_status',\n 'created_at',\n 'currency',\n 'dispute_id',\n 'dispute_stage',\n 'dispute_status',\n 'payment_id'\n ]\n },\n currency: {\n type: 'string',\n description: 'The three-letter ISO 4217 currency code (e.g., \"USD\", \"EUR\") for the payment amount. This field is mandatory for creating a payment.',\n enum: [ 'AED',\n 'AFN',\n 'ALL',\n 'AMD',\n 'ANG',\n 'AOA',\n 'ARS',\n 'AUD',\n 'AWG',\n 'AZN',\n 'BAM',\n 'BBD',\n 'BDT',\n 'BGN',\n 'BHD',\n 'BIF',\n 'BMD',\n 'BND',\n 'BOB',\n 'BRL',\n 'BSD',\n 'BTN',\n 'BWP',\n 'BYN',\n 'BZD',\n 'CAD',\n 'CDF',\n 'CHF',\n 'CLF',\n 'CLP',\n 'CNY',\n 'COP',\n 'CRC',\n 'CUC',\n 'CUP',\n 'CVE',\n 'CZK',\n 'DJF',\n 'DKK',\n 'DOP',\n 'DZD',\n 'EGP',\n 'ERN',\n 'ETB',\n 'EUR',\n 'FJD',\n 'FKP',\n 'GBP',\n 'GEL',\n 'GHS',\n 'GIP',\n 'GMD',\n 'GNF',\n 'GTQ',\n 'GYD',\n 'HKD',\n 'HNL',\n 'HRK',\n 'HTG',\n 'HUF',\n 'IDR',\n 'ILS',\n 'INR',\n 'IQD',\n 'IRR',\n 'ISK',\n 'JMD',\n 'JOD',\n 'JPY',\n 'KES',\n 'KGS',\n 'KHR',\n 'KMF',\n 'KPW',\n 'KRW',\n 'KWD',\n 'KYD',\n 'KZT',\n 'LAK',\n 'LBP',\n 'LKR',\n 'LRD',\n 'LSL',\n 'LYD',\n 'MAD',\n 'MDL',\n 'MGA',\n 'MKD',\n 'MMK',\n 'MNT',\n 'MOP',\n 'MRU',\n 'MUR',\n 'MVR',\n 'MWK',\n 'MXN',\n 'MYR',\n 'MZN',\n 'NAD',\n 'NGN',\n 'NIO',\n 'NOK',\n 'NPR',\n 'NZD',\n 'OMR',\n 'PAB',\n 'PEN',\n 'PGK',\n 'PHP',\n 'PKR',\n 'PLN',\n 'PYG',\n 'QAR',\n 'RON',\n 'RSD',\n 'RUB',\n 'RWF',\n 'SAR',\n 'SBD',\n 'SCR',\n 'SDG',\n 'SEK',\n 'SGD',\n 'SHP',\n 'SLE',\n 'SLL',\n 'SOS',\n 'SRD',\n 'SSP',\n 'STD',\n 'STN',\n 'SVC',\n 'SYP',\n 'SZL',\n 'THB',\n 'TJS',\n 'TMT',\n 'TND',\n 'TOP',\n 'TRY',\n 'TTD',\n 'TWD',\n 'TZS',\n 'UAH',\n 'UGX',\n 'USD',\n 'UYU',\n 'UZS',\n 'VES',\n 'VND',\n 'VUV',\n 'WST',\n 'XAF',\n 'XCD',\n 'XOF',\n 'XPF',\n 'YER',\n 'ZAR',\n 'ZMW',\n 'ZWL'\n ]\n },\n dispute_stage: {\n type: 'string',\n description: 'Stage of the dispute',\n enum: [ 'pre_dispute',\n 'dispute',\n 'pre_arbitration'\n ]\n },\n dispute_status: {\n type: 'string',\n description: 'Status of the dispute',\n enum: [ 'dispute_opened',\n 'dispute_expired',\n 'dispute_accepted',\n 'dispute_cancelled',\n 'dispute_challenged',\n 'dispute_won',\n 'dispute_lost'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { dispute_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['dispute_id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { dispute_id, ...body } = args as any; - return asTextContentResult(await client.disputes.retrieve(dispute_id)); + const { dispute_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.disputes.retrieve(dispute_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/events/delivery-attempts-events.ts b/packages/mcp-server/src/tools/events/delivery-attempts-events.ts index a37341d..0574881 100644 --- a/packages/mcp-server/src/tools/events/delivery-attempts-events.ts +++ b/packages/mcp-server/src/tools/events/delivery-attempts-events.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'delivery_attempts_events', - description: 'List all delivery attempts for the specified Event.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nList all delivery attempts for the specified Event.\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/event_retrieve'\n },\n $defs: {\n event_retrieve: {\n allOf: [ {\n $ref: '#/$defs/event_list_item'\n }\n ],\n description: 'The response body for retrieving an event.'\n },\n event_list_item: {\n type: 'object',\n description: 'The response body for each item when listing events.',\n properties: {\n created: {\n type: 'string',\n description: 'Time at which the event was created.',\n format: 'date-time'\n },\n event_class: {\n $ref: '#/$defs/event_class'\n },\n event_id: {\n type: 'string',\n description: 'The identifier for the Event.'\n },\n event_type: {\n $ref: '#/$defs/event_type'\n },\n initial_attempt_id: {\n type: 'string',\n description: 'The identifier for the initial delivery attempt. This will be the same as `event_id` for\\nthe initial delivery attempt.'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account.'\n },\n object_id: {\n type: 'string',\n description: 'The identifier for the object (Payment Intent ID, Refund ID, etc.)'\n },\n profile_id: {\n type: 'string',\n description: 'The identifier for the Business Profile.'\n },\n is_delivery_successful: {\n type: 'boolean',\n description: 'Indicates whether the webhook was ultimately delivered or not.'\n }\n },\n required: [ 'created',\n 'event_class',\n 'event_id',\n 'event_type',\n 'initial_attempt_id',\n 'merchant_id',\n 'object_id',\n 'profile_id'\n ]\n },\n event_class: {\n type: 'string',\n enum: [ 'payments',\n 'refunds',\n 'disputes',\n 'mandates',\n 'payouts'\n ]\n },\n event_type: {\n type: 'string',\n enum: [ 'payment_succeeded',\n 'payment_failed',\n 'payment_processing',\n 'payment_cancelled',\n 'payment_authorized',\n 'payment_captured',\n 'action_required',\n 'refund_succeeded',\n 'refund_failed',\n 'dispute_opened',\n 'dispute_expired',\n 'dispute_accepted',\n 'dispute_cancelled',\n 'dispute_challenged',\n 'dispute_won',\n 'dispute_lost',\n 'mandate_active',\n 'mandate_revoked',\n 'payout_success',\n 'payout_failed',\n 'payout_initiated',\n 'payout_processing',\n 'payout_cancelled',\n 'payout_expired',\n 'payout_reversed'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -27,13 +28,25 @@ export const tool: Tool = { event_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['merchant_id', 'event_id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { event_id, ...body } = args as any; - return asTextContentResult(await client.events.deliveryAttempts(event_id, body)); + const { event_id, jq_filter, ...body } = args as any; + return asTextContentResult( + await maybeFilter(jq_filter, await client.events.deliveryAttempts(event_id, body)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/events/list-events.ts b/packages/mcp-server/src/tools/events/list-events.ts index cff247c..3ec5569 100644 --- a/packages/mcp-server/src/tools/events/list-events.ts +++ b/packages/mcp-server/src/tools/events/list-events.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_events', - description: 'List all Events associated with a Merchant Account or Profile.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nList all Events associated with a Merchant Account or Profile.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/total_events',\n $defs: {\n total_events: {\n type: 'object',\n description: 'The response body of list initial delivery attempts api call.',\n properties: {\n events: {\n type: 'array',\n description: 'The list of events',\n items: {\n $ref: '#/$defs/event_list_item'\n }\n },\n total_count: {\n type: 'integer',\n description: 'Count of total events'\n }\n },\n required: [ 'events',\n 'total_count'\n ]\n },\n event_list_item: {\n type: 'object',\n description: 'The response body for each item when listing events.',\n properties: {\n created: {\n type: 'string',\n description: 'Time at which the event was created.',\n format: 'date-time'\n },\n event_class: {\n $ref: '#/$defs/event_class'\n },\n event_id: {\n type: 'string',\n description: 'The identifier for the Event.'\n },\n event_type: {\n $ref: '#/$defs/event_type'\n },\n initial_attempt_id: {\n type: 'string',\n description: 'The identifier for the initial delivery attempt. This will be the same as `event_id` for\\nthe initial delivery attempt.'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account.'\n },\n object_id: {\n type: 'string',\n description: 'The identifier for the object (Payment Intent ID, Refund ID, etc.)'\n },\n profile_id: {\n type: 'string',\n description: 'The identifier for the Business Profile.'\n },\n is_delivery_successful: {\n type: 'boolean',\n description: 'Indicates whether the webhook was ultimately delivered or not.'\n }\n },\n required: [ 'created',\n 'event_class',\n 'event_id',\n 'event_type',\n 'initial_attempt_id',\n 'merchant_id',\n 'object_id',\n 'profile_id'\n ]\n },\n event_class: {\n type: 'string',\n enum: [ 'payments',\n 'refunds',\n 'disputes',\n 'mandates',\n 'payouts'\n ]\n },\n event_type: {\n type: 'string',\n enum: [ 'payment_succeeded',\n 'payment_failed',\n 'payment_processing',\n 'payment_cancelled',\n 'payment_authorized',\n 'payment_captured',\n 'action_required',\n 'refund_succeeded',\n 'refund_failed',\n 'dispute_opened',\n 'dispute_expired',\n 'dispute_accepted',\n 'dispute_cancelled',\n 'dispute_challenged',\n 'dispute_won',\n 'dispute_lost',\n 'mandate_active',\n 'mandate_revoked',\n 'payout_success',\n 'payout_failed',\n 'payout_initiated',\n 'payout_processing',\n 'payout_cancelled',\n 'payout_expired',\n 'payout_reversed'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -69,7 +70,14 @@ export const tool: Tool = { type: 'string', description: 'Filter all events associated with the specified business profile ID.', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['merchant_id'], $defs: { event_class: { type: 'string', @@ -107,11 +115,12 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { merchant_id, ...body } = args as any; - return asTextContentResult(await client.events.list(merchant_id, body)); + const { merchant_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.events.list(merchant_id, body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/events/profile/list-events-profile.ts b/packages/mcp-server/src/tools/events/profile/list-events-profile.ts index 9150419..ef2390f 100644 --- a/packages/mcp-server/src/tools/events/profile/list-events-profile.ts +++ b/packages/mcp-server/src/tools/events/profile/list-events-profile.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_events_profile', - description: 'List all Events associated with a Profile.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nList all Events associated with a Profile.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/total_events',\n $defs: {\n total_events: {\n type: 'object',\n description: 'The response body of list initial delivery attempts api call.',\n properties: {\n events: {\n type: 'array',\n description: 'The list of events',\n items: {\n $ref: '#/$defs/event_list_item'\n }\n },\n total_count: {\n type: 'integer',\n description: 'Count of total events'\n }\n },\n required: [ 'events',\n 'total_count'\n ]\n },\n event_list_item: {\n type: 'object',\n description: 'The response body for each item when listing events.',\n properties: {\n created: {\n type: 'string',\n description: 'Time at which the event was created.',\n format: 'date-time'\n },\n event_class: {\n $ref: '#/$defs/event_class'\n },\n event_id: {\n type: 'string',\n description: 'The identifier for the Event.'\n },\n event_type: {\n $ref: '#/$defs/event_type'\n },\n initial_attempt_id: {\n type: 'string',\n description: 'The identifier for the initial delivery attempt. This will be the same as `event_id` for\\nthe initial delivery attempt.'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account.'\n },\n object_id: {\n type: 'string',\n description: 'The identifier for the object (Payment Intent ID, Refund ID, etc.)'\n },\n profile_id: {\n type: 'string',\n description: 'The identifier for the Business Profile.'\n },\n is_delivery_successful: {\n type: 'boolean',\n description: 'Indicates whether the webhook was ultimately delivered or not.'\n }\n },\n required: [ 'created',\n 'event_class',\n 'event_id',\n 'event_type',\n 'initial_attempt_id',\n 'merchant_id',\n 'object_id',\n 'profile_id'\n ]\n },\n event_class: {\n type: 'string',\n enum: [ 'payments',\n 'refunds',\n 'disputes',\n 'mandates',\n 'payouts'\n ]\n },\n event_type: {\n type: 'string',\n enum: [ 'payment_succeeded',\n 'payment_failed',\n 'payment_processing',\n 'payment_cancelled',\n 'payment_authorized',\n 'payment_captured',\n 'action_required',\n 'refund_succeeded',\n 'refund_failed',\n 'dispute_opened',\n 'dispute_expired',\n 'dispute_accepted',\n 'dispute_cancelled',\n 'dispute_challenged',\n 'dispute_won',\n 'dispute_lost',\n 'mandate_active',\n 'mandate_revoked',\n 'payout_success',\n 'payout_failed',\n 'payout_initiated',\n 'payout_processing',\n 'payout_cancelled',\n 'payout_expired',\n 'payout_reversed'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -66,7 +67,14 @@ export const tool: Tool = { type: 'string', description: 'Filter all events associated with the specified business profile ID.', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: [], $defs: { event_class: { type: 'string', @@ -104,11 +112,12 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.events.profile.list(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.events.profile.list(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/events/retry-events.ts b/packages/mcp-server/src/tools/events/retry-events.ts index 104a190..f8dd9d1 100644 --- a/packages/mcp-server/src/tools/events/retry-events.ts +++ b/packages/mcp-server/src/tools/events/retry-events.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retry_events', - description: 'Manually retry the delivery of the specified Event.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nManually retry the delivery of the specified Event.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/event_retrieve',\n $defs: {\n event_retrieve: {\n allOf: [ {\n $ref: '#/$defs/event_list_item'\n }\n ],\n description: 'The response body for retrieving an event.'\n },\n event_list_item: {\n type: 'object',\n description: 'The response body for each item when listing events.',\n properties: {\n created: {\n type: 'string',\n description: 'Time at which the event was created.',\n format: 'date-time'\n },\n event_class: {\n $ref: '#/$defs/event_class'\n },\n event_id: {\n type: 'string',\n description: 'The identifier for the Event.'\n },\n event_type: {\n $ref: '#/$defs/event_type'\n },\n initial_attempt_id: {\n type: 'string',\n description: 'The identifier for the initial delivery attempt. This will be the same as `event_id` for\\nthe initial delivery attempt.'\n },\n merchant_id: {\n type: 'string',\n description: 'The identifier for the Merchant Account.'\n },\n object_id: {\n type: 'string',\n description: 'The identifier for the object (Payment Intent ID, Refund ID, etc.)'\n },\n profile_id: {\n type: 'string',\n description: 'The identifier for the Business Profile.'\n },\n is_delivery_successful: {\n type: 'boolean',\n description: 'Indicates whether the webhook was ultimately delivered or not.'\n }\n },\n required: [ 'created',\n 'event_class',\n 'event_id',\n 'event_type',\n 'initial_attempt_id',\n 'merchant_id',\n 'object_id',\n 'profile_id'\n ]\n },\n event_class: {\n type: 'string',\n enum: [ 'payments',\n 'refunds',\n 'disputes',\n 'mandates',\n 'payouts'\n ]\n },\n event_type: {\n type: 'string',\n enum: [ 'payment_succeeded',\n 'payment_failed',\n 'payment_processing',\n 'payment_cancelled',\n 'payment_authorized',\n 'payment_captured',\n 'action_required',\n 'refund_succeeded',\n 'refund_failed',\n 'dispute_opened',\n 'dispute_expired',\n 'dispute_accepted',\n 'dispute_cancelled',\n 'dispute_challenged',\n 'dispute_won',\n 'dispute_lost',\n 'mandate_active',\n 'mandate_revoked',\n 'payout_success',\n 'payout_failed',\n 'payout_initiated',\n 'payout_processing',\n 'payout_cancelled',\n 'payout_expired',\n 'payout_reversed'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -27,13 +28,21 @@ export const tool: Tool = { event_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['merchant_id', 'event_id'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { event_id, ...body } = args as any; - return asTextContentResult(await client.events.retry(event_id, body)); + const { event_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.events.retry(event_id, body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/gsm/create-gsm.ts b/packages/mcp-server/src/tools/gsm/create-gsm.ts index 71dd94f..866d4ef 100644 --- a/packages/mcp-server/src/tools/gsm/create-gsm.ts +++ b/packages/mcp-server/src/tools/gsm/create-gsm.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_gsm', description: - "Creates a GSM (Global Status Mapping) Rule. A GSM rule is used to map a connector's error message/error code combination during a particular payments flow/sub-flow to Hyperswitch's unified status/error code/error message combination. It is also used to decide the next action in the flow - retry/requeue/do_default", + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nCreates a GSM (Global Status Mapping) Rule. A GSM rule is used to map a connector's error message/error code combination during a particular payments flow/sub-flow to Hyperswitch's unified status/error code/error message combination. It is also used to decide the next action in the flow - retry/requeue/do_default\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/gsm_response',\n $defs: {\n gsm_response: {\n type: 'object',\n properties: {\n clear_pan_possible: {\n type: 'boolean',\n description: 'indicates if retry with pan is possible'\n },\n code: {\n type: 'string',\n description: 'code received from the connector'\n },\n connector: {\n type: 'string',\n description: 'The connector through which payment has gone through'\n },\n decision: {\n type: 'string',\n description: 'decision to be taken for auto retries flow'\n },\n flow: {\n type: 'string',\n description: 'The flow in which the code and message occurred for a connector'\n },\n message: {\n type: 'string',\n description: 'message received from the connector'\n },\n status: {\n type: 'string',\n description: 'status provided by the router'\n },\n step_up_possible: {\n type: 'boolean',\n description: 'indicates if step_up retry is possible'\n },\n sub_flow: {\n type: 'string',\n description: 'The sub_flow in which the code and message occurred for a connector'\n },\n error_category: {\n $ref: '#/$defs/error_category'\n },\n router_error: {\n type: 'string',\n description: 'optional error provided by the router'\n },\n unified_code: {\n type: 'string',\n description: 'error code unified across the connectors'\n },\n unified_message: {\n type: 'string',\n description: 'error message unified across the connectors'\n }\n },\n required: [ 'clear_pan_possible',\n 'code',\n 'connector',\n 'decision',\n 'flow',\n 'message',\n 'status',\n 'step_up_possible',\n 'sub_flow'\n ]\n },\n error_category: {\n type: 'string',\n enum: [ 'frm_decline',\n 'processor_downtime',\n 'processor_decline_unauthorized',\n 'issue_with_payment_method',\n 'processor_decline_incorrect_data'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -71,7 +71,24 @@ export const tool: Tool = { type: 'string', description: 'error message unified across the connectors', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: [ + 'clear_pan_possible', + 'code', + 'connector', + 'decision', + 'flow', + 'message', + 'status', + 'step_up_possible', + 'sub_flow', + ], $defs: { connector: { type: 'string', @@ -201,11 +218,12 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.gsm.create(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.gsm.create(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/gsm/delete-gsm.ts b/packages/mcp-server/src/tools/gsm/delete-gsm.ts index 5581584..0fe14aa 100644 --- a/packages/mcp-server/src/tools/gsm/delete-gsm.ts +++ b/packages/mcp-server/src/tools/gsm/delete-gsm.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'delete_gsm', - description: 'Deletes a Gsm Rule', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nDeletes a Gsm Rule\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n code: {\n type: 'string',\n description: 'code received from the connector'\n },\n connector: {\n type: 'string',\n description: 'The connector through which payment has gone through'\n },\n flow: {\n type: 'string',\n description: 'The flow in which the code and message occurred for a connector'\n },\n gsm_rule_delete: {\n type: 'boolean'\n },\n sub_flow: {\n type: 'string',\n description: 'The sub_flow in which the code and message occurred for a connector'\n }\n },\n required: [ 'code',\n 'connector',\n 'flow',\n 'gsm_rule_delete',\n 'sub_flow'\n ]\n}\n```", inputSchema: { type: 'object', properties: { @@ -41,13 +42,21 @@ export const tool: Tool = { type: 'string', description: 'The sub_flow in which the code and message occurred for a connector', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['code', 'connector', 'flow', 'message', 'sub_flow'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.gsm.delete(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.gsm.delete(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/gsm/retrieve-gsm.ts b/packages/mcp-server/src/tools/gsm/retrieve-gsm.ts index 4dc10de..0cb9c05 100644 --- a/packages/mcp-server/src/tools/gsm/retrieve-gsm.ts +++ b/packages/mcp-server/src/tools/gsm/retrieve-gsm.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_gsm', - description: 'Retrieves a Gsm Rule', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieves a Gsm Rule\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/gsm_response',\n $defs: {\n gsm_response: {\n type: 'object',\n properties: {\n clear_pan_possible: {\n type: 'boolean',\n description: 'indicates if retry with pan is possible'\n },\n code: {\n type: 'string',\n description: 'code received from the connector'\n },\n connector: {\n type: 'string',\n description: 'The connector through which payment has gone through'\n },\n decision: {\n type: 'string',\n description: 'decision to be taken for auto retries flow'\n },\n flow: {\n type: 'string',\n description: 'The flow in which the code and message occurred for a connector'\n },\n message: {\n type: 'string',\n description: 'message received from the connector'\n },\n status: {\n type: 'string',\n description: 'status provided by the router'\n },\n step_up_possible: {\n type: 'boolean',\n description: 'indicates if step_up retry is possible'\n },\n sub_flow: {\n type: 'string',\n description: 'The sub_flow in which the code and message occurred for a connector'\n },\n error_category: {\n $ref: '#/$defs/error_category'\n },\n router_error: {\n type: 'string',\n description: 'optional error provided by the router'\n },\n unified_code: {\n type: 'string',\n description: 'error code unified across the connectors'\n },\n unified_message: {\n type: 'string',\n description: 'error message unified across the connectors'\n }\n },\n required: [ 'clear_pan_possible',\n 'code',\n 'connector',\n 'decision',\n 'flow',\n 'message',\n 'status',\n 'step_up_possible',\n 'sub_flow'\n ]\n },\n error_category: {\n type: 'string',\n enum: [ 'frm_decline',\n 'processor_downtime',\n 'processor_decline_unauthorized',\n 'issue_with_payment_method',\n 'processor_decline_incorrect_data'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -40,7 +41,14 @@ export const tool: Tool = { type: 'string', description: 'The sub_flow in which the code and message occurred for a connector', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['code', 'connector', 'flow', 'message', 'sub_flow'], $defs: { connector: { type: 'string', @@ -156,11 +164,12 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.gsm.retrieve(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.gsm.retrieve(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/gsm/update-gsm.ts b/packages/mcp-server/src/tools/gsm/update-gsm.ts index dc5a11a..eccec09 100644 --- a/packages/mcp-server/src/tools/gsm/update-gsm.ts +++ b/packages/mcp-server/src/tools/gsm/update-gsm.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_gsm', - description: 'Updates a Gsm Rule', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nUpdates a Gsm Rule\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/gsm_response',\n $defs: {\n gsm_response: {\n type: 'object',\n properties: {\n clear_pan_possible: {\n type: 'boolean',\n description: 'indicates if retry with pan is possible'\n },\n code: {\n type: 'string',\n description: 'code received from the connector'\n },\n connector: {\n type: 'string',\n description: 'The connector through which payment has gone through'\n },\n decision: {\n type: 'string',\n description: 'decision to be taken for auto retries flow'\n },\n flow: {\n type: 'string',\n description: 'The flow in which the code and message occurred for a connector'\n },\n message: {\n type: 'string',\n description: 'message received from the connector'\n },\n status: {\n type: 'string',\n description: 'status provided by the router'\n },\n step_up_possible: {\n type: 'boolean',\n description: 'indicates if step_up retry is possible'\n },\n sub_flow: {\n type: 'string',\n description: 'The sub_flow in which the code and message occurred for a connector'\n },\n error_category: {\n $ref: '#/$defs/error_category'\n },\n router_error: {\n type: 'string',\n description: 'optional error provided by the router'\n },\n unified_code: {\n type: 'string',\n description: 'error code unified across the connectors'\n },\n unified_message: {\n type: 'string',\n description: 'error message unified across the connectors'\n }\n },\n required: [ 'clear_pan_possible',\n 'code',\n 'connector',\n 'decision',\n 'flow',\n 'message',\n 'status',\n 'step_up_possible',\n 'sub_flow'\n ]\n },\n error_category: {\n type: 'string',\n enum: [ 'frm_decline',\n 'processor_downtime',\n 'processor_decline_unauthorized',\n 'issue_with_payment_method',\n 'processor_decline_incorrect_data'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -71,7 +72,14 @@ export const tool: Tool = { type: 'string', description: 'error message unified across the connectors', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['code', 'connector', 'flow', 'message', 'sub_flow'], $defs: { gsm_decision: { type: 'string', @@ -89,11 +97,12 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.gsm.update(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.gsm.update(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/mandates/retrieve-mandates.ts b/packages/mcp-server/src/tools/mandates/retrieve-mandates.ts index 1153442..dae6cac 100644 --- a/packages/mcp-server/src/tools/mandates/retrieve-mandates.ts +++ b/packages/mcp-server/src/tools/mandates/retrieve-mandates.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,31 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_mandates', - description: 'Retrieves a mandate created using the Payments/Create API', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieves a mandate created using the Payments/Create API\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/mandate_response',\n $defs: {\n mandate_response: {\n type: 'object',\n properties: {\n mandate_id: {\n type: 'string',\n description: 'The identifier for mandate'\n },\n payment_method: {\n type: 'string',\n description: 'The payment method'\n },\n payment_method_id: {\n type: 'string',\n description: 'The identifier for payment method'\n },\n status: {\n $ref: '#/$defs/mandate_status'\n },\n card: {\n type: 'object',\n properties: {\n card_exp_month: {\n type: 'string',\n description: 'The expiry month of card'\n },\n card_exp_year: {\n type: 'string',\n description: 'The expiry year of card'\n },\n card_fingerprint: {\n type: 'string',\n description: 'A unique identifier alias to identify a particular card'\n },\n card_holder_name: {\n type: 'string',\n description: 'The card holder name'\n },\n card_isin: {\n type: 'string',\n description: 'The first 6 digits of card'\n },\n card_issuer: {\n type: 'string',\n description: 'The bank that issued the card'\n },\n card_network: {\n $ref: '#/$defs/card_network'\n },\n card_token: {\n type: 'string',\n description: 'The token from card locker'\n },\n card_type: {\n type: 'string',\n description: 'The type of the payment card'\n },\n issuer_country: {\n type: 'string',\n description: 'The country code in in which the card was issued'\n },\n last4_digits: {\n type: 'string',\n description: 'The last 4 digits of card'\n },\n nick_name: {\n type: 'string',\n description: 'The nick_name of the card holder'\n },\n scheme: {\n type: 'string',\n description: 'The card scheme network for the particular card'\n }\n }\n },\n customer_acceptance: {\n $ref: '#/$defs/customer_acceptance'\n },\n payment_method_type: {\n type: 'string',\n description: 'The payment method type'\n }\n },\n required: [ 'mandate_id',\n 'payment_method',\n 'payment_method_id',\n 'status'\n ]\n },\n mandate_status: {\n type: 'string',\n description: 'The status of the mandate, which indicates whether it can be used to initiate a payment.',\n enum: [ 'active',\n 'inactive',\n 'pending',\n 'revoked'\n ]\n },\n card_network: {\n type: 'string',\n description: 'Indicates the card network.',\n enum: [ 'Visa',\n 'Mastercard',\n 'AmericanExpress',\n 'JCB',\n 'DinersClub',\n 'Discover',\n 'CartesBancaires',\n 'UnionPay',\n 'Interac',\n 'RuPay',\n 'Maestro',\n 'Star',\n 'Pulse',\n 'Accel',\n 'Nyce'\n ]\n },\n customer_acceptance: {\n type: 'object',\n description: 'This \"CustomerAcceptance\" object is passed during Payments-Confirm request, it enlists the type, time, and mode of acceptance properties related to an acceptance done by the customer. The customer_acceptance sub object is usually passed by the SDK or client.',\n properties: {\n acceptance_type: {\n type: 'string',\n description: 'This is used to indicate if the mandate was accepted online or offline',\n enum: [ 'online',\n 'offline'\n ]\n },\n accepted_at: {\n type: 'string',\n description: 'Specifying when the customer acceptance was provided',\n format: 'date-time'\n },\n online: {\n type: 'object',\n description: 'Details of online mandate',\n properties: {\n ip_address: {\n type: 'string',\n description: 'Ip address of the customer machine from which the mandate was created'\n },\n user_agent: {\n type: 'string',\n description: 'The user-agent of the customer\\'s browser'\n }\n },\n required: [ 'ip_address',\n 'user_agent'\n ]\n }\n },\n required: [ 'acceptance_type'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { mandate_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['mandate_id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { mandate_id, ...body } = args as any; - return asTextContentResult(await client.mandates.retrieve(mandate_id)); + const { mandate_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.mandates.retrieve(mandate_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/mandates/revoke-mandates.ts b/packages/mcp-server/src/tools/mandates/revoke-mandates.ts index d0f355c..6540882 100644 --- a/packages/mcp-server/src/tools/mandates/revoke-mandates.ts +++ b/packages/mcp-server/src/tools/mandates/revoke-mandates.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,29 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'revoke_mandates', - description: 'Revokes a mandate created using the Payments/Create API', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRevokes a mandate created using the Payments/Create API\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n mandate_id: {\n type: 'string',\n description: 'The identifier for mandate'\n },\n status: {\n $ref: '#/$defs/mandate_status'\n },\n error_code: {\n type: 'string',\n description: 'If there was an error while calling the connectors the code is received here'\n },\n error_message: {\n type: 'string',\n description: 'If there was an error while calling the connector the error message is received here'\n }\n },\n required: [ 'mandate_id',\n 'status'\n ],\n $defs: {\n mandate_status: {\n type: 'string',\n description: 'The status of the mandate, which indicates whether it can be used to initiate a payment.',\n enum: [ 'active',\n 'inactive',\n 'pending',\n 'revoked'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { mandate_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['mandate_id'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { mandate_id, ...body } = args as any; - return asTextContentResult(await client.mandates.revoke(mandate_id)); + const { mandate_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.mandates.revoke(mandate_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/organization/create-organization.ts b/packages/mcp-server/src/tools/organization/create-organization.ts index bb15b92..e221134 100644 --- a/packages/mcp-server/src/tools/organization/create-organization.ts +++ b/packages/mcp-server/src/tools/organization/create-organization.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_organization', - description: 'Create a new organization', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nCreate a new organization\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/organization_response',\n $defs: {\n organization_response: {\n type: 'object',\n properties: {\n created_at: {\n type: 'string',\n format: 'date-time'\n },\n modified_at: {\n type: 'string',\n format: 'date-time'\n },\n organization_id: {\n type: 'string',\n description: 'The unique identifier for the Organization'\n },\n metadata: {\n type: 'object',\n description: 'Metadata is useful for storing additional, unstructured information on an object.',\n additionalProperties: true\n },\n organization_details: {\n type: 'object',\n description: 'Details about the organization',\n additionalProperties: true\n },\n organization_name: {\n type: 'string',\n description: 'Name of the Organization'\n }\n },\n required: [ 'created_at',\n 'modified_at',\n 'organization_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -28,18 +29,28 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, organization_details: { type: 'object', description: 'Details about the organization', + additionalProperties: true, + }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', }, }, + required: ['organization_name'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.organization.create(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.organization.create(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/organization/retrieve-organization.ts b/packages/mcp-server/src/tools/organization/retrieve-organization.ts index 45faea2..2bfc5d6 100644 --- a/packages/mcp-server/src/tools/organization/retrieve-organization.ts +++ b/packages/mcp-server/src/tools/organization/retrieve-organization.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,31 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_organization', - description: 'Retrieve an existing organization', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieve an existing organization\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/organization_response',\n $defs: {\n organization_response: {\n type: 'object',\n properties: {\n created_at: {\n type: 'string',\n format: 'date-time'\n },\n modified_at: {\n type: 'string',\n format: 'date-time'\n },\n organization_id: {\n type: 'string',\n description: 'The unique identifier for the Organization'\n },\n metadata: {\n type: 'object',\n description: 'Metadata is useful for storing additional, unstructured information on an object.',\n additionalProperties: true\n },\n organization_details: {\n type: 'object',\n description: 'Details about the organization',\n additionalProperties: true\n },\n organization_name: {\n type: 'string',\n description: 'Name of the Organization'\n }\n },\n required: [ 'created_at',\n 'modified_at',\n 'organization_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { id, ...body } = args as any; - return asTextContentResult(await client.organization.retrieve(id)); + const { id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.organization.retrieve(id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/organization/update-organization.ts b/packages/mcp-server/src/tools/organization/update-organization.ts index 28b985c..93267ed 100644 --- a/packages/mcp-server/src/tools/organization/update-organization.ts +++ b/packages/mcp-server/src/tools/organization/update-organization.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_organization', - description: 'Create a new organization for .', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nCreate a new organization for .\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/organization_response',\n $defs: {\n organization_response: {\n type: 'object',\n properties: {\n created_at: {\n type: 'string',\n format: 'date-time'\n },\n modified_at: {\n type: 'string',\n format: 'date-time'\n },\n organization_id: {\n type: 'string',\n description: 'The unique identifier for the Organization'\n },\n metadata: {\n type: 'object',\n description: 'Metadata is useful for storing additional, unstructured information on an object.',\n additionalProperties: true\n },\n organization_details: {\n type: 'object',\n description: 'Details about the organization',\n additionalProperties: true\n },\n organization_name: {\n type: 'string',\n description: 'Name of the Organization'\n }\n },\n required: [ 'created_at',\n 'modified_at',\n 'organization_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -31,22 +32,34 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, organization_details: { type: 'object', description: 'Details about the organization', + additionalProperties: true, }, organization_name: { type: 'string', description: 'Name of the organization', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['id', 'platform_merchant_id'], + }, + annotations: { + idempotentHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { id, ...body } = args as any; - return asTextContentResult(await client.organization.update(id, body)); + const { id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.organization.update(id, body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/payment-link/retrieve-payment-link.ts b/packages/mcp-server/src/tools/payment-link/retrieve-payment-link.ts index e25fc3c..61125bc 100644 --- a/packages/mcp-server/src/tools/payment-link/retrieve-payment-link.ts +++ b/packages/mcp-server/src/tools/payment-link/retrieve-payment-link.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_payment_link', description: - 'To retrieve the properties of a Payment Link. This may be used to get the status of a previously initiated payment or next action for an ongoing payment', + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nTo retrieve the properties of a Payment Link. This may be used to get the status of a previously initiated payment or next action for an ongoing payment\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n amount: {\n type: 'integer',\n description: 'The payment amount. Amount for the payment in the lowest denomination of the currency'\n },\n created_at: {\n type: 'string',\n description: 'Date and time of Payment Link creation',\n format: 'date-time'\n },\n link_to_pay: {\n type: 'string',\n description: 'Open payment link (without any security checks and listing SPMs)'\n },\n merchant_id: {\n type: 'string',\n description: 'Identifier for Merchant'\n },\n payment_link_id: {\n type: 'string',\n description: 'Identifier for Payment Link'\n },\n status: {\n type: 'string',\n description: 'Status Of the Payment Link',\n enum: [ 'active',\n 'expired'\n ]\n },\n currency: {\n $ref: '#/$defs/currency'\n },\n description: {\n type: 'string',\n description: 'Description for Payment Link'\n },\n expiry: {\n type: 'string',\n description: 'Date and time of Expiration for Payment Link',\n format: 'date-time'\n },\n secure_link: {\n type: 'string',\n description: 'Secure payment link (with security checks and listing saved payment methods)'\n }\n },\n required: [ 'amount',\n 'created_at',\n 'link_to_pay',\n 'merchant_id',\n 'payment_link_id',\n 'status'\n ],\n $defs: {\n currency: {\n type: 'string',\n description: 'The three-letter ISO 4217 currency code (e.g., \"USD\", \"EUR\") for the payment amount. This field is mandatory for creating a payment.',\n enum: [ 'AED',\n 'AFN',\n 'ALL',\n 'AMD',\n 'ANG',\n 'AOA',\n 'ARS',\n 'AUD',\n 'AWG',\n 'AZN',\n 'BAM',\n 'BBD',\n 'BDT',\n 'BGN',\n 'BHD',\n 'BIF',\n 'BMD',\n 'BND',\n 'BOB',\n 'BRL',\n 'BSD',\n 'BTN',\n 'BWP',\n 'BYN',\n 'BZD',\n 'CAD',\n 'CDF',\n 'CHF',\n 'CLF',\n 'CLP',\n 'CNY',\n 'COP',\n 'CRC',\n 'CUC',\n 'CUP',\n 'CVE',\n 'CZK',\n 'DJF',\n 'DKK',\n 'DOP',\n 'DZD',\n 'EGP',\n 'ERN',\n 'ETB',\n 'EUR',\n 'FJD',\n 'FKP',\n 'GBP',\n 'GEL',\n 'GHS',\n 'GIP',\n 'GMD',\n 'GNF',\n 'GTQ',\n 'GYD',\n 'HKD',\n 'HNL',\n 'HRK',\n 'HTG',\n 'HUF',\n 'IDR',\n 'ILS',\n 'INR',\n 'IQD',\n 'IRR',\n 'ISK',\n 'JMD',\n 'JOD',\n 'JPY',\n 'KES',\n 'KGS',\n 'KHR',\n 'KMF',\n 'KPW',\n 'KRW',\n 'KWD',\n 'KYD',\n 'KZT',\n 'LAK',\n 'LBP',\n 'LKR',\n 'LRD',\n 'LSL',\n 'LYD',\n 'MAD',\n 'MDL',\n 'MGA',\n 'MKD',\n 'MMK',\n 'MNT',\n 'MOP',\n 'MRU',\n 'MUR',\n 'MVR',\n 'MWK',\n 'MXN',\n 'MYR',\n 'MZN',\n 'NAD',\n 'NGN',\n 'NIO',\n 'NOK',\n 'NPR',\n 'NZD',\n 'OMR',\n 'PAB',\n 'PEN',\n 'PGK',\n 'PHP',\n 'PKR',\n 'PLN',\n 'PYG',\n 'QAR',\n 'RON',\n 'RSD',\n 'RUB',\n 'RWF',\n 'SAR',\n 'SBD',\n 'SCR',\n 'SDG',\n 'SEK',\n 'SGD',\n 'SHP',\n 'SLE',\n 'SLL',\n 'SOS',\n 'SRD',\n 'SSP',\n 'STD',\n 'STN',\n 'SVC',\n 'SYP',\n 'SZL',\n 'THB',\n 'TJS',\n 'TMT',\n 'TND',\n 'TOP',\n 'TRY',\n 'TTD',\n 'TWD',\n 'TZS',\n 'UAH',\n 'UGX',\n 'USD',\n 'UYU',\n 'UZS',\n 'VES',\n 'VND',\n 'VUV',\n 'WST',\n 'XAF',\n 'XCD',\n 'XOF',\n 'XPF',\n 'YER',\n 'ZAR',\n 'ZMW',\n 'ZWL'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -30,13 +30,25 @@ export const tool: Tool = { description: 'This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['payment_link_id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { payment_link_id, ...body } = args as any; - return asTextContentResult(await client.paymentLink.retrieve(payment_link_id, body)); + const { payment_link_id, jq_filter, ...body } = args as any; + return asTextContentResult( + await maybeFilter(jq_filter, await client.paymentLink.retrieve(payment_link_id, body)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/payment-methods/create-payment-methods.ts b/packages/mcp-server/src/tools/payment-methods/create-payment-methods.ts index ea75a5d..7f6bcf4 100644 --- a/packages/mcp-server/src/tools/payment-methods/create-payment-methods.ts +++ b/packages/mcp-server/src/tools/payment-methods/create-payment-methods.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -69,6 +68,7 @@ export const tool: Tool = { type: 'object', description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.', + additionalProperties: true, }, payment_method_data: { type: 'object', @@ -93,6 +93,7 @@ export const tool: Tool = { $ref: '#/$defs/wallet', }, }, + required: ['payment_method'], $defs: { bank: { anyOf: [ @@ -477,10 +478,8 @@ export const tool: Tool = { description: 'The contact number', }, }, - required: [], }, }, - required: [], }, address_details: { type: 'object', @@ -523,7 +522,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, card_detail: { type: 'object', @@ -756,6 +754,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payment-methods/delete-payment-methods.ts b/packages/mcp-server/src/tools/payment-methods/delete-payment-methods.ts index 5d44377..ad49b1d 100644 --- a/packages/mcp-server/src/tools/payment-methods/delete-payment-methods.ts +++ b/packages/mcp-server/src/tools/payment-methods/delete-payment-methods.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,31 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'delete_payment_methods', - description: 'Deletes a payment method of a customer.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nDeletes a payment method of a customer.\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n deleted: {\n type: 'boolean',\n description: 'Whether payment method was deleted or not'\n },\n payment_method_id: {\n type: 'string',\n description: 'The unique identifier of the Payment method'\n }\n },\n required: [ 'deleted',\n 'payment_method_id'\n ]\n}\n```", inputSchema: { type: 'object', properties: { method_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['method_id'], + }, + annotations: { + idempotentHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { method_id, ...body } = args as any; - return asTextContentResult(await client.paymentMethods.delete(method_id)); + const { method_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.paymentMethods.delete(method_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/payment-methods/retrieve-payment-methods.ts b/packages/mcp-server/src/tools/payment-methods/retrieve-payment-methods.ts index 433160f..c23847c 100644 --- a/packages/mcp-server/src/tools/payment-methods/retrieve-payment-methods.ts +++ b/packages/mcp-server/src/tools/payment-methods/retrieve-payment-methods.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -25,6 +24,10 @@ export const tool: Tool = { type: 'string', }, }, + required: ['method_id'], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/payment-methods/set-default-payment-methods.ts b/packages/mcp-server/src/tools/payment-methods/set-default-payment-methods.ts index 17187a0..c7479cc 100644 --- a/packages/mcp-server/src/tools/payment-methods/set-default-payment-methods.ts +++ b/packages/mcp-server/src/tools/payment-methods/set-default-payment-methods.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'set_default_payment_methods', - description: 'Set the Payment Method as Default for the Customer.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nSet the Payment Method as Default for the Customer.\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n customer_id: {\n type: 'string',\n description: 'The unique identifier of the customer.'\n },\n payment_method: {\n type: 'string',\n description: 'Indicates the type of payment method. Eg: \\'card\\', \\'wallet\\', etc.',\n enum: [ 'card',\n 'card_redirect',\n 'pay_later',\n 'wallet',\n 'bank_redirect',\n 'bank_transfer',\n 'crypto',\n 'bank_debit',\n 'reward',\n 'real_time_payment',\n 'upi',\n 'voucher',\n 'gift_card',\n 'open_banking',\n 'mobile_payment'\n ]\n },\n default_payment_method_id: {\n type: 'string',\n description: 'The unique identifier of the Payment method'\n },\n payment_method_type: {\n $ref: '#/$defs/payment_method_type'\n }\n },\n required: [ 'customer_id',\n 'payment_method'\n ],\n $defs: {\n payment_method_type: {\n type: 'string',\n description: 'Indicates the sub type of payment method. Eg: \\'google_pay\\' & \\'apple_pay\\' for wallets.',\n enum: [ 'ach',\n 'affirm',\n 'afterpay_clearpay',\n 'alfamart',\n 'ali_pay',\n 'ali_pay_hk',\n 'alma',\n 'amazon_pay',\n 'apple_pay',\n 'atome',\n 'bacs',\n 'bancontact_card',\n 'becs',\n 'benefit',\n 'bizum',\n 'blik',\n 'boleto',\n 'bca_bank_transfer',\n 'bni_va',\n 'bri_va',\n 'card_redirect',\n 'cimb_va',\n 'classic',\n 'credit',\n 'crypto_currency',\n 'cashapp',\n 'dana',\n 'danamon_va',\n 'debit',\n 'duit_now',\n 'efecty',\n 'eft',\n 'eps',\n 'fps',\n 'evoucher',\n 'giropay',\n 'givex',\n 'google_pay',\n 'go_pay',\n 'gcash',\n 'ideal',\n 'interac',\n 'indomaret',\n 'klarna',\n 'kakao_pay',\n 'local_bank_redirect',\n 'mandiri_va',\n 'knet',\n 'mb_way',\n 'mobile_pay',\n 'momo',\n 'momo_atm',\n 'multibanco',\n 'online_banking_thailand',\n 'online_banking_czech_republic',\n 'online_banking_finland',\n 'online_banking_fpx',\n 'online_banking_poland',\n 'online_banking_slovakia',\n 'oxxo',\n 'pago_efectivo',\n 'permata_bank_transfer',\n 'open_banking_uk',\n 'pay_bright',\n 'paypal',\n 'paze',\n 'pix',\n 'pay_safe_card',\n 'przelewy24',\n 'prompt_pay',\n 'pse',\n 'red_compra',\n 'red_pagos',\n 'samsung_pay',\n 'sepa',\n 'sepa_bank_transfer',\n 'sofort',\n 'swish',\n 'touch_n_go',\n 'trustly',\n 'twint',\n 'upi_collect',\n 'upi_intent',\n 'vipps',\n 'viet_qr',\n 'venmo',\n 'walley',\n 'we_chat_pay',\n 'seven_eleven',\n 'lawson',\n 'mini_stop',\n 'family_mart',\n 'seicomart',\n 'pay_easy',\n 'local_bank_transfer',\n 'mifinity',\n 'open_banking_pis',\n 'direct_carrier_billing',\n 'instant_bank_transfer',\n 'instant_bank_transfer_finland',\n 'instant_bank_transfer_poland',\n 'revolut_pay'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -27,13 +28,23 @@ export const tool: Tool = { payment_method_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['customer_id', 'payment_method_id'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { payment_method_id, ...body } = args as any; - return asTextContentResult(await client.paymentMethods.setDefault(payment_method_id, body)); + const { payment_method_id, jq_filter, ...body } = args as any; + return asTextContentResult( + await maybeFilter(jq_filter, await client.paymentMethods.setDefault(payment_method_id, body)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/payment-methods/update-payment-methods.ts b/packages/mcp-server/src/tools/payment-methods/update-payment-methods.ts index e9ab347..8ef85ee 100644 --- a/packages/mcp-server/src/tools/payment-methods/update-payment-methods.ts +++ b/packages/mcp-server/src/tools/payment-methods/update-payment-methods.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -53,7 +52,9 @@ export const tool: Tool = { 'This is a 15 minute expiry token which shall be used from the client to authenticate and perform sessions from the SDK', }, }, + required: ['method_id'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payments/cancel-payments.ts b/packages/mcp-server/src/tools/payments/cancel-payments.ts index 82a57d0..b0d5fc8 100644 --- a/packages/mcp-server/src/tools/payments/cancel-payments.ts +++ b/packages/mcp-server/src/tools/payments/cancel-payments.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -33,6 +32,7 @@ export const tool: Tool = { $ref: '#/$defs/merchant_connector_details_wrap', }, }, + required: ['payment_id'], $defs: { merchant_connector_details_wrap: { type: 'object', @@ -56,16 +56,18 @@ export const tool: Tool = { type: 'object', description: 'Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.', + additionalProperties: true, }, metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, }, - required: [], }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payments/capture-payments.ts b/packages/mcp-server/src/tools/payments/capture-payments.ts index 15b509e..ad9a534 100644 --- a/packages/mcp-server/src/tools/payments/capture-payments.ts +++ b/packages/mcp-server/src/tools/payments/capture-payments.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -53,6 +52,7 @@ export const tool: Tool = { "A dynamic suffix that appears on your customer's credit card statement. This is concatenated with the (shortened) descriptor prefix set on your account to form the complete statement descriptor. The combined length should not exceed connector-specific limits (typically 22 characters).", }, }, + required: ['payment_id'], $defs: { merchant_connector_details_wrap: { type: 'object', @@ -76,16 +76,18 @@ export const tool: Tool = { type: 'object', description: 'Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.', + additionalProperties: true, }, metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, }, - required: [], }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payments/complete-authorize-payments.ts b/packages/mcp-server/src/tools/payments/complete-authorize-payments.ts index 296cc0c..a7ea90d 100644 --- a/packages/mcp-server/src/tools/payments/complete-authorize-payments.ts +++ b/packages/mcp-server/src/tools/payments/complete-authorize-payments.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -35,6 +34,7 @@ export const tool: Tool = { $ref: '#/$defs/three_ds_completion_indicator', }, }, + required: ['payment_id', 'client_secret'], $defs: { address: { type: 'object', @@ -57,10 +57,8 @@ export const tool: Tool = { description: 'The contact number', }, }, - required: [], }, }, - required: [], }, address_details: { type: 'object', @@ -103,7 +101,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, country_alpha2: { type: 'string', @@ -366,6 +363,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payments/confirm-payments.ts b/packages/mcp-server/src/tools/payments/confirm-payments.ts index 0a38280..4f2d1b0 100644 --- a/packages/mcp-server/src/tools/payments/confirm-payments.ts +++ b/packages/mcp-server/src/tools/payments/confirm-payments.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -22,10 +21,8 @@ export const tool: Tool = { inputSchema: { type: 'object', properties: { - payment_id: { + path_payment_id: { type: 'string', - description: - 'Optional. A merchant-provided unique identifier for the payment, contains 30 characters long (e.g., "pay_mbabizu24mvu3mela5njyhpit4"). If provided, it ensures idempotency for the payment creation request. If omitted, Hyperswitch generates a unique ID for the payment.', }, all_keys_required: { type: 'boolean', @@ -108,6 +105,7 @@ export const tool: Tool = { frm_metadata: { type: 'object', description: 'Additional data related to some frm(Fraud Risk Management) connectors', + additionalProperties: true, }, is_iframe_redirection_enabled: { type: 'boolean', @@ -133,6 +131,7 @@ export const tool: Tool = { type: 'object', description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.', + additionalProperties: true, }, off_session: { type: 'boolean', @@ -154,6 +153,11 @@ export const tool: Tool = { payment_experience: { $ref: '#/$defs/payment_experience', }, + body_payment_id: { + type: 'string', + description: + 'Optional. A merchant-provided unique identifier for the payment, contains 30 characters long (e.g., "pay_mbabizu24mvu3mela5njyhpit4"). If provided, it ensures idempotency for the payment creation request. If omitted, Hyperswitch generates a unique ID for the payment.', + }, payment_link: { type: 'boolean', description: 'Whether to generate the payment link for this payment or not (if applicable)', @@ -269,6 +273,7 @@ export const tool: Tool = { $ref: '#/$defs/three_ds_completion_indicator', }, }, + required: ['path_payment_id'], $defs: { payment_method_type: { type: 'string', @@ -405,10 +410,8 @@ export const tool: Tool = { description: 'The contact number', }, }, - required: [], }, }, - required: [], }, address_details: { type: 'object', @@ -451,7 +454,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, country_alpha2: { type: 'string', @@ -764,7 +766,6 @@ export const tool: Tool = { description: 'User-agent of the browser', }, }, - required: [], }, capture_method: { type: 'string', @@ -914,7 +915,6 @@ export const tool: Tool = { description: 'payload required by airwallex', }, }, - required: [], }, apple_pay: { type: 'object', @@ -998,7 +998,6 @@ export const tool: Tool = { ], }, }, - required: [], }, braintree: { type: 'object', @@ -1025,10 +1024,8 @@ export const tool: Tool = { 'Information about the order category that merchant wants to specify at connector level. (e.g. In Noon Payments it can take values like "pay", "food", or any other custom string set by the merchant in Noon\'s Dashboard)', }, }, - required: [], }, }, - required: [], }, ctp_service_details: { type: 'object', @@ -1053,7 +1050,6 @@ export const tool: Tool = { description: 'session transaction flow id', }, }, - required: [], }, ctp_service_provider: { type: 'string', @@ -1303,7 +1299,6 @@ export const tool: Tool = { description: "A way to update the mandate's payment method details", }, }, - required: [], }, mandate_type: { anyOf: [ @@ -1345,6 +1340,7 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Additional details required by mandate', + additionalProperties: true, }, start_date: { type: 'string', @@ -1376,13 +1372,14 @@ export const tool: Tool = { type: 'object', description: 'Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.', + additionalProperties: true, }, metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, }, - required: [], }, order_details_with_amount: { type: 'object', @@ -1585,6 +1582,7 @@ export const tool: Tool = { payment_link_ui_rules: { type: 'object', description: 'Payment link configuration rules', + additionalProperties: true, }, sdk_layout: { type: 'string', @@ -1593,6 +1591,7 @@ export const tool: Tool = { sdk_ui_rules: { type: 'object', description: 'SDK configuration rules', + additionalProperties: true, }, seller_name: { type: 'string', @@ -1644,14 +1643,12 @@ export const tool: Tool = { description: 'Position of the key-value pair in the UI', }, }, - required: [], }, }, required: ['key', 'value'], }, }, }, - required: [], }, payment_method_data_request: { anyOf: [ @@ -1735,6 +1732,7 @@ export const tool: Tool = { properties: { ali_pay_qr: { type: 'object', + additionalProperties: true, }, }, required: ['ali_pay_qr'], @@ -1744,6 +1742,7 @@ export const tool: Tool = { properties: { ali_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['ali_pay_redirect'], @@ -1753,6 +1752,7 @@ export const tool: Tool = { properties: { ali_pay_hk_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['ali_pay_hk_redirect'], @@ -1762,6 +1762,7 @@ export const tool: Tool = { properties: { amazon_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['amazon_pay_redirect'], @@ -1771,6 +1772,7 @@ export const tool: Tool = { properties: { momo_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['momo_redirect'], @@ -1780,6 +1782,7 @@ export const tool: Tool = { properties: { kakao_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['kakao_pay_redirect'], @@ -1789,6 +1792,7 @@ export const tool: Tool = { properties: { go_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['go_pay_redirect'], @@ -1798,6 +1802,7 @@ export const tool: Tool = { properties: { gcash_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['gcash_redirect'], @@ -1845,6 +1850,7 @@ export const tool: Tool = { properties: { apple_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['apple_pay_redirect'], @@ -1854,6 +1860,7 @@ export const tool: Tool = { properties: { apple_pay_third_party_sdk: { type: 'object', + additionalProperties: true, }, }, required: ['apple_pay_third_party_sdk'], @@ -1864,6 +1871,7 @@ export const tool: Tool = { dana_redirect: { type: 'object', description: 'Wallet data for DANA redirect flow', + additionalProperties: true, }, }, required: ['dana_redirect'], @@ -1938,6 +1946,7 @@ export const tool: Tool = { properties: { google_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['google_pay_redirect'], @@ -1947,6 +1956,7 @@ export const tool: Tool = { properties: { google_pay_third_party_sdk: { type: 'object', + additionalProperties: true, }, }, required: ['google_pay_third_party_sdk'], @@ -1973,6 +1983,7 @@ export const tool: Tool = { properties: { mobile_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['mobile_pay_redirect'], @@ -1988,7 +1999,6 @@ export const tool: Tool = { description: "paypal's email address", }, }, - required: [], }, }, required: ['paypal_redirect'], @@ -2112,6 +2122,7 @@ export const tool: Tool = { twint_redirect: { type: 'object', description: 'Wallet data for Twint Redirection', + additionalProperties: true, }, }, required: ['twint_redirect'], @@ -2122,6 +2133,7 @@ export const tool: Tool = { vipps_redirect: { type: 'object', description: 'Wallet data for Vipps Redirection', + additionalProperties: true, }, }, required: ['vipps_redirect'], @@ -2131,6 +2143,7 @@ export const tool: Tool = { properties: { touch_n_go_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['touch_n_go_redirect'], @@ -2140,6 +2153,7 @@ export const tool: Tool = { properties: { we_chat_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['we_chat_pay_redirect'], @@ -2149,6 +2163,7 @@ export const tool: Tool = { properties: { we_chat_pay_qr: { type: 'object', + additionalProperties: true, }, }, required: ['we_chat_pay_qr'], @@ -2158,6 +2173,7 @@ export const tool: Tool = { properties: { cashapp_qr: { type: 'object', + additionalProperties: true, }, }, required: ['cashapp_qr'], @@ -2167,6 +2183,7 @@ export const tool: Tool = { properties: { swish_qr: { type: 'object', + additionalProperties: true, }, }, required: ['swish_qr'], @@ -2195,6 +2212,7 @@ export const tool: Tool = { properties: { revolut_pay: { type: 'object', + additionalProperties: true, }, }, required: ['revolut_pay'], @@ -2228,7 +2246,6 @@ export const tool: Tool = { description: 'The billing email', }, }, - required: [], }, }, required: ['klarna_redirect'], @@ -2256,6 +2273,7 @@ export const tool: Tool = { affirm_redirect: { type: 'object', description: 'For Affirm redirect as PayLater Option', + additionalProperties: true, }, }, required: ['affirm_redirect'], @@ -2276,7 +2294,6 @@ export const tool: Tool = { description: 'The billing name', }, }, - required: [], }, }, required: ['afterpay_clearpay_redirect'], @@ -2287,6 +2304,7 @@ export const tool: Tool = { pay_bright_redirect: { type: 'object', description: 'For PayBright Redirect as PayLater Option', + additionalProperties: true, }, }, required: ['pay_bright_redirect'], @@ -2297,6 +2315,7 @@ export const tool: Tool = { walley_redirect: { type: 'object', description: 'For WalleyRedirect as PayLater Option', + additionalProperties: true, }, }, required: ['walley_redirect'], @@ -2307,6 +2326,7 @@ export const tool: Tool = { alma_redirect: { type: 'object', description: 'For Alma Redirection as PayLater Option', + additionalProperties: true, }, }, required: ['alma_redirect'], @@ -2316,6 +2336,7 @@ export const tool: Tool = { properties: { atome_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['atome_redirect'], @@ -2370,6 +2391,7 @@ export const tool: Tool = { properties: { bizum: { type: 'object', + additionalProperties: true, }, }, required: ['bizum'], @@ -2384,7 +2406,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['blik'], @@ -2470,7 +2491,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['interac'], @@ -2500,7 +2520,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['online_banking_finland'], @@ -2566,7 +2585,6 @@ export const tool: Tool = { $ref: '#/$defs/bank_redirect_billing', }, }, - required: [], }, }, required: ['przelewy24'], @@ -2643,6 +2661,7 @@ export const tool: Tool = { properties: { local_bank_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['local_bank_redirect'], @@ -2829,10 +2848,8 @@ export const tool: Tool = { description: 'The Email ID for ACH billing', }, }, - required: [], }, }, - required: [], }, }, required: ['ach_bank_transfer'], @@ -2865,7 +2882,6 @@ export const tool: Tool = { $ref: '#/$defs/sepa_and_bacs_billing_details', }, }, - required: [], }, }, required: ['bacs_bank_transfer'], @@ -2883,10 +2899,8 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, - required: [], }, }, required: ['multibanco_bank_transfer'], @@ -2901,7 +2915,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['permata_bank_transfer'], @@ -2916,7 +2929,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['bca_bank_transfer'], @@ -2931,7 +2943,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['bni_va_bank_transfer'], @@ -2946,7 +2957,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['bri_va_bank_transfer'], @@ -2961,7 +2971,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['cimb_va_bank_transfer'], @@ -2976,7 +2985,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['danamon_va_bank_transfer'], @@ -2991,7 +2999,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['mandiri_va_bank_transfer'], @@ -3023,7 +3030,6 @@ export const tool: Tool = { description: 'Source bank account number', }, }, - required: [], }, }, required: ['pix'], @@ -3033,6 +3039,7 @@ export const tool: Tool = { properties: { pse: { type: 'object', + additionalProperties: true, }, }, required: ['pse'], @@ -3047,7 +3054,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['local_bank_transfer'], @@ -3057,6 +3063,7 @@ export const tool: Tool = { properties: { instant_bank_transfer: { type: 'object', + additionalProperties: true, }, }, required: ['instant_bank_transfer'], @@ -3066,6 +3073,7 @@ export const tool: Tool = { properties: { instant_bank_transfer_finland: { type: 'object', + additionalProperties: true, }, }, required: ['instant_bank_transfer_finland'], @@ -3075,6 +3083,7 @@ export const tool: Tool = { properties: { instant_bank_transfer_poland: { type: 'object', + additionalProperties: true, }, }, required: ['instant_bank_transfer_poland'], @@ -3121,7 +3130,6 @@ export const tool: Tool = { $ref: '#/$defs/address', }, }, - required: [], }, { type: 'object', @@ -3131,7 +3139,6 @@ export const tool: Tool = { $ref: '#/$defs/address', }, }, - required: [], }, { type: 'object', @@ -3149,7 +3156,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['upi_collect'], @@ -3159,6 +3165,7 @@ export const tool: Tool = { properties: { upi_intent: { type: 'object', + additionalProperties: true, }, }, required: ['upi_intent'], @@ -3215,6 +3222,7 @@ export const tool: Tool = { properties: { pay_safe_card: { type: 'object', + additionalProperties: true, }, }, required: ['pay_safe_card'], @@ -3308,6 +3316,7 @@ export const tool: Tool = { properties: { knet: { type: 'object', + additionalProperties: true, }, }, required: ['knet'], @@ -3317,6 +3326,7 @@ export const tool: Tool = { properties: { benefit: { type: 'object', + additionalProperties: true, }, }, required: ['benefit'], @@ -3326,6 +3336,7 @@ export const tool: Tool = { properties: { momo_atm: { type: 'object', + additionalProperties: true, }, }, required: ['momo_atm'], @@ -3335,6 +3346,7 @@ export const tool: Tool = { properties: { card_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['card_redirect'], @@ -3544,7 +3556,6 @@ export const tool: Tool = { description: 'The billing name for bank debits', }, }, - required: [], }, sepa_and_bacs_billing_details: { type: 'object', @@ -3558,7 +3569,6 @@ export const tool: Tool = { description: 'The billing name for SEPA and BACS billing', }, }, - required: [], }, doku_billing_details: { type: 'object', @@ -3576,7 +3586,6 @@ export const tool: Tool = { description: 'The billing second name for Doku', }, }, - required: [], }, real_time_payment_data: { anyOf: [ @@ -3585,6 +3594,7 @@ export const tool: Tool = { properties: { fps: { type: 'object', + additionalProperties: true, }, }, required: ['fps'], @@ -3594,6 +3604,7 @@ export const tool: Tool = { properties: { duit_now: { type: 'object', + additionalProperties: true, }, }, required: ['duit_now'], @@ -3603,6 +3614,7 @@ export const tool: Tool = { properties: { prompt_pay: { type: 'object', + additionalProperties: true, }, }, required: ['prompt_pay'], @@ -3612,6 +3624,7 @@ export const tool: Tool = { properties: { viet_qr: { type: 'object', + additionalProperties: true, }, }, required: ['viet_qr'], @@ -3628,7 +3641,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, voucher_data: { anyOf: [ @@ -3647,7 +3659,6 @@ export const tool: Tool = { description: "The shopper's social security number", }, }, - required: [], }, }, required: ['boleto'], @@ -3671,7 +3682,6 @@ export const tool: Tool = { description: 'The billing second name for Alfamart', }, }, - required: [], }, }, required: ['alfamart'], @@ -3695,7 +3705,6 @@ export const tool: Tool = { description: 'The billing second name for Alfamart', }, }, - required: [], }, }, required: ['indomaret'], @@ -3776,13 +3785,13 @@ export const tool: Tool = { description: 'The telephone number for Japanese convenience stores', }, }, - required: [], }, open_banking_data: { type: 'object', properties: { open_banking_pis: { type: 'object', + additionalProperties: true, }, }, required: ['open_banking_pis'], @@ -4332,6 +4341,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payments/create-payments.ts b/packages/mcp-server/src/tools/payments/create-payments.ts index debdadf..2d8cd21 100644 --- a/packages/mcp-server/src/tools/payments/create-payments.ts +++ b/packages/mcp-server/src/tools/payments/create-payments.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -107,6 +106,7 @@ export const tool: Tool = { frm_metadata: { type: 'object', description: 'Additional data related to some frm(Fraud Risk Management) connectors', + additionalProperties: true, }, is_iframe_redirection_enabled: { type: 'boolean', @@ -132,6 +132,7 @@ export const tool: Tool = { type: 'object', description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.', + additionalProperties: true, }, off_session: { type: 'boolean', @@ -278,6 +279,7 @@ export const tool: Tool = { $ref: '#/$defs/three_ds_completion_indicator', }, }, + required: ['amount', 'currency'], $defs: { currency: { type: 'string', @@ -581,10 +583,8 @@ export const tool: Tool = { description: 'The contact number', }, }, - required: [], }, }, - required: [], }, address_details: { type: 'object', @@ -627,7 +627,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, country_alpha2: { type: 'string', @@ -940,7 +939,6 @@ export const tool: Tool = { description: 'User-agent of the browser', }, }, - required: [], }, capture_method: { type: 'string', @@ -1090,7 +1088,6 @@ export const tool: Tool = { description: 'payload required by airwallex', }, }, - required: [], }, apple_pay: { type: 'object', @@ -1174,7 +1171,6 @@ export const tool: Tool = { ], }, }, - required: [], }, braintree: { type: 'object', @@ -1201,10 +1197,8 @@ export const tool: Tool = { 'Information about the order category that merchant wants to specify at connector level. (e.g. In Noon Payments it can take values like "pay", "food", or any other custom string set by the merchant in Noon\'s Dashboard)', }, }, - required: [], }, }, - required: [], }, ctp_service_details: { type: 'object', @@ -1229,7 +1223,6 @@ export const tool: Tool = { description: 'session transaction flow id', }, }, - required: [], }, ctp_service_provider: { type: 'string', @@ -1312,7 +1305,6 @@ export const tool: Tool = { description: "A way to update the mandate's payment method details", }, }, - required: [], }, mandate_type: { anyOf: [ @@ -1354,6 +1346,7 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Additional details required by mandate', + additionalProperties: true, }, start_date: { type: 'string', @@ -1385,13 +1378,14 @@ export const tool: Tool = { type: 'object', description: 'Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.', + additionalProperties: true, }, metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, }, - required: [], }, order_details_with_amount: { type: 'object', @@ -1594,6 +1588,7 @@ export const tool: Tool = { payment_link_ui_rules: { type: 'object', description: 'Payment link configuration rules', + additionalProperties: true, }, sdk_layout: { type: 'string', @@ -1602,6 +1597,7 @@ export const tool: Tool = { sdk_ui_rules: { type: 'object', description: 'SDK configuration rules', + additionalProperties: true, }, seller_name: { type: 'string', @@ -1653,14 +1649,12 @@ export const tool: Tool = { description: 'Position of the key-value pair in the UI', }, }, - required: [], }, }, required: ['key', 'value'], }, }, }, - required: [], }, payment_method_data_request: { anyOf: [ @@ -1744,6 +1738,7 @@ export const tool: Tool = { properties: { ali_pay_qr: { type: 'object', + additionalProperties: true, }, }, required: ['ali_pay_qr'], @@ -1753,6 +1748,7 @@ export const tool: Tool = { properties: { ali_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['ali_pay_redirect'], @@ -1762,6 +1758,7 @@ export const tool: Tool = { properties: { ali_pay_hk_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['ali_pay_hk_redirect'], @@ -1771,6 +1768,7 @@ export const tool: Tool = { properties: { amazon_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['amazon_pay_redirect'], @@ -1780,6 +1778,7 @@ export const tool: Tool = { properties: { momo_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['momo_redirect'], @@ -1789,6 +1788,7 @@ export const tool: Tool = { properties: { kakao_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['kakao_pay_redirect'], @@ -1798,6 +1798,7 @@ export const tool: Tool = { properties: { go_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['go_pay_redirect'], @@ -1807,6 +1808,7 @@ export const tool: Tool = { properties: { gcash_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['gcash_redirect'], @@ -1854,6 +1856,7 @@ export const tool: Tool = { properties: { apple_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['apple_pay_redirect'], @@ -1863,6 +1866,7 @@ export const tool: Tool = { properties: { apple_pay_third_party_sdk: { type: 'object', + additionalProperties: true, }, }, required: ['apple_pay_third_party_sdk'], @@ -1873,6 +1877,7 @@ export const tool: Tool = { dana_redirect: { type: 'object', description: 'Wallet data for DANA redirect flow', + additionalProperties: true, }, }, required: ['dana_redirect'], @@ -1947,6 +1952,7 @@ export const tool: Tool = { properties: { google_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['google_pay_redirect'], @@ -1956,6 +1962,7 @@ export const tool: Tool = { properties: { google_pay_third_party_sdk: { type: 'object', + additionalProperties: true, }, }, required: ['google_pay_third_party_sdk'], @@ -1982,6 +1989,7 @@ export const tool: Tool = { properties: { mobile_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['mobile_pay_redirect'], @@ -1997,7 +2005,6 @@ export const tool: Tool = { description: "paypal's email address", }, }, - required: [], }, }, required: ['paypal_redirect'], @@ -2121,6 +2128,7 @@ export const tool: Tool = { twint_redirect: { type: 'object', description: 'Wallet data for Twint Redirection', + additionalProperties: true, }, }, required: ['twint_redirect'], @@ -2131,6 +2139,7 @@ export const tool: Tool = { vipps_redirect: { type: 'object', description: 'Wallet data for Vipps Redirection', + additionalProperties: true, }, }, required: ['vipps_redirect'], @@ -2140,6 +2149,7 @@ export const tool: Tool = { properties: { touch_n_go_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['touch_n_go_redirect'], @@ -2149,6 +2159,7 @@ export const tool: Tool = { properties: { we_chat_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['we_chat_pay_redirect'], @@ -2158,6 +2169,7 @@ export const tool: Tool = { properties: { we_chat_pay_qr: { type: 'object', + additionalProperties: true, }, }, required: ['we_chat_pay_qr'], @@ -2167,6 +2179,7 @@ export const tool: Tool = { properties: { cashapp_qr: { type: 'object', + additionalProperties: true, }, }, required: ['cashapp_qr'], @@ -2176,6 +2189,7 @@ export const tool: Tool = { properties: { swish_qr: { type: 'object', + additionalProperties: true, }, }, required: ['swish_qr'], @@ -2204,6 +2218,7 @@ export const tool: Tool = { properties: { revolut_pay: { type: 'object', + additionalProperties: true, }, }, required: ['revolut_pay'], @@ -2237,7 +2252,6 @@ export const tool: Tool = { description: 'The billing email', }, }, - required: [], }, }, required: ['klarna_redirect'], @@ -2265,6 +2279,7 @@ export const tool: Tool = { affirm_redirect: { type: 'object', description: 'For Affirm redirect as PayLater Option', + additionalProperties: true, }, }, required: ['affirm_redirect'], @@ -2285,7 +2300,6 @@ export const tool: Tool = { description: 'The billing name', }, }, - required: [], }, }, required: ['afterpay_clearpay_redirect'], @@ -2296,6 +2310,7 @@ export const tool: Tool = { pay_bright_redirect: { type: 'object', description: 'For PayBright Redirect as PayLater Option', + additionalProperties: true, }, }, required: ['pay_bright_redirect'], @@ -2306,6 +2321,7 @@ export const tool: Tool = { walley_redirect: { type: 'object', description: 'For WalleyRedirect as PayLater Option', + additionalProperties: true, }, }, required: ['walley_redirect'], @@ -2316,6 +2332,7 @@ export const tool: Tool = { alma_redirect: { type: 'object', description: 'For Alma Redirection as PayLater Option', + additionalProperties: true, }, }, required: ['alma_redirect'], @@ -2325,6 +2342,7 @@ export const tool: Tool = { properties: { atome_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['atome_redirect'], @@ -2379,6 +2397,7 @@ export const tool: Tool = { properties: { bizum: { type: 'object', + additionalProperties: true, }, }, required: ['bizum'], @@ -2393,7 +2412,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['blik'], @@ -2479,7 +2497,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['interac'], @@ -2509,7 +2526,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['online_banking_finland'], @@ -2575,7 +2591,6 @@ export const tool: Tool = { $ref: '#/$defs/bank_redirect_billing', }, }, - required: [], }, }, required: ['przelewy24'], @@ -2652,6 +2667,7 @@ export const tool: Tool = { properties: { local_bank_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['local_bank_redirect'], @@ -2838,10 +2854,8 @@ export const tool: Tool = { description: 'The Email ID for ACH billing', }, }, - required: [], }, }, - required: [], }, }, required: ['ach_bank_transfer'], @@ -2874,7 +2888,6 @@ export const tool: Tool = { $ref: '#/$defs/sepa_and_bacs_billing_details', }, }, - required: [], }, }, required: ['bacs_bank_transfer'], @@ -2892,10 +2905,8 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, - required: [], }, }, required: ['multibanco_bank_transfer'], @@ -2910,7 +2921,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['permata_bank_transfer'], @@ -2925,7 +2935,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['bca_bank_transfer'], @@ -2940,7 +2949,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['bni_va_bank_transfer'], @@ -2955,7 +2963,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['bri_va_bank_transfer'], @@ -2970,7 +2977,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['cimb_va_bank_transfer'], @@ -2985,7 +2991,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['danamon_va_bank_transfer'], @@ -3000,7 +3005,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['mandiri_va_bank_transfer'], @@ -3032,7 +3036,6 @@ export const tool: Tool = { description: 'Source bank account number', }, }, - required: [], }, }, required: ['pix'], @@ -3042,6 +3045,7 @@ export const tool: Tool = { properties: { pse: { type: 'object', + additionalProperties: true, }, }, required: ['pse'], @@ -3056,7 +3060,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['local_bank_transfer'], @@ -3066,6 +3069,7 @@ export const tool: Tool = { properties: { instant_bank_transfer: { type: 'object', + additionalProperties: true, }, }, required: ['instant_bank_transfer'], @@ -3075,6 +3079,7 @@ export const tool: Tool = { properties: { instant_bank_transfer_finland: { type: 'object', + additionalProperties: true, }, }, required: ['instant_bank_transfer_finland'], @@ -3084,6 +3089,7 @@ export const tool: Tool = { properties: { instant_bank_transfer_poland: { type: 'object', + additionalProperties: true, }, }, required: ['instant_bank_transfer_poland'], @@ -3130,7 +3136,6 @@ export const tool: Tool = { $ref: '#/$defs/address', }, }, - required: [], }, { type: 'object', @@ -3140,7 +3145,6 @@ export const tool: Tool = { $ref: '#/$defs/address', }, }, - required: [], }, { type: 'object', @@ -3158,7 +3162,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['upi_collect'], @@ -3168,6 +3171,7 @@ export const tool: Tool = { properties: { upi_intent: { type: 'object', + additionalProperties: true, }, }, required: ['upi_intent'], @@ -3224,6 +3228,7 @@ export const tool: Tool = { properties: { pay_safe_card: { type: 'object', + additionalProperties: true, }, }, required: ['pay_safe_card'], @@ -3317,6 +3322,7 @@ export const tool: Tool = { properties: { knet: { type: 'object', + additionalProperties: true, }, }, required: ['knet'], @@ -3326,6 +3332,7 @@ export const tool: Tool = { properties: { benefit: { type: 'object', + additionalProperties: true, }, }, required: ['benefit'], @@ -3335,6 +3342,7 @@ export const tool: Tool = { properties: { momo_atm: { type: 'object', + additionalProperties: true, }, }, required: ['momo_atm'], @@ -3344,6 +3352,7 @@ export const tool: Tool = { properties: { card_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['card_redirect'], @@ -3553,7 +3562,6 @@ export const tool: Tool = { description: 'The billing name for bank debits', }, }, - required: [], }, sepa_and_bacs_billing_details: { type: 'object', @@ -3567,7 +3575,6 @@ export const tool: Tool = { description: 'The billing name for SEPA and BACS billing', }, }, - required: [], }, doku_billing_details: { type: 'object', @@ -3585,7 +3592,6 @@ export const tool: Tool = { description: 'The billing second name for Doku', }, }, - required: [], }, real_time_payment_data: { anyOf: [ @@ -3594,6 +3600,7 @@ export const tool: Tool = { properties: { fps: { type: 'object', + additionalProperties: true, }, }, required: ['fps'], @@ -3603,6 +3610,7 @@ export const tool: Tool = { properties: { duit_now: { type: 'object', + additionalProperties: true, }, }, required: ['duit_now'], @@ -3612,6 +3620,7 @@ export const tool: Tool = { properties: { prompt_pay: { type: 'object', + additionalProperties: true, }, }, required: ['prompt_pay'], @@ -3621,6 +3630,7 @@ export const tool: Tool = { properties: { viet_qr: { type: 'object', + additionalProperties: true, }, }, required: ['viet_qr'], @@ -3637,7 +3647,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, voucher_data: { anyOf: [ @@ -3656,7 +3665,6 @@ export const tool: Tool = { description: "The shopper's social security number", }, }, - required: [], }, }, required: ['boleto'], @@ -3680,7 +3688,6 @@ export const tool: Tool = { description: 'The billing second name for Alfamart', }, }, - required: [], }, }, required: ['alfamart'], @@ -3704,7 +3711,6 @@ export const tool: Tool = { description: 'The billing second name for Alfamart', }, }, - required: [], }, }, required: ['indomaret'], @@ -3785,13 +3791,13 @@ export const tool: Tool = { description: 'The telephone number for Japanese convenience stores', }, }, - required: [], }, open_banking_data: { type: 'object', properties: { open_banking_pis: { type: 'object', + additionalProperties: true, }, }, required: ['open_banking_pis'], @@ -4350,6 +4356,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payments/create-session-token-payments.ts b/packages/mcp-server/src/tools/payments/create-session-token-payments.ts index aeeed37..43908c7 100644 --- a/packages/mcp-server/src/tools/payments/create-session-token-payments.ts +++ b/packages/mcp-server/src/tools/payments/create-session-token-payments.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -42,6 +41,7 @@ export const tool: Tool = { $ref: '#/$defs/merchant_connector_details_wrap', }, }, + required: ['client_secret', 'payment_id', 'wallets'], $defs: { payment_method_type: { type: 'string', @@ -173,16 +173,18 @@ export const tool: Tool = { type: 'object', description: 'Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.', + additionalProperties: true, }, metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, }, - required: [], }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payments/incremental-authorization-payments.ts b/packages/mcp-server/src/tools/payments/incremental-authorization-payments.ts index 1e5980f..3212186 100644 --- a/packages/mcp-server/src/tools/payments/incremental-authorization-payments.ts +++ b/packages/mcp-server/src/tools/payments/incremental-authorization-payments.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -33,7 +32,9 @@ export const tool: Tool = { description: 'Reason for incremental authorization', }, }, + required: ['payment_id', 'amount'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payments/list-payments.ts b/packages/mcp-server/src/tools/payments/list-payments.ts index 20f929f..5d763db 100644 --- a/packages/mcp-server/src/tools/payments/list-payments.ts +++ b/packages/mcp-server/src/tools/payments/list-payments.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -63,6 +62,10 @@ export const tool: Tool = { description: 'A cursor for use in pagination, fetch the next list after some object', }, }, + required: [], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/payments/number-3ds/authenticate-payments-number-3ds.ts b/packages/mcp-server/src/tools/payments/number-3ds/authenticate-payments-number-3ds.ts index f87ba65..f916f63 100644 --- a/packages/mcp-server/src/tools/payments/number-3ds/authenticate-payments-number-3ds.ts +++ b/packages/mcp-server/src/tools/payments/number-3ds/authenticate-payments-number-3ds.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'authenticate_payments_number_3ds', - description: 'External 3DS Authentication is performed and returns the AuthenticationResponse', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nExternal 3DS Authentication is performed and returns the AuthenticationResponse\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n three_ds_requestor_url: {\n type: 'string',\n description: 'Three DS Requestor URL'\n },\n trans_status: {\n type: 'string',\n description: 'Indicates the transaction status',\n enum: [ 'Y',\n 'N',\n 'U',\n 'A',\n 'R',\n 'C',\n 'D',\n 'I'\n ]\n },\n acs_reference_number: {\n type: 'string',\n description: 'Unique identifier assigned by the EMVCo(Europay, Mastercard and Visa)'\n },\n acs_signed_content: {\n type: 'string',\n description: 'Contains the JWS object created by the ACS for the ARes(Authentication Response) message'\n },\n acs_trans_id: {\n type: 'string',\n description: 'Unique identifier assigned by the ACS to identify a single transaction'\n },\n acs_url: {\n type: 'string',\n description: 'Access Server URL to be used for challenge submission'\n },\n challenge_request: {\n type: 'string',\n description: 'Challenge request which should be sent to acs_url'\n },\n three_ds_requestor_app_url: {\n type: 'string',\n description: 'Merchant app declaring their URL within the CReq message so that the Authentication app can call the Merchant app after OOB authentication has occurred'\n },\n three_dsserver_trans_id: {\n type: 'string',\n description: 'Unique identifier assigned by the 3DS Server to identify a single transaction'\n }\n },\n required: [ 'three_ds_requestor_url',\n 'trans_status'\n ]\n}\n```", inputSchema: { type: 'object', properties: { @@ -51,6 +52,7 @@ export const tool: Tool = { sdk_ephem_pub_key: { type: 'object', description: 'Public key component of the ephemeral key pair generated by the 3DS SDK', + additionalProperties: true, }, sdk_max_timeout: { type: 'integer', @@ -80,7 +82,14 @@ export const tool: Tool = { 'sdk_trans_id', ], }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['payment_id', 'client_secret', 'device_channel', 'threeds_method_comp_ind'], $defs: { three_ds_completion_indicator: { type: 'string', @@ -89,11 +98,14 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { payment_id, ...body } = args as any; - return asTextContentResult(await client.payments.number3DS.authenticate(payment_id, body)); + const { payment_id, jq_filter, ...body } = args as any; + return asTextContentResult( + await maybeFilter(jq_filter, await client.payments.number3DS.authenticate(payment_id, body)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/payments/post-session-tokens-payments.ts b/packages/mcp-server/src/tools/payments/post-session-tokens-payments.ts index b8bbf16..3b9e3a1 100644 --- a/packages/mcp-server/src/tools/payments/post-session-tokens-payments.ts +++ b/packages/mcp-server/src/tools/payments/post-session-tokens-payments.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -53,6 +52,7 @@ export const tool: Tool = { $ref: '#/$defs/payment_method_type', }, }, + required: ['payment_id', 'client_secret', 'payment_method', 'payment_method_type'], $defs: { payment_method_type: { type: 'string', @@ -164,6 +164,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payments/retrieve-payments.ts b/packages/mcp-server/src/tools/payments/retrieve-payments.ts index 147f7b6..4b615b3 100644 --- a/packages/mcp-server/src/tools/payments/retrieve-payments.ts +++ b/packages/mcp-server/src/tools/payments/retrieve-payments.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -43,6 +42,10 @@ export const tool: Tool = { description: 'Decider to enable or disable the connector call for retrieve request', }, }, + required: ['payment_id'], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/payments/update-metadata-payments.ts b/packages/mcp-server/src/tools/payments/update-metadata-payments.ts index e56c7a1..639280b 100644 --- a/packages/mcp-server/src/tools/payments/update-metadata-payments.ts +++ b/packages/mcp-server/src/tools/payments/update-metadata-payments.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_metadata_payments', - description: 'Payments - Update Metadata', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nPayments - Update Metadata\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n payment_id: {\n type: 'string',\n description: 'The identifier for the payment'\n },\n metadata: {\n type: 'object',\n description: 'Metadata is useful for storing additional, unstructured information on an object.',\n additionalProperties: true\n }\n },\n required: [ 'payment_id'\n ]\n}\n```", inputSchema: { type: 'object', properties: { @@ -27,14 +28,25 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, + }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', }, }, + required: ['payment_id', 'metadata'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { payment_id, ...body } = args as any; - return asTextContentResult(await client.payments.updateMetadata(payment_id, body)); + const { payment_id, jq_filter, ...body } = args as any; + return asTextContentResult( + await maybeFilter(jq_filter, await client.payments.updateMetadata(payment_id, body)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/payments/update-payments.ts b/packages/mcp-server/src/tools/payments/update-payments.ts index 69e9e30..6112942 100644 --- a/packages/mcp-server/src/tools/payments/update-payments.ts +++ b/packages/mcp-server/src/tools/payments/update-payments.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -22,10 +21,8 @@ export const tool: Tool = { inputSchema: { type: 'object', properties: { - payment_id: { + path_payment_id: { type: 'string', - description: - 'Optional. A merchant-provided unique identifier for the payment, contains 30 characters long (e.g., "pay_mbabizu24mvu3mela5njyhpit4"). If provided, it ensures idempotency for the payment creation request. If omitted, Hyperswitch generates a unique ID for the payment.', }, all_keys_required: { type: 'boolean', @@ -104,6 +101,7 @@ export const tool: Tool = { frm_metadata: { type: 'object', description: 'Additional data related to some frm(Fraud Risk Management) connectors', + additionalProperties: true, }, is_iframe_redirection_enabled: { type: 'boolean', @@ -124,6 +122,7 @@ export const tool: Tool = { type: 'object', description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.', + additionalProperties: true, }, off_session: { type: 'boolean', @@ -145,6 +144,11 @@ export const tool: Tool = { payment_experience: { $ref: '#/$defs/payment_experience', }, + body_payment_id: { + type: 'string', + description: + 'Optional. A merchant-provided unique identifier for the payment, contains 30 characters long (e.g., "pay_mbabizu24mvu3mela5njyhpit4"). If provided, it ensures idempotency for the payment creation request. If omitted, Hyperswitch generates a unique ID for the payment.', + }, payment_link: { type: 'boolean', description: 'Whether to generate the payment link for this payment or not (if applicable)', @@ -263,6 +267,7 @@ export const tool: Tool = { $ref: '#/$defs/three_ds_completion_indicator', }, }, + required: ['path_payment_id'], $defs: { payment_method_type: { type: 'string', @@ -399,10 +404,8 @@ export const tool: Tool = { description: 'The contact number', }, }, - required: [], }, }, - required: [], }, address_details: { type: 'object', @@ -445,7 +448,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, country_alpha2: { type: 'string', @@ -758,7 +760,6 @@ export const tool: Tool = { description: 'User-agent of the browser', }, }, - required: [], }, capture_method: { type: 'string', @@ -908,7 +909,6 @@ export const tool: Tool = { description: 'payload required by airwallex', }, }, - required: [], }, apple_pay: { type: 'object', @@ -992,7 +992,6 @@ export const tool: Tool = { ], }, }, - required: [], }, braintree: { type: 'object', @@ -1019,10 +1018,8 @@ export const tool: Tool = { 'Information about the order category that merchant wants to specify at connector level. (e.g. In Noon Payments it can take values like "pay", "food", or any other custom string set by the merchant in Noon\'s Dashboard)', }, }, - required: [], }, }, - required: [], }, ctp_service_details: { type: 'object', @@ -1047,7 +1044,6 @@ export const tool: Tool = { description: 'session transaction flow id', }, }, - required: [], }, ctp_service_provider: { type: 'string', @@ -1297,7 +1293,6 @@ export const tool: Tool = { description: "A way to update the mandate's payment method details", }, }, - required: [], }, mandate_type: { anyOf: [ @@ -1339,6 +1334,7 @@ export const tool: Tool = { metadata: { type: 'object', description: 'Additional details required by mandate', + additionalProperties: true, }, start_date: { type: 'string', @@ -1370,13 +1366,14 @@ export const tool: Tool = { type: 'object', description: 'Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.', + additionalProperties: true, }, metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, }, - required: [], }, order_details_with_amount: { type: 'object', @@ -1579,6 +1576,7 @@ export const tool: Tool = { payment_link_ui_rules: { type: 'object', description: 'Payment link configuration rules', + additionalProperties: true, }, sdk_layout: { type: 'string', @@ -1587,6 +1585,7 @@ export const tool: Tool = { sdk_ui_rules: { type: 'object', description: 'SDK configuration rules', + additionalProperties: true, }, seller_name: { type: 'string', @@ -1638,14 +1637,12 @@ export const tool: Tool = { description: 'Position of the key-value pair in the UI', }, }, - required: [], }, }, required: ['key', 'value'], }, }, }, - required: [], }, payment_method_data_request: { anyOf: [ @@ -1729,6 +1726,7 @@ export const tool: Tool = { properties: { ali_pay_qr: { type: 'object', + additionalProperties: true, }, }, required: ['ali_pay_qr'], @@ -1738,6 +1736,7 @@ export const tool: Tool = { properties: { ali_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['ali_pay_redirect'], @@ -1747,6 +1746,7 @@ export const tool: Tool = { properties: { ali_pay_hk_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['ali_pay_hk_redirect'], @@ -1756,6 +1756,7 @@ export const tool: Tool = { properties: { amazon_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['amazon_pay_redirect'], @@ -1765,6 +1766,7 @@ export const tool: Tool = { properties: { momo_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['momo_redirect'], @@ -1774,6 +1776,7 @@ export const tool: Tool = { properties: { kakao_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['kakao_pay_redirect'], @@ -1783,6 +1786,7 @@ export const tool: Tool = { properties: { go_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['go_pay_redirect'], @@ -1792,6 +1796,7 @@ export const tool: Tool = { properties: { gcash_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['gcash_redirect'], @@ -1839,6 +1844,7 @@ export const tool: Tool = { properties: { apple_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['apple_pay_redirect'], @@ -1848,6 +1854,7 @@ export const tool: Tool = { properties: { apple_pay_third_party_sdk: { type: 'object', + additionalProperties: true, }, }, required: ['apple_pay_third_party_sdk'], @@ -1858,6 +1865,7 @@ export const tool: Tool = { dana_redirect: { type: 'object', description: 'Wallet data for DANA redirect flow', + additionalProperties: true, }, }, required: ['dana_redirect'], @@ -1932,6 +1940,7 @@ export const tool: Tool = { properties: { google_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['google_pay_redirect'], @@ -1941,6 +1950,7 @@ export const tool: Tool = { properties: { google_pay_third_party_sdk: { type: 'object', + additionalProperties: true, }, }, required: ['google_pay_third_party_sdk'], @@ -1967,6 +1977,7 @@ export const tool: Tool = { properties: { mobile_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['mobile_pay_redirect'], @@ -1982,7 +1993,6 @@ export const tool: Tool = { description: "paypal's email address", }, }, - required: [], }, }, required: ['paypal_redirect'], @@ -2106,6 +2116,7 @@ export const tool: Tool = { twint_redirect: { type: 'object', description: 'Wallet data for Twint Redirection', + additionalProperties: true, }, }, required: ['twint_redirect'], @@ -2116,6 +2127,7 @@ export const tool: Tool = { vipps_redirect: { type: 'object', description: 'Wallet data for Vipps Redirection', + additionalProperties: true, }, }, required: ['vipps_redirect'], @@ -2125,6 +2137,7 @@ export const tool: Tool = { properties: { touch_n_go_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['touch_n_go_redirect'], @@ -2134,6 +2147,7 @@ export const tool: Tool = { properties: { we_chat_pay_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['we_chat_pay_redirect'], @@ -2143,6 +2157,7 @@ export const tool: Tool = { properties: { we_chat_pay_qr: { type: 'object', + additionalProperties: true, }, }, required: ['we_chat_pay_qr'], @@ -2152,6 +2167,7 @@ export const tool: Tool = { properties: { cashapp_qr: { type: 'object', + additionalProperties: true, }, }, required: ['cashapp_qr'], @@ -2161,6 +2177,7 @@ export const tool: Tool = { properties: { swish_qr: { type: 'object', + additionalProperties: true, }, }, required: ['swish_qr'], @@ -2189,6 +2206,7 @@ export const tool: Tool = { properties: { revolut_pay: { type: 'object', + additionalProperties: true, }, }, required: ['revolut_pay'], @@ -2222,7 +2240,6 @@ export const tool: Tool = { description: 'The billing email', }, }, - required: [], }, }, required: ['klarna_redirect'], @@ -2250,6 +2267,7 @@ export const tool: Tool = { affirm_redirect: { type: 'object', description: 'For Affirm redirect as PayLater Option', + additionalProperties: true, }, }, required: ['affirm_redirect'], @@ -2270,7 +2288,6 @@ export const tool: Tool = { description: 'The billing name', }, }, - required: [], }, }, required: ['afterpay_clearpay_redirect'], @@ -2281,6 +2298,7 @@ export const tool: Tool = { pay_bright_redirect: { type: 'object', description: 'For PayBright Redirect as PayLater Option', + additionalProperties: true, }, }, required: ['pay_bright_redirect'], @@ -2291,6 +2309,7 @@ export const tool: Tool = { walley_redirect: { type: 'object', description: 'For WalleyRedirect as PayLater Option', + additionalProperties: true, }, }, required: ['walley_redirect'], @@ -2301,6 +2320,7 @@ export const tool: Tool = { alma_redirect: { type: 'object', description: 'For Alma Redirection as PayLater Option', + additionalProperties: true, }, }, required: ['alma_redirect'], @@ -2310,6 +2330,7 @@ export const tool: Tool = { properties: { atome_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['atome_redirect'], @@ -2364,6 +2385,7 @@ export const tool: Tool = { properties: { bizum: { type: 'object', + additionalProperties: true, }, }, required: ['bizum'], @@ -2378,7 +2400,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['blik'], @@ -2464,7 +2485,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['interac'], @@ -2494,7 +2514,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['online_banking_finland'], @@ -2560,7 +2579,6 @@ export const tool: Tool = { $ref: '#/$defs/bank_redirect_billing', }, }, - required: [], }, }, required: ['przelewy24'], @@ -2637,6 +2655,7 @@ export const tool: Tool = { properties: { local_bank_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['local_bank_redirect'], @@ -2823,10 +2842,8 @@ export const tool: Tool = { description: 'The Email ID for ACH billing', }, }, - required: [], }, }, - required: [], }, }, required: ['ach_bank_transfer'], @@ -2859,7 +2876,6 @@ export const tool: Tool = { $ref: '#/$defs/sepa_and_bacs_billing_details', }, }, - required: [], }, }, required: ['bacs_bank_transfer'], @@ -2877,10 +2893,8 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, - required: [], }, }, required: ['multibanco_bank_transfer'], @@ -2895,7 +2909,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['permata_bank_transfer'], @@ -2910,7 +2923,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['bca_bank_transfer'], @@ -2925,7 +2937,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['bni_va_bank_transfer'], @@ -2940,7 +2951,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['bri_va_bank_transfer'], @@ -2955,7 +2965,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['cimb_va_bank_transfer'], @@ -2970,7 +2979,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['danamon_va_bank_transfer'], @@ -2985,7 +2993,6 @@ export const tool: Tool = { $ref: '#/$defs/doku_billing_details', }, }, - required: [], }, }, required: ['mandiri_va_bank_transfer'], @@ -3017,7 +3024,6 @@ export const tool: Tool = { description: 'Source bank account number', }, }, - required: [], }, }, required: ['pix'], @@ -3027,6 +3033,7 @@ export const tool: Tool = { properties: { pse: { type: 'object', + additionalProperties: true, }, }, required: ['pse'], @@ -3041,7 +3048,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['local_bank_transfer'], @@ -3051,6 +3057,7 @@ export const tool: Tool = { properties: { instant_bank_transfer: { type: 'object', + additionalProperties: true, }, }, required: ['instant_bank_transfer'], @@ -3060,6 +3067,7 @@ export const tool: Tool = { properties: { instant_bank_transfer_finland: { type: 'object', + additionalProperties: true, }, }, required: ['instant_bank_transfer_finland'], @@ -3069,6 +3077,7 @@ export const tool: Tool = { properties: { instant_bank_transfer_poland: { type: 'object', + additionalProperties: true, }, }, required: ['instant_bank_transfer_poland'], @@ -3115,7 +3124,6 @@ export const tool: Tool = { $ref: '#/$defs/address', }, }, - required: [], }, { type: 'object', @@ -3125,7 +3133,6 @@ export const tool: Tool = { $ref: '#/$defs/address', }, }, - required: [], }, { type: 'object', @@ -3143,7 +3150,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, }, required: ['upi_collect'], @@ -3153,6 +3159,7 @@ export const tool: Tool = { properties: { upi_intent: { type: 'object', + additionalProperties: true, }, }, required: ['upi_intent'], @@ -3209,6 +3216,7 @@ export const tool: Tool = { properties: { pay_safe_card: { type: 'object', + additionalProperties: true, }, }, required: ['pay_safe_card'], @@ -3302,6 +3310,7 @@ export const tool: Tool = { properties: { knet: { type: 'object', + additionalProperties: true, }, }, required: ['knet'], @@ -3311,6 +3320,7 @@ export const tool: Tool = { properties: { benefit: { type: 'object', + additionalProperties: true, }, }, required: ['benefit'], @@ -3320,6 +3330,7 @@ export const tool: Tool = { properties: { momo_atm: { type: 'object', + additionalProperties: true, }, }, required: ['momo_atm'], @@ -3329,6 +3340,7 @@ export const tool: Tool = { properties: { card_redirect: { type: 'object', + additionalProperties: true, }, }, required: ['card_redirect'], @@ -3538,7 +3550,6 @@ export const tool: Tool = { description: 'The billing name for bank debits', }, }, - required: [], }, sepa_and_bacs_billing_details: { type: 'object', @@ -3552,7 +3563,6 @@ export const tool: Tool = { description: 'The billing name for SEPA and BACS billing', }, }, - required: [], }, doku_billing_details: { type: 'object', @@ -3570,7 +3580,6 @@ export const tool: Tool = { description: 'The billing second name for Doku', }, }, - required: [], }, real_time_payment_data: { anyOf: [ @@ -3579,6 +3588,7 @@ export const tool: Tool = { properties: { fps: { type: 'object', + additionalProperties: true, }, }, required: ['fps'], @@ -3588,6 +3598,7 @@ export const tool: Tool = { properties: { duit_now: { type: 'object', + additionalProperties: true, }, }, required: ['duit_now'], @@ -3597,6 +3608,7 @@ export const tool: Tool = { properties: { prompt_pay: { type: 'object', + additionalProperties: true, }, }, required: ['prompt_pay'], @@ -3606,6 +3618,7 @@ export const tool: Tool = { properties: { viet_qr: { type: 'object', + additionalProperties: true, }, }, required: ['viet_qr'], @@ -3622,7 +3635,6 @@ export const tool: Tool = { type: 'string', }, }, - required: [], }, voucher_data: { anyOf: [ @@ -3641,7 +3653,6 @@ export const tool: Tool = { description: "The shopper's social security number", }, }, - required: [], }, }, required: ['boleto'], @@ -3665,7 +3676,6 @@ export const tool: Tool = { description: 'The billing second name for Alfamart', }, }, - required: [], }, }, required: ['alfamart'], @@ -3689,7 +3699,6 @@ export const tool: Tool = { description: 'The billing second name for Alfamart', }, }, - required: [], }, }, required: ['indomaret'], @@ -3770,13 +3779,13 @@ export const tool: Tool = { description: 'The telephone number for Japanese convenience stores', }, }, - required: [], }, open_banking_data: { type: 'object', properties: { open_banking_pis: { type: 'object', + additionalProperties: true, }, }, required: ['open_banking_pis'], @@ -4340,6 +4349,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payouts/cancel-payouts.ts b/packages/mcp-server/src/tools/payouts/cancel-payouts.ts index 69dde37..b760f88 100644 --- a/packages/mcp-server/src/tools/payouts/cancel-payouts.ts +++ b/packages/mcp-server/src/tools/payouts/cancel-payouts.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -21,13 +20,18 @@ export const tool: Tool = { inputSchema: { type: 'object', properties: { - payout_id: { + path_payout_id: { + type: 'string', + }, + body_payout_id: { type: 'string', description: 'Unique identifier for the payout. This ensures idempotency for multiple payouts\nthat have been done by a single merchant. This field is auto generated and is returned in the API response.', }, }, + required: ['path_payout_id', 'body_payout_id'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payouts/confirm-payouts.ts b/packages/mcp-server/src/tools/payouts/confirm-payouts.ts index 3bd9f46..b1e5e26 100644 --- a/packages/mcp-server/src/tools/payouts/confirm-payouts.ts +++ b/packages/mcp-server/src/tools/payouts/confirm-payouts.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -81,6 +80,7 @@ export const tool: Tool = { type: 'object', description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.', + additionalProperties: true, }, name: { type: 'string', @@ -141,6 +141,7 @@ export const tool: Tool = { 'Will be used to expire client secret after certain amount of time to be supplied in seconds\n(900) for 15 mins', }, }, + required: ['payout_id', 'client_secret'], $defs: { address: { type: 'object', @@ -163,10 +164,8 @@ export const tool: Tool = { description: 'The contact number', }, }, - required: [], }, }, - required: [], }, address_details: { type: 'object', @@ -209,7 +208,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, country_alpha2: { type: 'string', @@ -714,7 +712,6 @@ export const tool: Tool = { description: 'Primary color to be used in the form represented in hex format', }, }, - required: [], }, method_data: { anyOf: [ @@ -991,6 +988,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -1041,6 +1039,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -1267,6 +1266,7 @@ export const tool: Tool = { type: 'object', description: 'Additional metadata that the Static Analyzer and Backend does not touch.\nThis can be used to store useful information for the frontend and is required for communication\nbetween the static analyzer and the frontend.', + additionalProperties: true, }, value: { anyOf: [ @@ -1440,6 +1440,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payouts/create-payouts.ts b/packages/mcp-server/src/tools/payouts/create-payouts.ts index c33f7ec..20c5c79 100644 --- a/packages/mcp-server/src/tools/payouts/create-payouts.ts +++ b/packages/mcp-server/src/tools/payouts/create-payouts.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -79,6 +78,7 @@ export const tool: Tool = { type: 'object', description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.', + additionalProperties: true, }, name: { type: 'string', @@ -139,6 +139,7 @@ export const tool: Tool = { 'Will be used to expire client secret after certain amount of time to be supplied in seconds\n(900) for 15 mins', }, }, + required: ['amount', 'currency'], $defs: { currency: { type: 'string', @@ -328,10 +329,8 @@ export const tool: Tool = { description: 'The contact number', }, }, - required: [], }, }, - required: [], }, address_details: { type: 'object', @@ -374,7 +373,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, country_alpha2: { type: 'string', @@ -712,7 +710,6 @@ export const tool: Tool = { description: 'Primary color to be used in the form represented in hex format', }, }, - required: [], }, method_data: { anyOf: [ @@ -989,6 +986,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -1039,6 +1037,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -1265,6 +1264,7 @@ export const tool: Tool = { type: 'object', description: 'Additional metadata that the Static Analyzer and Backend does not touch.\nThis can be used to store useful information for the frontend and is required for communication\nbetween the static analyzer and the frontend.', + additionalProperties: true, }, value: { anyOf: [ @@ -1438,6 +1438,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payouts/fulfill-payouts.ts b/packages/mcp-server/src/tools/payouts/fulfill-payouts.ts index 7e61468..287246d 100644 --- a/packages/mcp-server/src/tools/payouts/fulfill-payouts.ts +++ b/packages/mcp-server/src/tools/payouts/fulfill-payouts.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -21,13 +20,18 @@ export const tool: Tool = { inputSchema: { type: 'object', properties: { - payout_id: { + path_payout_id: { + type: 'string', + }, + body_payout_id: { type: 'string', description: 'Unique identifier for the payout. This ensures idempotency for multiple payouts\nthat have been done by a single merchant. This field is auto generated and is returned in the API response.', }, }, + required: ['path_payout_id', 'body_payout_id'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payouts/list-filters-payouts.ts b/packages/mcp-server/src/tools/payouts/list-filters-payouts.ts index aee9789..c95ae24 100644 --- a/packages/mcp-server/src/tools/payouts/list-filters-payouts.ts +++ b/packages/mcp-server/src/tools/payouts/list-filters-payouts.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_filters_payouts', - description: 'Payouts - List available filters', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nPayouts - List available filters\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n connector: {\n type: 'array',\n description: 'The list of available connector filters',\n items: {\n $ref: '#/$defs/payout_connectors'\n }\n },\n currency: {\n type: 'array',\n description: 'The list of available currency filters',\n items: {\n $ref: '#/$defs/currency'\n }\n },\n payout_method: {\n type: 'array',\n description: 'The list of available payout method filters',\n items: {\n $ref: '#/$defs/payout_type'\n }\n },\n status: {\n type: 'array',\n description: 'The list of available payout status filters',\n items: {\n $ref: '#/$defs/status'\n }\n }\n },\n required: [ 'connector',\n 'currency',\n 'payout_method',\n 'status'\n ],\n $defs: {\n payout_connectors: {\n type: 'string',\n enum: [ 'adyen',\n 'adyenplatform',\n 'cybersource',\n 'ebanx',\n 'nomupay',\n 'payone',\n 'paypal',\n 'stripe',\n 'wise'\n ]\n },\n currency: {\n type: 'string',\n description: 'The three-letter ISO 4217 currency code (e.g., \"USD\", \"EUR\") for the payment amount. This field is mandatory for creating a payment.',\n enum: [ 'AED',\n 'AFN',\n 'ALL',\n 'AMD',\n 'ANG',\n 'AOA',\n 'ARS',\n 'AUD',\n 'AWG',\n 'AZN',\n 'BAM',\n 'BBD',\n 'BDT',\n 'BGN',\n 'BHD',\n 'BIF',\n 'BMD',\n 'BND',\n 'BOB',\n 'BRL',\n 'BSD',\n 'BTN',\n 'BWP',\n 'BYN',\n 'BZD',\n 'CAD',\n 'CDF',\n 'CHF',\n 'CLF',\n 'CLP',\n 'CNY',\n 'COP',\n 'CRC',\n 'CUC',\n 'CUP',\n 'CVE',\n 'CZK',\n 'DJF',\n 'DKK',\n 'DOP',\n 'DZD',\n 'EGP',\n 'ERN',\n 'ETB',\n 'EUR',\n 'FJD',\n 'FKP',\n 'GBP',\n 'GEL',\n 'GHS',\n 'GIP',\n 'GMD',\n 'GNF',\n 'GTQ',\n 'GYD',\n 'HKD',\n 'HNL',\n 'HRK',\n 'HTG',\n 'HUF',\n 'IDR',\n 'ILS',\n 'INR',\n 'IQD',\n 'IRR',\n 'ISK',\n 'JMD',\n 'JOD',\n 'JPY',\n 'KES',\n 'KGS',\n 'KHR',\n 'KMF',\n 'KPW',\n 'KRW',\n 'KWD',\n 'KYD',\n 'KZT',\n 'LAK',\n 'LBP',\n 'LKR',\n 'LRD',\n 'LSL',\n 'LYD',\n 'MAD',\n 'MDL',\n 'MGA',\n 'MKD',\n 'MMK',\n 'MNT',\n 'MOP',\n 'MRU',\n 'MUR',\n 'MVR',\n 'MWK',\n 'MXN',\n 'MYR',\n 'MZN',\n 'NAD',\n 'NGN',\n 'NIO',\n 'NOK',\n 'NPR',\n 'NZD',\n 'OMR',\n 'PAB',\n 'PEN',\n 'PGK',\n 'PHP',\n 'PKR',\n 'PLN',\n 'PYG',\n 'QAR',\n 'RON',\n 'RSD',\n 'RUB',\n 'RWF',\n 'SAR',\n 'SBD',\n 'SCR',\n 'SDG',\n 'SEK',\n 'SGD',\n 'SHP',\n 'SLE',\n 'SLL',\n 'SOS',\n 'SRD',\n 'SSP',\n 'STD',\n 'STN',\n 'SVC',\n 'SYP',\n 'SZL',\n 'THB',\n 'TJS',\n 'TMT',\n 'TND',\n 'TOP',\n 'TRY',\n 'TTD',\n 'TWD',\n 'TZS',\n 'UAH',\n 'UGX',\n 'USD',\n 'UYU',\n 'UZS',\n 'VES',\n 'VND',\n 'VUV',\n 'WST',\n 'XAF',\n 'XCD',\n 'XOF',\n 'XPF',\n 'YER',\n 'ZAR',\n 'ZMW',\n 'ZWL'\n ]\n },\n payout_type: {\n type: 'string',\n description: 'The payout_type of the payout request is a mandatory field for confirming the payouts. It should be specified in the Create request. If not provided, it must be updated in the Payout Update request before it can be confirmed.',\n enum: [ 'card',\n 'bank',\n 'wallet'\n ]\n },\n status: {\n type: 'string',\n enum: [ 'success',\n 'failed',\n 'cancelled',\n 'initiated',\n 'expired',\n 'reversed',\n 'pending',\n 'ineligible',\n 'requires_creation',\n 'requires_confirmation',\n 'requires_payout_method_data',\n 'requires_fulfillment',\n 'requires_vendor_account_creation'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -33,13 +34,21 @@ export const tool: Tool = { 'The end time to filter payments list or to get list of filters. If not passed the default time is now', format: 'date-time', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['start_time'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.payouts.listFilters(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.payouts.listFilters(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/payouts/list/retrieve-payouts-list.ts b/packages/mcp-server/src/tools/payouts/list/retrieve-payouts-list.ts index 35f184c..89db116 100644 --- a/packages/mcp-server/src/tools/payouts/list/retrieve-payouts-list.ts +++ b/packages/mcp-server/src/tools/payouts/list/retrieve-payouts-list.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -47,6 +46,10 @@ export const tool: Tool = { 'The time range for which objects are needed. TimeRange has two fields start_time and end_time from which objects can be filtered as per required scenarios (created_at, time less than, greater than etc).', }, }, + required: ['created', 'customer_id', 'ending_before', 'limit', 'starting_after', 'time_range'], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/payouts/list/with-filters-payouts-list.ts b/packages/mcp-server/src/tools/payouts/list/with-filters-payouts-list.ts index c3df71d..eec2a33 100644 --- a/packages/mcp-server/src/tools/payouts/list/with-filters-payouts-list.ts +++ b/packages/mcp-server/src/tools/payouts/list/with-filters-payouts-list.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -81,6 +80,7 @@ export const tool: Tool = { }, }, }, + required: ['currency', 'entity_type', 'start_time'], $defs: { currency: { type: 'string', @@ -303,6 +303,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/payouts/retrieve-payouts.ts b/packages/mcp-server/src/tools/payouts/retrieve-payouts.ts index dab483a..94b6eda 100644 --- a/packages/mcp-server/src/tools/payouts/retrieve-payouts.ts +++ b/packages/mcp-server/src/tools/payouts/retrieve-payouts.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -29,6 +28,10 @@ export const tool: Tool = { description: 'Sync with the connector to get the payout details (defaults to false)', }, }, + required: ['payout_id'], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/payouts/update-payouts.ts b/packages/mcp-server/src/tools/payouts/update-payouts.ts index 736c7f9..dfa2156 100644 --- a/packages/mcp-server/src/tools/payouts/update-payouts.ts +++ b/packages/mcp-server/src/tools/payouts/update-payouts.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -86,6 +85,7 @@ export const tool: Tool = { type: 'object', description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.', + additionalProperties: true, }, name: { type: 'string', @@ -146,6 +146,7 @@ export const tool: Tool = { 'Will be used to expire client secret after certain amount of time to be supplied in seconds\n(900) for 15 mins', }, }, + required: ['payout_id'], $defs: { address: { type: 'object', @@ -168,10 +169,8 @@ export const tool: Tool = { description: 'The contact number', }, }, - required: [], }, }, - required: [], }, address_details: { type: 'object', @@ -214,7 +213,6 @@ export const tool: Tool = { description: 'The zip/postal code for the address', }, }, - required: [], }, country_alpha2: { type: 'string', @@ -719,7 +717,6 @@ export const tool: Tool = { description: 'Primary color to be used in the form represented in hex format', }, }, - required: [], }, method_data: { anyOf: [ @@ -996,6 +993,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -1046,6 +1044,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -1272,6 +1271,7 @@ export const tool: Tool = { type: 'object', description: 'Additional metadata that the Static Analyzer and Backend does not touch.\nThis can be used to store useful information for the frontend and is required for communication\nbetween the static analyzer and the frontend.', + additionalProperties: true, }, value: { anyOf: [ @@ -1445,6 +1445,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/poll/retrieve-status-poll.ts b/packages/mcp-server/src/tools/poll/retrieve-status-poll.ts index 655c1a5..ec2eb5e 100644 --- a/packages/mcp-server/src/tools/poll/retrieve-status-poll.ts +++ b/packages/mcp-server/src/tools/poll/retrieve-status-poll.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,31 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_status_poll', - description: 'Poll - Retrieve Poll Status', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nPoll - Retrieve Poll Status\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n poll_id: {\n type: 'string',\n description: 'The poll id'\n },\n status: {\n type: 'string',\n enum: [ 'pending',\n 'completed',\n 'not_found'\n ]\n }\n },\n required: [ 'poll_id',\n 'status'\n ]\n}\n```", inputSchema: { type: 'object', properties: { poll_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['poll_id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { poll_id, ...body } = args as any; - return asTextContentResult(await client.poll.retrieveStatus(poll_id)); + const { poll_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.poll.retrieveStatus(poll_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/profile-acquirers/create-profile-acquirers.ts b/packages/mcp-server/src/tools/profile-acquirers/create-profile-acquirers.ts index 01cbf01..e2e2862 100644 --- a/packages/mcp-server/src/tools/profile-acquirers/create-profile-acquirers.ts +++ b/packages/mcp-server/src/tools/profile-acquirers/create-profile-acquirers.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_profile_acquirers', - description: 'Create a new Profile Acquirer for accessing our APIs from your servers.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nCreate a new Profile Acquirer for accessing our APIs from your servers.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/profile_acquirer',\n $defs: {\n profile_acquirer: {\n type: 'object',\n properties: {\n acquirer_assigned_merchant_id: {\n type: 'string',\n description: 'The merchant id assigned by the acquirer'\n },\n acquirer_bin: {\n type: 'string',\n description: 'Acquirer bin'\n },\n acquirer_fraud_rate: {\n type: 'number',\n description: 'Fraud rate for the particular acquirer configuration'\n },\n merchant_country_code: {\n type: 'string',\n description: 'Merchant country code assigned by acquirer'\n },\n merchant_name: {\n type: 'string',\n description: 'Merchant name'\n },\n network: {\n type: 'string',\n description: 'Network provider'\n },\n profile_acquirer_id: {\n type: 'string',\n description: 'The unique identifier of the profile acquirer'\n },\n profile_id: {\n type: 'string',\n description: 'Parent profile id to link the acquirer account with'\n },\n acquirer_ica: {\n type: 'string',\n description: 'Acquirer ica provided by acquirer'\n }\n },\n required: [ 'acquirer_assigned_merchant_id',\n 'acquirer_bin',\n 'acquirer_fraud_rate',\n 'merchant_country_code',\n 'merchant_name',\n 'network',\n 'profile_acquirer_id',\n 'profile_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -53,13 +54,29 @@ export const tool: Tool = { type: 'string', description: 'Acquirer ica provided by acquirer', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: [ + 'acquirer_assigned_merchant_id', + 'acquirer_bin', + 'acquirer_fraud_rate', + 'merchant_country_code', + 'merchant_name', + 'network', + 'profile_id', + ], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.profileAcquirers.create(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.profileAcquirers.create(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/profile-acquirers/update-profile-acquirers.ts b/packages/mcp-server/src/tools/profile-acquirers/update-profile-acquirers.ts index 0905239..85e6ca4 100644 --- a/packages/mcp-server/src/tools/profile-acquirers/update-profile-acquirers.ts +++ b/packages/mcp-server/src/tools/profile-acquirers/update-profile-acquirers.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_profile_acquirers', - description: 'Update a Profile Acquirer for accessing our APIs from your servers.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nUpdate a Profile Acquirer for accessing our APIs from your servers.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/profile_acquirer',\n $defs: {\n profile_acquirer: {\n type: 'object',\n properties: {\n acquirer_assigned_merchant_id: {\n type: 'string',\n description: 'The merchant id assigned by the acquirer'\n },\n acquirer_bin: {\n type: 'string',\n description: 'Acquirer bin'\n },\n acquirer_fraud_rate: {\n type: 'number',\n description: 'Fraud rate for the particular acquirer configuration'\n },\n merchant_country_code: {\n type: 'string',\n description: 'Merchant country code assigned by acquirer'\n },\n merchant_name: {\n type: 'string',\n description: 'Merchant name'\n },\n network: {\n type: 'string',\n description: 'Network provider'\n },\n profile_acquirer_id: {\n type: 'string',\n description: 'The unique identifier of the profile acquirer'\n },\n profile_id: {\n type: 'string',\n description: 'Parent profile id to link the acquirer account with'\n },\n acquirer_ica: {\n type: 'string',\n description: 'Acquirer ica provided by acquirer'\n }\n },\n required: [ 'acquirer_assigned_merchant_id',\n 'acquirer_bin',\n 'acquirer_fraud_rate',\n 'merchant_country_code',\n 'merchant_name',\n 'network',\n 'profile_acquirer_id',\n 'profile_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -48,13 +49,23 @@ export const tool: Tool = { network: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['profile_id', 'profile_acquirer_id'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { profile_acquirer_id, ...body } = args as any; - return asTextContentResult(await client.profileAcquirers.update(profile_acquirer_id, body)); + const { profile_acquirer_id, jq_filter, ...body } = args as any; + return asTextContentResult( + await maybeFilter(jq_filter, await client.profileAcquirers.update(profile_acquirer_id, body)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/refunds/create-refunds.ts b/packages/mcp-server/src/tools/refunds/create-refunds.ts index 6552fa5..bce59a5 100644 --- a/packages/mcp-server/src/tools/refunds/create-refunds.ts +++ b/packages/mcp-server/src/tools/refunds/create-refunds.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -42,6 +41,7 @@ export const tool: Tool = { type: 'object', description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.', + additionalProperties: true, }, reason: { type: 'string', @@ -62,6 +62,7 @@ export const tool: Tool = { $ref: '#/$defs/split_refund', }, }, + required: ['payment_id'], $defs: { merchant_connector_details_wrap: { type: 'object', @@ -85,13 +86,14 @@ export const tool: Tool = { type: 'object', description: 'Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.', + additionalProperties: true, }, metadata: { type: 'object', description: 'Metadata is useful for storing additional, unstructured information on an object.', + additionalProperties: true, }, }, - required: [], }, split_refund: { anyOf: [ @@ -114,7 +116,6 @@ export const tool: Tool = { "Toggle for reverting the transfer that was made during the charge.\nIf set to false, the funds are pulled from the main platform's account.", }, }, - required: [], }, }, required: ['stripe_split_refund'], @@ -211,6 +212,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/refunds/list-refunds.ts b/packages/mcp-server/src/tools/refunds/list-refunds.ts index 0b41fa3..4ba1a4a 100644 --- a/packages/mcp-server/src/tools/refunds/list-refunds.ts +++ b/packages/mcp-server/src/tools/refunds/list-refunds.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -42,7 +41,6 @@ export const tool: Tool = { 'The start amount to filter list of transactions which are greater than or equal to the start amount', }, }, - required: [], }, connector: { type: 'array', @@ -99,6 +97,7 @@ export const tool: Tool = { }, }, }, + required: ['start_time'], $defs: { currency: { type: 'string', @@ -274,6 +273,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/refunds/retrieve-refunds.ts b/packages/mcp-server/src/tools/refunds/retrieve-refunds.ts index e5992b5..6819674 100644 --- a/packages/mcp-server/src/tools/refunds/retrieve-refunds.ts +++ b/packages/mcp-server/src/tools/refunds/retrieve-refunds.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,31 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_refunds', - description: 'Retrieves a Refund. This may be used to get the status of a previously initiated refund', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieves a Refund. This may be used to get the status of a previously initiated refund\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/refund_response',\n $defs: {\n refund_response: {\n type: 'object',\n properties: {\n amount: {\n type: 'integer',\n description: 'The refund amount, which should be less than or equal to the total payment amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc'\n },\n connector: {\n type: 'string',\n description: 'The connector used for the refund and the corresponding payment'\n },\n currency: {\n type: 'string',\n description: 'The three-letter ISO currency code'\n },\n payment_id: {\n type: 'string',\n description: 'The payment id against which refund is initiated'\n },\n refund_id: {\n type: 'string',\n description: 'Unique Identifier for the refund'\n },\n status: {\n $ref: '#/$defs/refund_status'\n },\n created_at: {\n type: 'string',\n description: 'The timestamp at which refund is created',\n format: 'date-time'\n },\n error_code: {\n type: 'string',\n description: 'The code for the error'\n },\n error_message: {\n type: 'string',\n description: 'The error message'\n },\n issuer_error_code: {\n type: 'string',\n description: 'Error code received from the issuer in case of failed refunds'\n },\n issuer_error_message: {\n type: 'string',\n description: 'Error message received from the issuer in case of failed refunds'\n },\n merchant_connector_id: {\n type: 'string',\n description: 'The merchant_connector_id of the processor through which this payment went through'\n },\n metadata: {\n type: 'object',\n description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object',\n additionalProperties: true\n },\n profile_id: {\n type: 'string',\n description: 'The id of business profile for this refund'\n },\n reason: {\n type: 'string',\n description: 'An arbitrary string attached to the object. Often useful for displaying to users and your customer support executive'\n },\n split_refunds: {\n $ref: '#/$defs/split_refund'\n },\n unified_code: {\n type: 'string',\n description: 'Error code unified across the connectors is received here if there was an error while calling connector'\n },\n unified_message: {\n type: 'string',\n description: 'Error message unified across the connectors is received here if there was an error while calling connector'\n },\n updated_at: {\n type: 'string',\n description: 'The timestamp at which refund is updated',\n format: 'date-time'\n }\n },\n required: [ 'amount',\n 'connector',\n 'currency',\n 'payment_id',\n 'refund_id',\n 'status'\n ]\n },\n refund_status: {\n type: 'string',\n description: 'The status for refunds',\n enum: [ 'succeeded',\n 'failed',\n 'pending',\n 'review'\n ]\n },\n split_refund: {\n anyOf: [ {\n type: 'object',\n properties: {\n stripe_split_refund: {\n type: 'object',\n description: 'Charge specific fields for controlling the revert of funds from either platform or connected account for Stripe. Check sub-fields for more details.',\n properties: {\n revert_platform_fee: {\n type: 'boolean',\n description: 'Toggle for reverting the application fee that was collected for the payment.\\nIf set to false, the funds are pulled from the destination account.'\n },\n revert_transfer: {\n type: 'boolean',\n description: 'Toggle for reverting the transfer that was made during the charge.\\nIf set to false, the funds are pulled from the main platform\\'s account.'\n }\n }\n }\n },\n required: [ 'stripe_split_refund'\n ]\n },\n {\n type: 'object',\n properties: {\n adyen_split_refund: {\n $ref: '#/$defs/adyen_split_data'\n }\n },\n required: [ 'adyen_split_refund'\n ]\n },\n {\n type: 'object',\n properties: {\n xendit_split_refund: {\n $ref: '#/$defs/xendit_split_sub_merchant_data'\n }\n },\n required: [ 'xendit_split_refund'\n ]\n }\n ],\n description: 'Charge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details.'\n },\n adyen_split_data: {\n type: 'object',\n description: 'Fee information for Split Payments to be charged on the payment being collected for Adyen',\n properties: {\n split_items: {\n type: 'array',\n description: 'Data for the split items',\n items: {\n type: 'object',\n description: 'Data for the split items',\n properties: {\n amount: {\n type: 'integer',\n description: 'The amount of the split item'\n },\n reference: {\n type: 'string',\n description: 'Unique Identifier for the split item'\n },\n split_type: {\n type: 'string',\n enum: [ 'BalanceAccount',\n 'AcquiringFees',\n 'PaymentFee',\n 'AdyenFees',\n 'AdyenCommission',\n 'AdyenMarkup',\n 'Interchange',\n 'SchemeFee',\n 'Commission',\n 'TopUp',\n 'Vat'\n ]\n },\n account: {\n type: 'string',\n description: 'The unique identifier of the account to which the split amount is allocated.'\n },\n description: {\n type: 'string',\n description: 'Description for the part of the payment that will be allocated to the specified account.'\n }\n },\n required: [ 'amount',\n 'reference',\n 'split_type'\n ]\n }\n },\n store: {\n type: 'string',\n description: 'The store identifier'\n }\n },\n required: [ 'split_items'\n ]\n },\n xendit_split_sub_merchant_data: {\n type: 'object',\n description: 'Fee information to be charged on the payment being collected for sub-merchant via xendit',\n properties: {\n for_user_id: {\n type: 'string',\n description: 'The sub-account user-id that you want to make this transaction for.'\n }\n },\n required: [ 'for_user_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { refund_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['refund_id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { refund_id, ...body } = args as any; - return asTextContentResult(await client.refunds.retrieve(refund_id)); + const { refund_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.refunds.retrieve(refund_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/refunds/update-refunds.ts b/packages/mcp-server/src/tools/refunds/update-refunds.ts index 0dad0c6..50389a2 100644 --- a/packages/mcp-server/src/tools/refunds/update-refunds.ts +++ b/packages/mcp-server/src/tools/refunds/update-refunds.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_refunds', description: - 'Updates the properties of a Refund object. This API can be used to attach a reason for the refund or metadata fields', + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nUpdates the properties of a Refund object. This API can be used to attach a reason for the refund or metadata fields\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/refund_response',\n $defs: {\n refund_response: {\n type: 'object',\n properties: {\n amount: {\n type: 'integer',\n description: 'The refund amount, which should be less than or equal to the total payment amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc'\n },\n connector: {\n type: 'string',\n description: 'The connector used for the refund and the corresponding payment'\n },\n currency: {\n type: 'string',\n description: 'The three-letter ISO currency code'\n },\n payment_id: {\n type: 'string',\n description: 'The payment id against which refund is initiated'\n },\n refund_id: {\n type: 'string',\n description: 'Unique Identifier for the refund'\n },\n status: {\n $ref: '#/$defs/refund_status'\n },\n created_at: {\n type: 'string',\n description: 'The timestamp at which refund is created',\n format: 'date-time'\n },\n error_code: {\n type: 'string',\n description: 'The code for the error'\n },\n error_message: {\n type: 'string',\n description: 'The error message'\n },\n issuer_error_code: {\n type: 'string',\n description: 'Error code received from the issuer in case of failed refunds'\n },\n issuer_error_message: {\n type: 'string',\n description: 'Error message received from the issuer in case of failed refunds'\n },\n merchant_connector_id: {\n type: 'string',\n description: 'The merchant_connector_id of the processor through which this payment went through'\n },\n metadata: {\n type: 'object',\n description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object',\n additionalProperties: true\n },\n profile_id: {\n type: 'string',\n description: 'The id of business profile for this refund'\n },\n reason: {\n type: 'string',\n description: 'An arbitrary string attached to the object. Often useful for displaying to users and your customer support executive'\n },\n split_refunds: {\n $ref: '#/$defs/split_refund'\n },\n unified_code: {\n type: 'string',\n description: 'Error code unified across the connectors is received here if there was an error while calling connector'\n },\n unified_message: {\n type: 'string',\n description: 'Error message unified across the connectors is received here if there was an error while calling connector'\n },\n updated_at: {\n type: 'string',\n description: 'The timestamp at which refund is updated',\n format: 'date-time'\n }\n },\n required: [ 'amount',\n 'connector',\n 'currency',\n 'payment_id',\n 'refund_id',\n 'status'\n ]\n },\n refund_status: {\n type: 'string',\n description: 'The status for refunds',\n enum: [ 'succeeded',\n 'failed',\n 'pending',\n 'review'\n ]\n },\n split_refund: {\n anyOf: [ {\n type: 'object',\n properties: {\n stripe_split_refund: {\n type: 'object',\n description: 'Charge specific fields for controlling the revert of funds from either platform or connected account for Stripe. Check sub-fields for more details.',\n properties: {\n revert_platform_fee: {\n type: 'boolean',\n description: 'Toggle for reverting the application fee that was collected for the payment.\\nIf set to false, the funds are pulled from the destination account.'\n },\n revert_transfer: {\n type: 'boolean',\n description: 'Toggle for reverting the transfer that was made during the charge.\\nIf set to false, the funds are pulled from the main platform\\'s account.'\n }\n }\n }\n },\n required: [ 'stripe_split_refund'\n ]\n },\n {\n type: 'object',\n properties: {\n adyen_split_refund: {\n $ref: '#/$defs/adyen_split_data'\n }\n },\n required: [ 'adyen_split_refund'\n ]\n },\n {\n type: 'object',\n properties: {\n xendit_split_refund: {\n $ref: '#/$defs/xendit_split_sub_merchant_data'\n }\n },\n required: [ 'xendit_split_refund'\n ]\n }\n ],\n description: 'Charge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details.'\n },\n adyen_split_data: {\n type: 'object',\n description: 'Fee information for Split Payments to be charged on the payment being collected for Adyen',\n properties: {\n split_items: {\n type: 'array',\n description: 'Data for the split items',\n items: {\n type: 'object',\n description: 'Data for the split items',\n properties: {\n amount: {\n type: 'integer',\n description: 'The amount of the split item'\n },\n reference: {\n type: 'string',\n description: 'Unique Identifier for the split item'\n },\n split_type: {\n type: 'string',\n enum: [ 'BalanceAccount',\n 'AcquiringFees',\n 'PaymentFee',\n 'AdyenFees',\n 'AdyenCommission',\n 'AdyenMarkup',\n 'Interchange',\n 'SchemeFee',\n 'Commission',\n 'TopUp',\n 'Vat'\n ]\n },\n account: {\n type: 'string',\n description: 'The unique identifier of the account to which the split amount is allocated.'\n },\n description: {\n type: 'string',\n description: 'Description for the part of the payment that will be allocated to the specified account.'\n }\n },\n required: [ 'amount',\n 'reference',\n 'split_type'\n ]\n }\n },\n store: {\n type: 'string',\n description: 'The store identifier'\n }\n },\n required: [ 'split_items'\n ]\n },\n xendit_split_sub_merchant_data: {\n type: 'object',\n description: 'Fee information to be charged on the payment being collected for sub-merchant via xendit',\n properties: {\n for_user_id: {\n type: 'string',\n description: 'The sub-account user-id that you want to make this transaction for.'\n }\n },\n required: [ 'for_user_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -29,19 +29,28 @@ export const tool: Tool = { type: 'object', description: 'You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.', + additionalProperties: true, }, reason: { type: 'string', description: 'An arbitrary string attached to the object. Often useful for displaying to users and your customer support executive', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['refund_id'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { refund_id, ...body } = args as any; - return asTextContentResult(await client.refunds.update(refund_id, body)); + const { refund_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.refunds.update(refund_id, body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/relay/create-relay.ts b/packages/mcp-server/src/tools/relay/create-relay.ts index 4ac47ed..03f8a8d 100644 --- a/packages/mcp-server/src/tools/relay/create-relay.ts +++ b/packages/mcp-server/src/tools/relay/create-relay.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_relay', - description: 'Creates a relay request.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nCreates a relay request.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/relay_response',\n $defs: {\n relay_response: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'The unique identifier for the Relay'\n },\n connector_id: {\n type: 'string',\n description: 'Identifier of the connector ( merchant connector account ) which was chosen to make the payment'\n },\n connector_resource_id: {\n type: 'string',\n description: 'The identifier that is associated to a resource at the connector reference to which the relay request is being made'\n },\n profile_id: {\n type: 'string',\n description: 'The business profile that is associated with this relay request.'\n },\n status: {\n type: 'string',\n enum: [ 'created',\n 'pending',\n 'success',\n 'failure'\n ]\n },\n type: {\n $ref: '#/$defs/relay_type'\n },\n connector_reference_id: {\n type: 'string',\n description: 'The identifier that is associated to a resource at the connector to which the relay request is being made'\n },\n data: {\n $ref: '#/$defs/relay_data'\n },\n error: {\n type: 'object',\n properties: {\n code: {\n type: 'string',\n description: 'The error code'\n },\n message: {\n type: 'string',\n description: 'The error message'\n }\n },\n required: [ 'code',\n 'message'\n ]\n }\n },\n required: [ 'id',\n 'connector_id',\n 'connector_resource_id',\n 'profile_id',\n 'status',\n 'type'\n ]\n },\n relay_type: {\n type: 'string',\n enum: [ 'refund'\n ]\n },\n relay_data: {\n type: 'object',\n properties: {\n refund: {\n type: 'object',\n properties: {\n amount: {\n type: 'integer',\n description: 'The amount that is being refunded'\n },\n currency: {\n $ref: '#/$defs/currency'\n },\n reason: {\n type: 'string',\n description: 'The reason for the refund'\n }\n },\n required: [ 'amount',\n 'currency'\n ]\n }\n },\n required: [ 'refund'\n ]\n },\n currency: {\n type: 'string',\n description: 'The three-letter ISO 4217 currency code (e.g., \"USD\", \"EUR\") for the payment amount. This field is mandatory for creating a payment.',\n enum: [ 'AED',\n 'AFN',\n 'ALL',\n 'AMD',\n 'ANG',\n 'AOA',\n 'ARS',\n 'AUD',\n 'AWG',\n 'AZN',\n 'BAM',\n 'BBD',\n 'BDT',\n 'BGN',\n 'BHD',\n 'BIF',\n 'BMD',\n 'BND',\n 'BOB',\n 'BRL',\n 'BSD',\n 'BTN',\n 'BWP',\n 'BYN',\n 'BZD',\n 'CAD',\n 'CDF',\n 'CHF',\n 'CLF',\n 'CLP',\n 'CNY',\n 'COP',\n 'CRC',\n 'CUC',\n 'CUP',\n 'CVE',\n 'CZK',\n 'DJF',\n 'DKK',\n 'DOP',\n 'DZD',\n 'EGP',\n 'ERN',\n 'ETB',\n 'EUR',\n 'FJD',\n 'FKP',\n 'GBP',\n 'GEL',\n 'GHS',\n 'GIP',\n 'GMD',\n 'GNF',\n 'GTQ',\n 'GYD',\n 'HKD',\n 'HNL',\n 'HRK',\n 'HTG',\n 'HUF',\n 'IDR',\n 'ILS',\n 'INR',\n 'IQD',\n 'IRR',\n 'ISK',\n 'JMD',\n 'JOD',\n 'JPY',\n 'KES',\n 'KGS',\n 'KHR',\n 'KMF',\n 'KPW',\n 'KRW',\n 'KWD',\n 'KYD',\n 'KZT',\n 'LAK',\n 'LBP',\n 'LKR',\n 'LRD',\n 'LSL',\n 'LYD',\n 'MAD',\n 'MDL',\n 'MGA',\n 'MKD',\n 'MMK',\n 'MNT',\n 'MOP',\n 'MRU',\n 'MUR',\n 'MVR',\n 'MWK',\n 'MXN',\n 'MYR',\n 'MZN',\n 'NAD',\n 'NGN',\n 'NIO',\n 'NOK',\n 'NPR',\n 'NZD',\n 'OMR',\n 'PAB',\n 'PEN',\n 'PGK',\n 'PHP',\n 'PKR',\n 'PLN',\n 'PYG',\n 'QAR',\n 'RON',\n 'RSD',\n 'RUB',\n 'RWF',\n 'SAR',\n 'SBD',\n 'SCR',\n 'SDG',\n 'SEK',\n 'SGD',\n 'SHP',\n 'SLE',\n 'SLL',\n 'SOS',\n 'SRD',\n 'SSP',\n 'STD',\n 'STN',\n 'SVC',\n 'SYP',\n 'SZL',\n 'THB',\n 'TJS',\n 'TMT',\n 'TND',\n 'TOP',\n 'TRY',\n 'TTD',\n 'TWD',\n 'TZS',\n 'UAH',\n 'UGX',\n 'USD',\n 'UYU',\n 'UZS',\n 'VES',\n 'VND',\n 'VUV',\n 'WST',\n 'XAF',\n 'XCD',\n 'XOF',\n 'XPF',\n 'YER',\n 'ZAR',\n 'ZMW',\n 'ZWL'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -43,7 +44,14 @@ export const tool: Tool = { data: { $ref: '#/$defs/relay_data', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['connector_id', 'connector_resource_id', 'type', 'X-Idempotency-Key', 'X-Profile-Id'], $defs: { relay_type: { type: 'string', @@ -241,11 +249,12 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.relay.create(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.relay.create(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/relay/retrieve-relay.ts b/packages/mcp-server/src/tools/relay/retrieve-relay.ts index 3a4fca4..a105733 100644 --- a/packages/mcp-server/src/tools/relay/retrieve-relay.ts +++ b/packages/mcp-server/src/tools/relay/retrieve-relay.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_relay', - description: 'Retrieves a relay details.', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieves a relay details.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/relay_response',\n $defs: {\n relay_response: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'The unique identifier for the Relay'\n },\n connector_id: {\n type: 'string',\n description: 'Identifier of the connector ( merchant connector account ) which was chosen to make the payment'\n },\n connector_resource_id: {\n type: 'string',\n description: 'The identifier that is associated to a resource at the connector reference to which the relay request is being made'\n },\n profile_id: {\n type: 'string',\n description: 'The business profile that is associated with this relay request.'\n },\n status: {\n type: 'string',\n enum: [ 'created',\n 'pending',\n 'success',\n 'failure'\n ]\n },\n type: {\n $ref: '#/$defs/relay_type'\n },\n connector_reference_id: {\n type: 'string',\n description: 'The identifier that is associated to a resource at the connector to which the relay request is being made'\n },\n data: {\n $ref: '#/$defs/relay_data'\n },\n error: {\n type: 'object',\n properties: {\n code: {\n type: 'string',\n description: 'The error code'\n },\n message: {\n type: 'string',\n description: 'The error message'\n }\n },\n required: [ 'code',\n 'message'\n ]\n }\n },\n required: [ 'id',\n 'connector_id',\n 'connector_resource_id',\n 'profile_id',\n 'status',\n 'type'\n ]\n },\n relay_type: {\n type: 'string',\n enum: [ 'refund'\n ]\n },\n relay_data: {\n type: 'object',\n properties: {\n refund: {\n type: 'object',\n properties: {\n amount: {\n type: 'integer',\n description: 'The amount that is being refunded'\n },\n currency: {\n $ref: '#/$defs/currency'\n },\n reason: {\n type: 'string',\n description: 'The reason for the refund'\n }\n },\n required: [ 'amount',\n 'currency'\n ]\n }\n },\n required: [ 'refund'\n ]\n },\n currency: {\n type: 'string',\n description: 'The three-letter ISO 4217 currency code (e.g., \"USD\", \"EUR\") for the payment amount. This field is mandatory for creating a payment.',\n enum: [ 'AED',\n 'AFN',\n 'ALL',\n 'AMD',\n 'ANG',\n 'AOA',\n 'ARS',\n 'AUD',\n 'AWG',\n 'AZN',\n 'BAM',\n 'BBD',\n 'BDT',\n 'BGN',\n 'BHD',\n 'BIF',\n 'BMD',\n 'BND',\n 'BOB',\n 'BRL',\n 'BSD',\n 'BTN',\n 'BWP',\n 'BYN',\n 'BZD',\n 'CAD',\n 'CDF',\n 'CHF',\n 'CLF',\n 'CLP',\n 'CNY',\n 'COP',\n 'CRC',\n 'CUC',\n 'CUP',\n 'CVE',\n 'CZK',\n 'DJF',\n 'DKK',\n 'DOP',\n 'DZD',\n 'EGP',\n 'ERN',\n 'ETB',\n 'EUR',\n 'FJD',\n 'FKP',\n 'GBP',\n 'GEL',\n 'GHS',\n 'GIP',\n 'GMD',\n 'GNF',\n 'GTQ',\n 'GYD',\n 'HKD',\n 'HNL',\n 'HRK',\n 'HTG',\n 'HUF',\n 'IDR',\n 'ILS',\n 'INR',\n 'IQD',\n 'IRR',\n 'ISK',\n 'JMD',\n 'JOD',\n 'JPY',\n 'KES',\n 'KGS',\n 'KHR',\n 'KMF',\n 'KPW',\n 'KRW',\n 'KWD',\n 'KYD',\n 'KZT',\n 'LAK',\n 'LBP',\n 'LKR',\n 'LRD',\n 'LSL',\n 'LYD',\n 'MAD',\n 'MDL',\n 'MGA',\n 'MKD',\n 'MMK',\n 'MNT',\n 'MOP',\n 'MRU',\n 'MUR',\n 'MVR',\n 'MWK',\n 'MXN',\n 'MYR',\n 'MZN',\n 'NAD',\n 'NGN',\n 'NIO',\n 'NOK',\n 'NPR',\n 'NZD',\n 'OMR',\n 'PAB',\n 'PEN',\n 'PGK',\n 'PHP',\n 'PKR',\n 'PLN',\n 'PYG',\n 'QAR',\n 'RON',\n 'RSD',\n 'RUB',\n 'RWF',\n 'SAR',\n 'SBD',\n 'SCR',\n 'SDG',\n 'SEK',\n 'SGD',\n 'SHP',\n 'SLE',\n 'SLL',\n 'SOS',\n 'SRD',\n 'SSP',\n 'STD',\n 'STN',\n 'SVC',\n 'SYP',\n 'SZL',\n 'THB',\n 'TJS',\n 'TMT',\n 'TND',\n 'TOP',\n 'TRY',\n 'TTD',\n 'TWD',\n 'TZS',\n 'UAH',\n 'UGX',\n 'USD',\n 'UYU',\n 'UZS',\n 'VES',\n 'VND',\n 'VUV',\n 'WST',\n 'XAF',\n 'XCD',\n 'XOF',\n 'XPF',\n 'YER',\n 'ZAR',\n 'ZMW',\n 'ZWL'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -27,13 +28,23 @@ export const tool: Tool = { 'X-Profile-Id': { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['relay_id', 'X-Profile-Id'], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { relay_id, ...body } = args as any; - return asTextContentResult(await client.relay.retrieve(relay_id, body)); + const { relay_id, jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.relay.retrieve(relay_id, body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/routing/activate-routing.ts b/packages/mcp-server/src/tools/routing/activate-routing.ts index 1a9e8a1..70470e3 100644 --- a/packages/mcp-server/src/tools/routing/activate-routing.ts +++ b/packages/mcp-server/src/tools/routing/activate-routing.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,20 +17,31 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'activate_routing', - description: 'Activate a routing config', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nActivate a routing config\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/routing_dictionary_record',\n $defs: {\n routing_dictionary_record: {\n type: 'object',\n properties: {\n id: {\n type: 'string'\n },\n created_at: {\n type: 'integer'\n },\n description: {\n type: 'string'\n },\n kind: {\n type: 'string',\n enum: [ 'single',\n 'priority',\n 'volume_split',\n 'advanced',\n 'dynamic',\n 'three_ds_decision_rule'\n ]\n },\n modified_at: {\n type: 'integer'\n },\n name: {\n type: 'string'\n },\n profile_id: {\n type: 'string'\n },\n algorithm_for: {\n $ref: '#/$defs/transaction_type'\n },\n decision_engine_routing_id: {\n type: 'string'\n }\n },\n required: [ 'id',\n 'created_at',\n 'description',\n 'kind',\n 'modified_at',\n 'name',\n 'profile_id'\n ]\n },\n transaction_type: {\n type: 'string',\n enum: [ 'payment',\n 'payout',\n 'three_ds_authentication'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { routing_algorithm_id: { type: 'string', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['routing_algorithm_id'], }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { routing_algorithm_id, ...body } = args as any; - return asTextContentResult(await client.routing.activate(routing_algorithm_id)); + const { routing_algorithm_id, jq_filter, ...body } = args as any; + return asTextContentResult( + await maybeFilter(jq_filter, await client.routing.activate(routing_algorithm_id)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/routing/create-routing.ts b/packages/mcp-server/src/tools/routing/create-routing.ts index 715f644..4434c02 100644 --- a/packages/mcp-server/src/tools/routing/create-routing.ts +++ b/packages/mcp-server/src/tools/routing/create-routing.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -37,6 +36,7 @@ export const tool: Tool = { $ref: '#/$defs/transaction_type', }, }, + required: [], $defs: { static_routing_algorithm: { anyOf: [ @@ -98,6 +98,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -148,6 +149,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -374,6 +376,7 @@ export const tool: Tool = { type: 'object', description: 'Additional metadata that the Static Analyzer and Backend does not touch.\nThis can be used to store useful information for the frontend and is required for communication\nbetween the static analyzer and the frontend.', + additionalProperties: true, }, value: { anyOf: [ @@ -551,6 +554,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/routing/deactivate-routing.ts b/packages/mcp-server/src/tools/routing/deactivate-routing.ts index 6680154..9e5eb70 100644 --- a/packages/mcp-server/src/tools/routing/deactivate-routing.ts +++ b/packages/mcp-server/src/tools/routing/deactivate-routing.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -37,6 +36,7 @@ export const tool: Tool = { $ref: '#/$defs/transaction_type', }, }, + required: [], $defs: { static_routing_algorithm: { anyOf: [ @@ -98,6 +98,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -148,6 +149,7 @@ export const tool: Tool = { }, metadata: { type: 'object', + additionalProperties: true, }, rules: { type: 'object', @@ -374,6 +376,7 @@ export const tool: Tool = { type: 'object', description: 'Additional metadata that the Static Analyzer and Backend does not touch.\nThis can be used to store useful information for the frontend and is required for communication\nbetween the static analyzer and the frontend.', + additionalProperties: true, }, value: { anyOf: [ @@ -551,6 +554,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/routing/default/profile/retrieve-default-routing-profile.ts b/packages/mcp-server/src/tools/routing/default/profile/retrieve-default-routing-profile.ts index bfdbbdd..c90cf5e 100644 --- a/packages/mcp-server/src/tools/routing/default/profile/retrieve-default-routing-profile.ts +++ b/packages/mcp-server/src/tools/routing/default/profile/retrieve-default-routing-profile.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,15 +17,28 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_default_routing_profile', - description: 'Retrieve default config for profiles', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieve default config for profiles\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/default_routing_config',\n $defs: {\n default_routing_config: {\n type: 'object',\n properties: {\n connectors: {\n type: 'array',\n items: {\n $ref: '#/$defs/routable_connector_choice'\n }\n },\n profile_id: {\n type: 'string'\n }\n },\n required: [ 'connectors',\n 'profile_id'\n ]\n },\n routable_connector_choice: {\n type: 'object',\n description: 'Routable Connector chosen for a payment',\n properties: {\n connector: {\n type: 'string',\n description: 'RoutableConnectors are the subset of Connectors that are eligible for payments routing',\n enum: [ 'adyenplatform',\n 'stripe_billing_test',\n 'phonypay',\n 'fauxpay',\n 'pretendpay',\n 'stripe_test',\n 'adyen_test',\n 'checkout_test',\n 'paypal_test',\n 'aci',\n 'adyen',\n 'airwallex',\n 'archipel',\n 'authorizedotnet',\n 'bankofamerica',\n 'barclaycard',\n 'billwerk',\n 'bitpay',\n 'bambora',\n 'bamboraapac',\n 'bluesnap',\n 'boku',\n 'braintree',\n 'cashtocode',\n 'chargebee',\n 'checkout',\n 'coinbase',\n 'coingate',\n 'cryptopay',\n 'cybersource',\n 'datatrans',\n 'deutschebank',\n 'digitalvirgo',\n 'dlocal',\n 'ebanx',\n 'elavon',\n 'facilitapay',\n 'fiserv',\n 'fiservemea',\n 'fiuu',\n 'forte',\n 'getnet',\n 'globalpay',\n 'globepay',\n 'gocardless',\n 'hipay',\n 'helcim',\n 'iatapay',\n 'inespay',\n 'itaubank',\n 'jpmorgan',\n 'klarna',\n 'mifinity',\n 'mollie',\n 'moneris',\n 'multisafepay',\n 'nexinets',\n 'nexixpay',\n 'nmi',\n 'nomupay',\n 'noon',\n 'novalnet',\n 'nuvei',\n 'opennode',\n 'paybox',\n 'payme',\n 'payone',\n 'paypal',\n 'paystack',\n 'payu',\n 'placetopay',\n 'powertranz',\n 'prophetpay',\n 'rapyd',\n 'razorpay',\n 'recurly',\n 'redsys',\n 'riskified',\n 'shift4',\n 'signifyd',\n 'square',\n 'stax',\n 'stripe',\n 'stripebilling',\n 'trustpay',\n 'tokenio',\n 'tsys',\n 'volt',\n 'wellsfargo',\n 'wise',\n 'worldline',\n 'worldpay',\n 'worldpayvantiv',\n 'worldpayxml',\n 'xendit',\n 'zen',\n 'plaid',\n 'zsl'\n ]\n },\n merchant_connector_id: {\n type: 'string'\n }\n },\n required: [ 'connector'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', - properties: {}, + properties: { + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, + }, + required: [], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - return asTextContentResult(await client.routing.default.profile.retrieve()); + const { jq_filter } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.routing.default.profile.retrieve())); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/routing/default/profile/update-default-routing-profile.ts b/packages/mcp-server/src/tools/routing/default/profile/update-default-routing-profile.ts index 602c1c1..b61dea7 100644 --- a/packages/mcp-server/src/tools/routing/default/profile/update-default-routing-profile.ts +++ b/packages/mcp-server/src/tools/routing/default/profile/update-default-routing-profile.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_default_routing_profile', - description: 'Update default config for profiles', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nUpdate default config for profiles\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/default_routing_config',\n $defs: {\n default_routing_config: {\n type: 'object',\n properties: {\n connectors: {\n type: 'array',\n items: {\n $ref: '#/$defs/routable_connector_choice'\n }\n },\n profile_id: {\n type: 'string'\n }\n },\n required: [ 'connectors',\n 'profile_id'\n ]\n },\n routable_connector_choice: {\n type: 'object',\n description: 'Routable Connector chosen for a payment',\n properties: {\n connector: {\n type: 'string',\n description: 'RoutableConnectors are the subset of Connectors that are eligible for payments routing',\n enum: [ 'adyenplatform',\n 'stripe_billing_test',\n 'phonypay',\n 'fauxpay',\n 'pretendpay',\n 'stripe_test',\n 'adyen_test',\n 'checkout_test',\n 'paypal_test',\n 'aci',\n 'adyen',\n 'airwallex',\n 'archipel',\n 'authorizedotnet',\n 'bankofamerica',\n 'barclaycard',\n 'billwerk',\n 'bitpay',\n 'bambora',\n 'bamboraapac',\n 'bluesnap',\n 'boku',\n 'braintree',\n 'cashtocode',\n 'chargebee',\n 'checkout',\n 'coinbase',\n 'coingate',\n 'cryptopay',\n 'cybersource',\n 'datatrans',\n 'deutschebank',\n 'digitalvirgo',\n 'dlocal',\n 'ebanx',\n 'elavon',\n 'facilitapay',\n 'fiserv',\n 'fiservemea',\n 'fiuu',\n 'forte',\n 'getnet',\n 'globalpay',\n 'globepay',\n 'gocardless',\n 'hipay',\n 'helcim',\n 'iatapay',\n 'inespay',\n 'itaubank',\n 'jpmorgan',\n 'klarna',\n 'mifinity',\n 'mollie',\n 'moneris',\n 'multisafepay',\n 'nexinets',\n 'nexixpay',\n 'nmi',\n 'nomupay',\n 'noon',\n 'novalnet',\n 'nuvei',\n 'opennode',\n 'paybox',\n 'payme',\n 'payone',\n 'paypal',\n 'paystack',\n 'payu',\n 'placetopay',\n 'powertranz',\n 'prophetpay',\n 'rapyd',\n 'razorpay',\n 'recurly',\n 'redsys',\n 'riskified',\n 'shift4',\n 'signifyd',\n 'square',\n 'stax',\n 'stripe',\n 'stripebilling',\n 'trustpay',\n 'tokenio',\n 'tsys',\n 'volt',\n 'wellsfargo',\n 'wise',\n 'worldline',\n 'worldpay',\n 'worldpayvantiv',\n 'worldpayxml',\n 'xendit',\n 'zen',\n 'plaid',\n 'zsl'\n ]\n },\n merchant_connector_id: {\n type: 'string'\n }\n },\n required: [ 'connector'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -30,7 +31,14 @@ export const tool: Tool = { $ref: '#/$defs/routable_connector_choice', }, }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['profile_id', 'body'], $defs: { routable_connector_choice: { type: 'object', @@ -149,11 +157,14 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const { profile_id, ...body } = args as any; - return asTextContentResult(await client.routing.default.profile.update(profile_id, body)); + const { profile_id, jq_filter, ...body } = args as any; + return asTextContentResult( + await maybeFilter(jq_filter, await client.routing.default.profile.update(profile_id, body)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/routing/default/retrieve-routing-default.ts b/packages/mcp-server/src/tools/routing/default/retrieve-routing-default.ts index 3b944ff..66a4e5a 100644 --- a/packages/mcp-server/src/tools/routing/default/retrieve-routing-default.ts +++ b/packages/mcp-server/src/tools/routing/default/retrieve-routing-default.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,15 +17,28 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_routing_default', - description: 'Retrieve default fallback config', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieve default fallback config\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/routable_connector_choice'\n },\n $defs: {\n routable_connector_choice: {\n type: 'object',\n description: 'Routable Connector chosen for a payment',\n properties: {\n connector: {\n type: 'string',\n description: 'RoutableConnectors are the subset of Connectors that are eligible for payments routing',\n enum: [ 'adyenplatform',\n 'stripe_billing_test',\n 'phonypay',\n 'fauxpay',\n 'pretendpay',\n 'stripe_test',\n 'adyen_test',\n 'checkout_test',\n 'paypal_test',\n 'aci',\n 'adyen',\n 'airwallex',\n 'archipel',\n 'authorizedotnet',\n 'bankofamerica',\n 'barclaycard',\n 'billwerk',\n 'bitpay',\n 'bambora',\n 'bamboraapac',\n 'bluesnap',\n 'boku',\n 'braintree',\n 'cashtocode',\n 'chargebee',\n 'checkout',\n 'coinbase',\n 'coingate',\n 'cryptopay',\n 'cybersource',\n 'datatrans',\n 'deutschebank',\n 'digitalvirgo',\n 'dlocal',\n 'ebanx',\n 'elavon',\n 'facilitapay',\n 'fiserv',\n 'fiservemea',\n 'fiuu',\n 'forte',\n 'getnet',\n 'globalpay',\n 'globepay',\n 'gocardless',\n 'hipay',\n 'helcim',\n 'iatapay',\n 'inespay',\n 'itaubank',\n 'jpmorgan',\n 'klarna',\n 'mifinity',\n 'mollie',\n 'moneris',\n 'multisafepay',\n 'nexinets',\n 'nexixpay',\n 'nmi',\n 'nomupay',\n 'noon',\n 'novalnet',\n 'nuvei',\n 'opennode',\n 'paybox',\n 'payme',\n 'payone',\n 'paypal',\n 'paystack',\n 'payu',\n 'placetopay',\n 'powertranz',\n 'prophetpay',\n 'rapyd',\n 'razorpay',\n 'recurly',\n 'redsys',\n 'riskified',\n 'shift4',\n 'signifyd',\n 'square',\n 'stax',\n 'stripe',\n 'stripebilling',\n 'trustpay',\n 'tokenio',\n 'tsys',\n 'volt',\n 'wellsfargo',\n 'wise',\n 'worldline',\n 'worldpay',\n 'worldpayvantiv',\n 'worldpayxml',\n 'xendit',\n 'zen',\n 'plaid',\n 'zsl'\n ]\n },\n merchant_connector_id: {\n type: 'string'\n }\n },\n required: [ 'connector'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', - properties: {}, + properties: { + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, + }, + required: [], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - return asTextContentResult(await client.routing.default.retrieve()); + const { jq_filter } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.routing.default.retrieve())); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/routing/default/update-routing-default.ts b/packages/mcp-server/src/tools/routing/default/update-routing-default.ts index 1cb364e..a9ec24e 100644 --- a/packages/mcp-server/src/tools/routing/default/update-routing-default.ts +++ b/packages/mcp-server/src/tools/routing/default/update-routing-default.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_routing_default', - description: 'Update default fallback config', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nUpdate default fallback config\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/routable_connector_choice'\n },\n $defs: {\n routable_connector_choice: {\n type: 'object',\n description: 'Routable Connector chosen for a payment',\n properties: {\n connector: {\n type: 'string',\n description: 'RoutableConnectors are the subset of Connectors that are eligible for payments routing',\n enum: [ 'adyenplatform',\n 'stripe_billing_test',\n 'phonypay',\n 'fauxpay',\n 'pretendpay',\n 'stripe_test',\n 'adyen_test',\n 'checkout_test',\n 'paypal_test',\n 'aci',\n 'adyen',\n 'airwallex',\n 'archipel',\n 'authorizedotnet',\n 'bankofamerica',\n 'barclaycard',\n 'billwerk',\n 'bitpay',\n 'bambora',\n 'bamboraapac',\n 'bluesnap',\n 'boku',\n 'braintree',\n 'cashtocode',\n 'chargebee',\n 'checkout',\n 'coinbase',\n 'coingate',\n 'cryptopay',\n 'cybersource',\n 'datatrans',\n 'deutschebank',\n 'digitalvirgo',\n 'dlocal',\n 'ebanx',\n 'elavon',\n 'facilitapay',\n 'fiserv',\n 'fiservemea',\n 'fiuu',\n 'forte',\n 'getnet',\n 'globalpay',\n 'globepay',\n 'gocardless',\n 'hipay',\n 'helcim',\n 'iatapay',\n 'inespay',\n 'itaubank',\n 'jpmorgan',\n 'klarna',\n 'mifinity',\n 'mollie',\n 'moneris',\n 'multisafepay',\n 'nexinets',\n 'nexixpay',\n 'nmi',\n 'nomupay',\n 'noon',\n 'novalnet',\n 'nuvei',\n 'opennode',\n 'paybox',\n 'payme',\n 'payone',\n 'paypal',\n 'paystack',\n 'payu',\n 'placetopay',\n 'powertranz',\n 'prophetpay',\n 'rapyd',\n 'razorpay',\n 'recurly',\n 'redsys',\n 'riskified',\n 'shift4',\n 'signifyd',\n 'square',\n 'stax',\n 'stripe',\n 'stripebilling',\n 'trustpay',\n 'tokenio',\n 'tsys',\n 'volt',\n 'wellsfargo',\n 'wise',\n 'worldline',\n 'worldpay',\n 'worldpayvantiv',\n 'worldpayxml',\n 'xendit',\n 'zen',\n 'plaid',\n 'zsl'\n ]\n },\n merchant_connector_id: {\n type: 'string'\n }\n },\n required: [ 'connector'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -27,7 +28,14 @@ export const tool: Tool = { $ref: '#/$defs/routable_connector_choice', }, }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: ['body'], $defs: { routable_connector_choice: { type: 'object', @@ -146,11 +154,12 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.routing.default.update(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.routing.default.update(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/routing/list-routing.ts b/packages/mcp-server/src/tools/routing/list-routing.ts index 5b1448f..3c1af9c 100644 --- a/packages/mcp-server/src/tools/routing/list-routing.ts +++ b/packages/mcp-server/src/tools/routing/list-routing.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { maybeFilter } from 'hyperswitch-mcp/filtering'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -17,7 +17,8 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_routing', - description: 'List all routing configs', + description: + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nList all routing configs\n\n# Response Schema\n```json\n{\n anyOf: [ {\n type: 'object',\n properties: {\n merchant_id: {\n type: 'string'\n },\n records: {\n type: 'array',\n items: {\n $ref: '#/$defs/routing_dictionary_record'\n }\n },\n active_id: {\n type: 'string'\n }\n },\n required: [ 'merchant_id',\n 'records'\n ]\n },\n {\n type: 'array',\n items: {\n $ref: '#/$defs/routing_dictionary_record'\n }\n }\n ],\n $defs: {\n routing_dictionary_record: {\n type: 'object',\n properties: {\n id: {\n type: 'string'\n },\n created_at: {\n type: 'integer'\n },\n description: {\n type: 'string'\n },\n kind: {\n type: 'string',\n enum: [ 'single',\n 'priority',\n 'volume_split',\n 'advanced',\n 'dynamic',\n 'three_ds_decision_rule'\n ]\n },\n modified_at: {\n type: 'integer'\n },\n name: {\n type: 'string'\n },\n profile_id: {\n type: 'string'\n },\n algorithm_for: {\n $ref: '#/$defs/transaction_type'\n },\n decision_engine_routing_id: {\n type: 'string'\n }\n },\n required: [ 'id',\n 'created_at',\n 'description',\n 'kind',\n 'modified_at',\n 'name',\n 'profile_id'\n ]\n },\n transaction_type: {\n type: 'string',\n enum: [ 'payment',\n 'payout',\n 'three_ds_authentication'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -33,13 +34,23 @@ export const tool: Tool = { type: 'string', description: 'The unique identifier for a merchant profile', }, + jq_filter: { + type: 'string', + title: 'jq Filter', + description: + 'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).', + }, }, + required: [], + }, + annotations: { + readOnlyHint: true, }, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { - const body = args as any; - return asTextContentResult(await client.routing.list(body)); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.routing.list(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/routing/retrieve-active-routing.ts b/packages/mcp-server/src/tools/routing/retrieve-active-routing.ts index 6ed61c4..1dd426d 100644 --- a/packages/mcp-server/src/tools/routing/retrieve-active-routing.ts +++ b/packages/mcp-server/src/tools/routing/retrieve-active-routing.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -26,6 +25,10 @@ export const tool: Tool = { description: 'The unique identifier for a merchant profile', }, }, + required: [], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/routing/retrieve-routing.ts b/packages/mcp-server/src/tools/routing/retrieve-routing.ts index b6b2432..3a58aa7 100644 --- a/packages/mcp-server/src/tools/routing/retrieve-routing.ts +++ b/packages/mcp-server/src/tools/routing/retrieve-routing.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -25,6 +24,10 @@ export const tool: Tool = { type: 'string', }, }, + required: ['routing_algorithm_id'], + }, + annotations: { + readOnlyHint: true, }, }; diff --git a/packages/mcp-server/src/tools/three-ds-decision/execute-three-ds-decision.ts b/packages/mcp-server/src/tools/three-ds-decision/execute-three-ds-decision.ts index 48e066e..7784492 100644 --- a/packages/mcp-server/src/tools/three-ds-decision/execute-three-ds-decision.ts +++ b/packages/mcp-server/src/tools/three-ds-decision/execute-three-ds-decision.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { asTextContentResult } from 'hyperswitch-mcp/tools/types'; +import { Metadata, asTextContentResult } from 'hyperswitch-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import type { Metadata } from '../'; import Hyperswitch from 'hyperswitch'; export const metadata: Metadata = { @@ -91,7 +90,6 @@ export const tool: Tool = { enum: ['web', 'android', 'ios'], }, }, - required: [], }, issuer: { type: 'object', @@ -118,6 +116,7 @@ export const tool: Tool = { required: ['card_network'], }, }, + required: ['payment', 'routing_id'], $defs: { currency: { type: 'string', @@ -563,6 +562,7 @@ export const tool: Tool = { }, }, }, + annotations: {}, }; export const handler = async (client: Hyperswitch, args: Record | undefined) => { diff --git a/packages/mcp-server/src/tools/types.ts b/packages/mcp-server/src/tools/types.ts index fbf5c90..50c4085 100644 --- a/packages/mcp-server/src/tools/types.ts +++ b/packages/mcp-server/src/tools/types.ts @@ -47,7 +47,7 @@ export type HandlerFunction = ( args: Record | undefined, ) => Promise; -export function asTextContentResult(result: Object): ToolCallResult { +export function asTextContentResult(result: unknown): ToolCallResult { return { content: [ { diff --git a/packages/mcp-server/tests/options.test.ts b/packages/mcp-server/tests/options.test.ts index f7661d6..a8a5b81 100644 --- a/packages/mcp-server/tests/options.test.ts +++ b/packages/mcp-server/tests/options.test.ts @@ -1,5 +1,6 @@ -import { parseOptions } from '../src/options'; +import { parseCLIOptions, parseQueryOptions } from '../src/options'; import { Filter } from '../src/tools'; +import { parseEmbeddedJSON } from '../src/compat'; // Mock process.argv const mockArgv = (args: string[]) => { @@ -10,7 +11,7 @@ const mockArgv = (args: string[]) => { }; }; -describe('parseOptions', () => { +describe('parseCLIOptions', () => { it('should parse basic filter options', () => { const cleanup = mockArgv([ '--tool=test-tool', @@ -19,7 +20,7 @@ describe('parseOptions', () => { '--tag=test-tag', ]); - const result = parseOptions(); + const result = parseCLIOptions(); expect(result.filters).toEqual([ { type: 'tag', op: 'include', value: 'test-tag' }, @@ -28,15 +29,7 @@ describe('parseOptions', () => { { type: 'operation', op: 'include', value: 'read' }, ] as Filter[]); - // Default client capabilities - expect(result.capabilities).toEqual({ - topLevelUnions: true, - validJson: true, - refs: true, - unions: true, - formats: true, - toolNameLength: undefined, - }); + expect(result.capabilities).toEqual({}); expect(result.list).toBe(false); @@ -51,7 +44,7 @@ describe('parseOptions', () => { '--no-tag=exclude-tag', ]); - const result = parseOptions(); + const result = parseCLIOptions(); expect(result.filters).toEqual([ { type: 'tag', op: 'exclude', value: 'exclude-tag' }, @@ -60,14 +53,7 @@ describe('parseOptions', () => { { type: 'operation', op: 'exclude', value: 'write' }, ] as Filter[]); - expect(result.capabilities).toEqual({ - topLevelUnions: true, - validJson: true, - refs: true, - unions: true, - formats: true, - toolNameLength: undefined, - }); + expect(result.capabilities).toEqual({}); cleanup(); }); @@ -75,7 +61,7 @@ describe('parseOptions', () => { it('should parse client presets', () => { const cleanup = mockArgv(['--client=openai-agents']); - const result = parseOptions(); + const result = parseCLIOptions(); expect(result.client).toEqual('openai-agents'); @@ -91,14 +77,13 @@ describe('parseOptions', () => { '--capability=tool-name-length=40', ]); - const result = parseOptions(); + const result = parseCLIOptions(); expect(result.capabilities).toEqual({ topLevelUnions: true, validJson: true, refs: true, unions: true, - formats: true, toolNameLength: 40, }); @@ -108,7 +93,7 @@ describe('parseOptions', () => { it('should handle list option', () => { const cleanup = mockArgv(['--list']); - const result = parseOptions(); + const result = parseCLIOptions(); expect(result.list).toBe(true); @@ -118,7 +103,7 @@ describe('parseOptions', () => { it('should handle multiple filters of the same type', () => { const cleanup = mockArgv(['--tool=tool1', '--tool=tool2', '--resource=res1', '--resource=res2']); - const result = parseOptions(); + const result = parseCLIOptions(); expect(result.filters).toEqual([ { type: 'resource', op: 'include', value: 'res1' }, @@ -137,7 +122,7 @@ describe('parseOptions', () => { '--capability=top-level-unions,valid-json,unions', ]); - const result = parseOptions(); + const result = parseCLIOptions(); expect(result.filters).toEqual([ { type: 'resource', op: 'include', value: 'res1' }, @@ -149,10 +134,7 @@ describe('parseOptions', () => { expect(result.capabilities).toEqual({ topLevelUnions: true, validJson: true, - refs: true, unions: true, - formats: true, - toolNameLength: undefined, }); cleanup(); @@ -165,7 +147,7 @@ describe('parseOptions', () => { const originalError = console.error; console.error = jest.fn(); - expect(() => parseOptions()).toThrow(); + expect(() => parseCLIOptions()).toThrow(); console.error = originalError; cleanup(); @@ -178,9 +160,359 @@ describe('parseOptions', () => { const originalError = console.error; console.error = jest.fn(); - expect(() => parseOptions()).toThrow(); + expect(() => parseCLIOptions()).toThrow(); console.error = originalError; cleanup(); }); }); + +describe('parseQueryOptions', () => { + const defaultOptions = { + client: undefined, + includeDynamicTools: undefined, + includeAllTools: undefined, + filters: [], + capabilities: { + topLevelUnions: true, + validJson: true, + refs: true, + unions: true, + formats: true, + toolNameLength: undefined, + }, + }; + + it('should parse basic filter options from query string', () => { + const query = 'tool=test-tool&resource=test-resource&operation=read&tag=test-tag'; + const result = parseQueryOptions(defaultOptions, query); + + expect(result.filters).toEqual([ + { type: 'resource', op: 'include', value: 'test-resource' }, + { type: 'operation', op: 'include', value: 'read' }, + { type: 'tag', op: 'include', value: 'test-tag' }, + { type: 'tool', op: 'include', value: 'test-tool' }, + ]); + + expect(result.capabilities).toEqual({ + topLevelUnions: true, + validJson: true, + refs: true, + unions: true, + formats: true, + toolNameLength: undefined, + }); + }); + + it('should parse exclusion filters from query string', () => { + const query = 'no_tool=exclude-tool&no_resource=exclude-resource&no_operation=write&no_tag=exclude-tag'; + const result = parseQueryOptions(defaultOptions, query); + + expect(result.filters).toEqual([ + { type: 'resource', op: 'exclude', value: 'exclude-resource' }, + { type: 'operation', op: 'exclude', value: 'write' }, + { type: 'tag', op: 'exclude', value: 'exclude-tag' }, + { type: 'tool', op: 'exclude', value: 'exclude-tool' }, + ]); + }); + + it('should parse client option from query string', () => { + const query = 'client=openai-agents'; + const result = parseQueryOptions(defaultOptions, query); + + expect(result.client).toBe('openai-agents'); + }); + + it('should parse client capabilities from query string', () => { + const query = 'capability=top-level-unions&capability=valid-json&capability=tool-name-length%3D40'; + const result = parseQueryOptions(defaultOptions, query); + + expect(result.capabilities).toEqual({ + topLevelUnions: true, + validJson: true, + refs: true, + unions: true, + formats: true, + toolNameLength: 40, + }); + }); + + it('should parse no-capability options from query string', () => { + const query = 'no_capability=top-level-unions&no_capability=refs&no_capability=formats'; + const result = parseQueryOptions(defaultOptions, query); + + expect(result.capabilities).toEqual({ + topLevelUnions: false, + validJson: true, + refs: false, + unions: true, + formats: false, + toolNameLength: undefined, + }); + }); + + it('should parse tools options from query string', () => { + const query = 'tools=dynamic&tools=all'; + const result = parseQueryOptions(defaultOptions, query); + + expect(result.includeDynamicTools).toBe(true); + expect(result.includeAllTools).toBe(true); + }); + + it('should parse no-tools options from query string', () => { + const query = 'tools=dynamic&tools=all&no_tools=dynamic'; + const result = parseQueryOptions(defaultOptions, query); + + expect(result.includeDynamicTools).toBe(false); + expect(result.includeAllTools).toBe(true); + }); + + it('should handle array values in query string', () => { + const query = 'tool[]=tool1&tool[]=tool2&resource[]=res1&resource[]=res2'; + const result = parseQueryOptions(defaultOptions, query); + + expect(result.filters).toEqual([ + { type: 'resource', op: 'include', value: 'res1' }, + { type: 'resource', op: 'include', value: 'res2' }, + { type: 'tool', op: 'include', value: 'tool1' }, + { type: 'tool', op: 'include', value: 'tool2' }, + ]); + }); + + it('should merge with default options', () => { + const defaultWithFilters = { + ...defaultOptions, + filters: [{ type: 'tag' as const, op: 'include' as const, value: 'existing-tag' }], + client: 'cursor' as const, + includeDynamicTools: true, + }; + + const query = 'tool=new-tool&resource=new-resource'; + const result = parseQueryOptions(defaultWithFilters, query); + + expect(result.filters).toEqual([ + { type: 'tag', op: 'include', value: 'existing-tag' }, + { type: 'resource', op: 'include', value: 'new-resource' }, + { type: 'tool', op: 'include', value: 'new-tool' }, + ]); + + expect(result.client).toBe('cursor'); + expect(result.includeDynamicTools).toBe(true); + }); + + it('should override client from default options', () => { + const defaultWithClient = { + ...defaultOptions, + client: 'cursor' as const, + }; + + const query = 'client=openai-agents'; + const result = parseQueryOptions(defaultWithClient, query); + + expect(result.client).toBe('openai-agents'); + }); + + it('should merge capabilities with default options', () => { + const defaultWithCapabilities = { + ...defaultOptions, + capabilities: { + topLevelUnions: false, + validJson: false, + refs: true, + unions: true, + formats: true, + toolNameLength: 30, + }, + }; + + const query = 'capability=top-level-unions&no_capability=refs'; + const result = parseQueryOptions(defaultWithCapabilities, query); + + expect(result.capabilities).toEqual({ + topLevelUnions: true, + validJson: false, + refs: false, + unions: true, + formats: true, + toolNameLength: 30, + }); + }); + + it('should handle empty query string', () => { + const query = ''; + const result = parseQueryOptions(defaultOptions, query); + + expect(result).toEqual(defaultOptions); + }); + + it('should handle invalid query string gracefully', () => { + const query = 'invalid=value&operation=invalid-operation'; + + // Should throw due to Zod validation for invalid operation + expect(() => parseQueryOptions(defaultOptions, query)).toThrow(); + }); + + it('should preserve default undefined values when not specified', () => { + const defaultWithUndefined = { + ...defaultOptions, + client: undefined, + includeDynamicTools: undefined, + includeAllTools: undefined, + }; + + const query = 'tool=test-tool'; + const result = parseQueryOptions(defaultWithUndefined, query); + + expect(result.client).toBeUndefined(); + expect(result.includeDynamicTools).toBeFalsy(); + expect(result.includeAllTools).toBeFalsy(); + }); + + it('should handle complex query with mixed include and exclude filters', () => { + const query = + 'tool=include-tool&no_tool=exclude-tool&resource=include-res&no_resource=exclude-res&operation=read&tag=include-tag&no_tag=exclude-tag'; + const result = parseQueryOptions(defaultOptions, query); + + expect(result.filters).toEqual([ + { type: 'resource', op: 'include', value: 'include-res' }, + { type: 'operation', op: 'include', value: 'read' }, + { type: 'tag', op: 'include', value: 'include-tag' }, + { type: 'tool', op: 'include', value: 'include-tool' }, + { type: 'resource', op: 'exclude', value: 'exclude-res' }, + { type: 'tag', op: 'exclude', value: 'exclude-tag' }, + { type: 'tool', op: 'exclude', value: 'exclude-tool' }, + ]); + }); +}); + +describe('parseEmbeddedJSON', () => { + it('should not change non-string values', () => { + const args = { + numberProp: 42, + booleanProp: true, + objectProp: { nested: 'value' }, + arrayProp: [1, 2, 3], + nullProp: null, + undefinedProp: undefined, + }; + const schema = {}; + + const result = parseEmbeddedJSON(args, schema); + + expect(result).toBe(args); // Should return original object since no changes made + expect(result['numberProp']).toBe(42); + expect(result['booleanProp']).toBe(true); + expect(result['objectProp']).toEqual({ nested: 'value' }); + expect(result['arrayProp']).toEqual([1, 2, 3]); + expect(result['nullProp']).toBe(null); + expect(result['undefinedProp']).toBe(undefined); + }); + + it('should parse valid JSON objects in string properties', () => { + const args = { + jsonObjectString: '{"key": "value", "number": 123}', + regularString: 'not json', + }; + const schema = {}; + + const result = parseEmbeddedJSON(args, schema); + + expect(result).not.toBe(args); // Should return new object since changes were made + expect(result['jsonObjectString']).toEqual({ key: 'value', number: 123 }); + expect(result['regularString']).toBe('not json'); + }); + + it('should leave invalid JSON in string properties unchanged', () => { + const args = { + invalidJson1: '{"key": value}', // Missing quotes around value + invalidJson2: '{key: "value"}', // Missing quotes around key + invalidJson3: '{"key": "value",}', // Trailing comma + invalidJson4: 'just a regular string', + emptyString: '', + }; + const schema = {}; + + const result = parseEmbeddedJSON(args, schema); + + expect(result).toBe(args); // Should return original object since no changes made + expect(result['invalidJson1']).toBe('{"key": value}'); + expect(result['invalidJson2']).toBe('{key: "value"}'); + expect(result['invalidJson3']).toBe('{"key": "value",}'); + expect(result['invalidJson4']).toBe('just a regular string'); + expect(result['emptyString']).toBe(''); + }); + + it('should not parse JSON primitives in string properties', () => { + const args = { + numberString: '123', + floatString: '45.67', + negativeNumberString: '-89', + booleanTrueString: 'true', + booleanFalseString: 'false', + nullString: 'null', + jsonArrayString: '[1, 2, 3, "test"]', + regularString: 'not json', + }; + const schema = {}; + + const result = parseEmbeddedJSON(args, schema); + + expect(result).toBe(args); // Should return original object since no changes made + expect(result['numberString']).toBe('123'); + expect(result['floatString']).toBe('45.67'); + expect(result['negativeNumberString']).toBe('-89'); + expect(result['booleanTrueString']).toBe('true'); + expect(result['booleanFalseString']).toBe('false'); + expect(result['nullString']).toBe('null'); + expect(result['jsonArrayString']).toBe('[1, 2, 3, "test"]'); + expect(result['regularString']).toBe('not json'); + }); + + it('should handle mixed valid objects and other JSON types', () => { + const args = { + validObject: '{"success": true}', + invalidObject: '{"missing": quote}', + validNumber: '42', + validArray: '[1, 2, 3]', + keepAsString: 'hello world', + nonString: 123, + }; + const schema = {}; + + const result = parseEmbeddedJSON(args, schema); + + expect(result).not.toBe(args); // Should return new object since some changes were made + expect(result['validObject']).toEqual({ success: true }); + expect(result['invalidObject']).toBe('{"missing": quote}'); + expect(result['validNumber']).toBe('42'); // Not parsed, remains string + expect(result['validArray']).toBe('[1, 2, 3]'); // Not parsed, remains string + expect(result['keepAsString']).toBe('hello world'); + expect(result['nonString']).toBe(123); + }); + + it('should return original object when no strings are present', () => { + const args = { + number: 42, + boolean: true, + object: { key: 'value' }, + }; + const schema = {}; + + const result = parseEmbeddedJSON(args, schema); + + expect(result).toBe(args); // Should return original object since no changes made + }); + + it('should return original object when all strings are invalid JSON', () => { + const args = { + string1: 'hello', + string2: 'world', + string3: 'not json at all', + }; + const schema = {}; + + const result = parseEmbeddedJSON(args, schema); + + expect(result).toBe(args); // Should return original object since no changes made + }); +}); diff --git a/packages/mcp-server/yarn.lock b/packages/mcp-server/yarn.lock index 9970ec3..707a2de 100644 --- a/packages/mcp-server/yarn.lock +++ b/packages/mcp-server/yarn.lock @@ -584,15 +584,17 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@modelcontextprotocol/sdk@^1.6.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@modelcontextprotocol/sdk/-/sdk-1.11.1.tgz#c7f4a1432872ef10130f5d9b0072060c17a3946b" - integrity sha512-9LfmxKTb1v+vUS1/emSk1f5ePmTLkb9Le9AxOB5T0XM59EUumwcS45z05h7aiZx3GI0Bl7mjb3FMEglYj+acuQ== +"@modelcontextprotocol/sdk@^1.11.5": + version "1.17.3" + resolved "https://registry.yarnpkg.com/@modelcontextprotocol/sdk/-/sdk-1.17.3.tgz#cf92354220f0183d28179e96a9bf3a8f6d3211ae" + integrity sha512-JPwUKWSsbzx+DLFznf/QZ32Qa+ptfbUlHhRLrBQBAFu9iI1iYvizM4p+zhhRDceSsPutXp4z+R/HPVphlIiclg== dependencies: + ajv "^6.12.6" content-type "^1.0.5" cors "^2.8.5" - cross-spawn "^7.0.3" + cross-spawn "^7.0.5" eventsource "^3.0.2" + eventsource-parser "^3.0.0" express "^5.0.1" express-rate-limit "^7.5.0" pkce-challenge "^5.0.0" @@ -708,6 +710,40 @@ dependencies: "@babel/types" "^7.20.7" +"@types/body-parser@*": + version "1.19.6" + resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.6.tgz#1859bebb8fd7dac9918a45d54c1971ab8b5af474" + integrity sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g== + dependencies: + "@types/connect" "*" + "@types/node" "*" + +"@types/connect@*": + version "3.4.38" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858" + integrity sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug== + dependencies: + "@types/node" "*" + +"@types/express-serve-static-core@^5.0.0": + version "5.0.7" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-5.0.7.tgz#2fa94879c9d46b11a5df4c74ac75befd6b283de6" + integrity sha512-R+33OsgWw7rOhD1emjU7dzCDHucJrgJXMA5PYCzJxVil0dsyx5iBEPHqpPfiKNJQb7lZ1vxwoLR4Z87bBUpeGQ== + dependencies: + "@types/node" "*" + "@types/qs" "*" + "@types/range-parser" "*" + "@types/send" "*" + +"@types/express@^5.0.3": + version "5.0.3" + resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.3.tgz#6c4bc6acddc2e2a587142e1d8be0bce20757e956" + integrity sha512-wGA0NX93b19/dZC1J18tKWVIYWyyF2ZjT9vin/NRu0qzzvfVzWjs04iq2rQ3H65vCTQYlRqs3YHfY7zjdV+9Kw== + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "^5.0.0" + "@types/serve-static" "*" + "@types/graceful-fs@^4.1.3": version "4.1.9" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" @@ -715,6 +751,11 @@ dependencies: "@types/node" "*" +"@types/http-errors@*": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.5.tgz#5b749ab2b16ba113423feb1a64a95dcd30398472" + integrity sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg== + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.6" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" @@ -742,6 +783,11 @@ expect "^29.0.0" pretty-format "^29.0.0" +"@types/mime@^1": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" + integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== + "@types/node@*": version "22.15.17" resolved "https://registry.yarnpkg.com/@types/node/-/node-22.15.17.tgz#355ccec95f705b664e4332bb64a7f07db30b7055" @@ -749,6 +795,33 @@ dependencies: undici-types "~6.21.0" +"@types/qs@*": + version "6.14.0" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.14.0.tgz#d8b60cecf62f2db0fb68e5e006077b9178b85de5" + integrity sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ== + +"@types/range-parser@*": + version "1.2.7" + resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" + integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== + +"@types/send@*": + version "0.17.5" + resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.5.tgz#d991d4f2b16f2b1ef497131f00a9114290791e74" + integrity sha512-z6F2D3cOStZvuk2SaP6YrwkNO65iTZcwA2ZkSABegdkAh/lf+Aa/YQndZVfmEXT5vgAp6zv06VQ3ejSVjAny4w== + dependencies: + "@types/mime" "^1" + "@types/node" "*" + +"@types/serve-static@*": + version "1.15.8" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.8.tgz#8180c3fbe4a70e8f00b9f70b9ba7f08f35987877" + integrity sha512-roei0UY3LhpOJvjbIP6ZZFngyLKl5dskOtDhxY5THRSpO+ZI+nzJ+m5yUMzGrp89YRa7lvknKkMYjqQFGwA7Sg== + dependencies: + "@types/http-errors" "*" + "@types/node" "*" + "@types/send" "*" + "@types/stack-utils@^2.0.0": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" @@ -885,7 +958,7 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -ajv@^6.12.4: +ajv@^6.12.4, ajv@^6.12.6: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -1246,7 +1319,7 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.2, cross-spawn@^7.0.3, cross-spawn@^7.0.5: version "7.0.6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== @@ -1514,6 +1587,11 @@ etag@^1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== +eventsource-parser@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/eventsource-parser/-/eventsource-parser-3.0.3.tgz#e9af1d40b77e6268cdcbc767321e8b9f066adea8" + integrity sha512-nVpZkTMM9rF6AQ9gPJpFsNAMt48wIzB5TQgiTLdHiuO8XEDhUgZEhqKlZWXbIzo9VmJ/HvysHqEaVeD5v9TPvA== + eventsource-parser@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/eventsource-parser/-/eventsource-parser-3.0.1.tgz#5e358dba9a55ba64ca90da883c4ca35bd82467bd" @@ -1562,7 +1640,7 @@ express-rate-limit@^7.5.0: resolved "https://registry.yarnpkg.com/express-rate-limit/-/express-rate-limit-7.5.0.tgz#6a67990a724b4fbbc69119419feef50c51e8b28f" integrity sha512-eB5zbQh5h+VenMPM3fh+nw1YExi5nMr6HUCR62ELSP11huvxm/Uir1H1QEyTkk5QX6A58pX6NmaTMceKZ0Eodg== -express@^5.0.1: +express@^5.0.1, express@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/express/-/express-5.1.0.tgz#d31beaf715a0016f0d53f47d3b4d7acf28c75cc9" integrity sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA== @@ -2404,6 +2482,10 @@ jest@^29.4.0: import-local "^3.0.2" jest-cli "^29.7.0" +"jq-web@https://github.com/stainless-api/jq-web/releases/download/v0.8.6/jq-web.tar.gz": + version "0.8.6" + resolved "https://github.com/stainless-api/jq-web/releases/download/v0.8.6/jq-web.tar.gz#14d0e126987736e82e964d675c3838b5944faa6f" + js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -3305,9 +3387,9 @@ ts-node@^10.5.0: v8-compile-cache-lib "^3.0.1" yn "3.1.1" -"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz": - version "1.1.7" - resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz#52f40adf8b808bd0b633346d11cc4a8aeea465cd" +"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz": + version "1.1.8" + resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz#f544b359b8f05e607771ffacc280e58201476b04" dependencies: debug "^4.3.7" fast-glob "^3.3.2" @@ -3508,7 +3590,17 @@ zod-to-json-schema@^3.24.1, zod-to-json-schema@^3.24.5: resolved "https://registry.yarnpkg.com/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz#d1095440b147fb7c2093812a53c54df8d5df50a3" integrity sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g== -zod@^3.23.8, zod@^3.24.4: +zod-validation-error@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/zod-validation-error/-/zod-validation-error-4.0.1.tgz#a105723eb40299578a6a38cb86647068f6d005b1" + integrity sha512-F3rdaCOHs5ViJ5YTz5zzRtfkQdMdIeKudJAoxy7yB/2ZMEHw73lmCAcQw11r7++20MyGl4WV59EVh7A9rNAyog== + +zod@^3.23.8: version "3.24.4" resolved "https://registry.yarnpkg.com/zod/-/zod-3.24.4.tgz#e2e2cca5faaa012d76e527d0d36622e0a90c315f" integrity sha512-OdqJE9UDRPwWsrHjLN2F8bPxvwJBK22EHLWtanu0LSYr5YqzsaaW3RMgmjwr8Rypg5k+meEJdSPXJZXE/yqOMg== + +zod@^3.25.20: + version "3.25.76" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.25.76.tgz#26841c3f6fd22a6a2760e7ccb719179768471e34" + integrity sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ== diff --git a/scripts/bootstrap b/scripts/bootstrap index 0af58e2..062a034 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -15,4 +15,4 @@ echo "==> Installing Node dependencies…" PACKAGE_MANAGER=$(command -v yarn >/dev/null 2>&1 && echo "yarn" || echo "npm") -$PACKAGE_MANAGER install +$PACKAGE_MANAGER install "$@" diff --git a/scripts/mock b/scripts/mock index d2814ae..0b28f6e 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" fi diff --git a/scripts/test b/scripts/test index 2049e31..7bce051 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! prism_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the prism command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" echo exit 1 diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index c0f3652..936f093 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -12,7 +12,7 @@ if [[ "$SIGNED_URL" == "null" ]]; then exit 1 fi -UPLOAD_RESPONSE=$(tar -cz dist | curl -v -X PUT \ +UPLOAD_RESPONSE=$(tar -cz "${BUILD_PATH:-dist}" | curl -v -X PUT \ -H "Content-Type: application/gzip" \ --data-binary @- "$SIGNED_URL" 2>&1) diff --git a/src/client.ts b/src/client.ts index f4422a7..7b48a91 100644 --- a/src/client.ts +++ b/src/client.ts @@ -345,6 +345,8 @@ export interface ClientOptions { * * Note that request timeouts are retried by default, so in a worst-case scenario you may wait * much longer than this timeout before the promise succeeds or fails. + * + * @unit milliseconds */ timeout?: number | undefined; /** @@ -500,7 +502,7 @@ export class Hyperswitch { * Create a new client instance re-using the same options given to the current client with optional overriding. */ withOptions(options: Partial): this { - return new (this.constructor as any as new (props: ClientOptions) => typeof this)({ + const client = new (this.constructor as any as new (props: ClientOptions) => typeof this)({ ...this._options, baseURL: this.baseURL, maxRetries: this.maxRetries, @@ -515,6 +517,7 @@ export class Hyperswitch { publishableKey: this.publishableKey, ...options, }); + return client; } /** @@ -532,28 +535,28 @@ export class Hyperswitch { return; } - protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined { + protected async authHeaders(opts: FinalRequestOptions): Promise { return buildHeaders([ - this.apiKeyAuth(opts), - this.ephemeralKeyAuth(opts), - this.jwtKeyAuth(opts), - this.publishableKeyAuth(opts), + await this.apiKeyAuth(opts), + await this.ephemeralKeyAuth(opts), + await this.jwtKeyAuth(opts), + await this.publishableKeyAuth(opts), ]); } - protected apiKeyAuth(opts: FinalRequestOptions): NullableHeaders | undefined { + protected async apiKeyAuth(opts: FinalRequestOptions): Promise { return buildHeaders([{ 'api-key': this.apiKey }]); } - protected ephemeralKeyAuth(opts: FinalRequestOptions): NullableHeaders | undefined { + protected async ephemeralKeyAuth(opts: FinalRequestOptions): Promise { return buildHeaders([{ 'api-key': this.ephemeralKey }]); } - protected jwtKeyAuth(opts: FinalRequestOptions): NullableHeaders | undefined { + protected async jwtKeyAuth(opts: FinalRequestOptions): Promise { return buildHeaders([{ Authorization: `Bearer ${this.jwtKey}` }]); } - protected publishableKeyAuth(opts: FinalRequestOptions): NullableHeaders | undefined { + protected async publishableKeyAuth(opts: FinalRequestOptions): Promise { return buildHeaders([{ 'api-key': this.publishableKey }]); } @@ -669,7 +672,9 @@ export class Hyperswitch { await this.prepareOptions(options); - const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining }); + const { req, url, timeout } = await this.buildRequest(options, { + retryCount: maxRetries - retriesRemaining, + }); await this.prepareRequest(req, { url, options }); @@ -697,7 +702,7 @@ export class Hyperswitch { const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError); const headersTime = Date.now(); - if (response instanceof Error) { + if (response instanceof globalThis.Error) { const retryMessage = `retrying, ${retriesRemaining} attempts remaining`; if (options.signal?.aborted) { throw new Errors.APIUserAbortError(); @@ -747,7 +752,7 @@ export class Hyperswitch { } with status ${response.status} in ${headersTime - startTime}ms`; if (!response.ok) { - const shouldRetry = this.shouldRetry(response); + const shouldRetry = await this.shouldRetry(response); if (retriesRemaining && shouldRetry) { const retryMessage = `retrying, ${retriesRemaining} attempts remaining`; @@ -846,7 +851,7 @@ export class Hyperswitch { } } - private shouldRetry(response: Response): boolean { + private async shouldRetry(response: Response): Promise { // Note this is not a standard header. const shouldRetryHeader = response.headers.get('x-should-retry'); @@ -923,10 +928,10 @@ export class Hyperswitch { return sleepSeconds * jitter * 1000; } - buildRequest( + async buildRequest( inputOptions: FinalRequestOptions, { retryCount = 0 }: { retryCount?: number } = {}, - ): { req: FinalizedRequestInit; url: string; timeout: number } { + ): Promise<{ req: FinalizedRequestInit; url: string; timeout: number }> { const options = { ...inputOptions }; const { method, path, query, defaultBaseURL } = options; @@ -934,7 +939,7 @@ export class Hyperswitch { if ('timeout' in options) validatePositiveInteger('timeout', options.timeout); options.timeout = options.timeout ?? this.timeout; const { bodyHeaders, body } = this.buildBody({ options }); - const reqHeaders = this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount }); + const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount }); const req: FinalizedRequestInit = { method, @@ -950,7 +955,7 @@ export class Hyperswitch { return { req, url, timeout: options.timeout }; } - private buildHeaders({ + private async buildHeaders({ options, method, bodyHeaders, @@ -960,7 +965,7 @@ export class Hyperswitch { method: HTTPMethod; bodyHeaders: HeadersLike; retryCount: number; - }): Headers { + }): Promise { let idempotencyHeaders: HeadersLike = {}; if (this.idempotencyHeader && method !== 'get') { if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey(); @@ -976,7 +981,7 @@ export class Hyperswitch { ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}), ...getPlatformHeaders(), }, - this.authHeaders(options), + await this.authHeaders(options), this._options.defaultHeaders, bodyHeaders, options.headers, @@ -1004,7 +1009,7 @@ export class Hyperswitch { // Preserve legacy string encoding behavior for now headers.values.has('content-type')) || // `Blob` is superset of `File` - body instanceof Blob || + ((globalThis as any).Blob && body instanceof (globalThis as any).Blob) || // `FormData` -> `multipart/form-data` body instanceof FormData || // `URLSearchParams` -> `application/x-www-form-urlencoded` @@ -1064,6 +1069,7 @@ export class Hyperswitch { authentication: API.Authentication = new API.Authentication(this); accounts: API.Accounts = new API.Accounts(this); } + Hyperswitch.Payments = Payments; Hyperswitch.PaymentLink = PaymentLink; Hyperswitch.Relay = Relay; @@ -1084,6 +1090,7 @@ Hyperswitch.ProfileAcquirers = ProfileAcquirers; Hyperswitch.ThreeDSDecisionResource = ThreeDSDecisionResource; Hyperswitch.Authentication = Authentication; Hyperswitch.Accounts = Accounts; + export declare namespace Hyperswitch { export type RequestOptions = Opts.RequestOptions; diff --git a/src/internal/request-options.ts b/src/internal/request-options.ts index 7de032f..2aabf9a 100644 --- a/src/internal/request-options.ts +++ b/src/internal/request-options.ts @@ -9,17 +9,70 @@ import { type HeadersLike } from './headers'; export type FinalRequestOptions = RequestOptions & { method: HTTPMethod; path: string }; export type RequestOptions = { + /** + * The HTTP method for the request (e.g., 'get', 'post', 'put', 'delete'). + */ method?: HTTPMethod; + + /** + * The URL path for the request. + * + * @example "/v1/foo" + */ path?: string; + + /** + * Query parameters to include in the request URL. + */ query?: object | undefined | null; + + /** + * The request body. Can be a string, JSON object, FormData, or other supported types. + */ body?: unknown; + + /** + * HTTP headers to include with the request. Can be a Headers object, plain object, or array of tuples. + */ headers?: HeadersLike; + + /** + * The maximum number of times that the client will retry a request in case of a + * temporary failure, like a network error or a 5XX error from the server. + * + * @default 2 + */ maxRetries?: number; + stream?: boolean | undefined; + + /** + * The maximum amount of time (in milliseconds) that the client should wait for a response + * from the server before timing out a single request. + * + * @unit milliseconds + */ timeout?: number; + + /** + * Additional `RequestInit` options to be passed to the underlying `fetch` call. + * These options will be merged with the client's default fetch options. + */ fetchOptions?: MergedRequestInit; + + /** + * An AbortSignal that can be used to cancel the request. + */ signal?: AbortSignal | undefined | null; + + /** + * A unique key for this request to enable idempotency. + */ idempotencyKey?: string; + + /** + * Override the default base URL for this specific request. + */ defaultBaseURL?: string | undefined; __binaryResponse?: boolean | undefined; diff --git a/src/version.ts b/src/version.ts index 2c77b51..b0bfd9e 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.0.1-alpha.1'; // x-release-please-version +export const VERSION = '0.1.0-alpha.1'; // x-release-please-version diff --git a/tests/api-resources/accounts/accounts.test.ts b/tests/api-resources/accounts/accounts.test.ts index bbbd384..c568382 100644 --- a/tests/api-resources/accounts/accounts.test.ts +++ b/tests/api-resources/accounts/accounts.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource accounts', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.accounts.create({ merchant_id: 'merchant_abc' }); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource accounts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.accounts.create({ merchant_id: 'merchant_abc', @@ -85,7 +85,7 @@ describe('resource accounts', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.accounts.retrieve('account_id'); const rawResponse = await responsePromise.asResponse(); @@ -97,7 +97,7 @@ describe('resource accounts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: only required params', async () => { const responsePromise = client.accounts.update('account_id', { merchant_id: 'merchant_abc' }); const rawResponse = await responsePromise.asResponse(); @@ -109,7 +109,7 @@ describe('resource accounts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: required and optional params', async () => { const response = await client.accounts.update('account_id', { merchant_id: 'merchant_abc', @@ -169,7 +169,7 @@ describe('resource accounts', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('delete', async () => { const responsePromise = client.accounts.delete('account_id'); const rawResponse = await responsePromise.asResponse(); @@ -181,7 +181,7 @@ describe('resource accounts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('kv: only required params', async () => { const responsePromise = client.accounts.kv('account_id', { kv_enabled: true }); const rawResponse = await responsePromise.asResponse(); @@ -193,12 +193,12 @@ describe('resource accounts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('kv: required and optional params', async () => { const response = await client.accounts.kv('account_id', { kv_enabled: true }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('listPaymentMethods', async () => { const responsePromise = client.accounts.listPaymentMethods(); const rawResponse = await responsePromise.asResponse(); @@ -210,7 +210,7 @@ describe('resource accounts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('listPaymentMethods: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( diff --git a/tests/api-resources/accounts/business-profile/business-profile.test.ts b/tests/api-resources/accounts/business-profile/business-profile.test.ts index 1757507..3b95364 100644 --- a/tests/api-resources/accounts/business-profile/business-profile.test.ts +++ b/tests/api-resources/accounts/business-profile/business-profile.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource businessProfile', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create', async () => { const responsePromise = client.accounts.businessProfile.create('account_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource businessProfile', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: only required params', async () => { const responsePromise = client.accounts.businessProfile.retrieve('profile_id', { account_id: 'account_id', @@ -37,14 +37,14 @@ describe('resource businessProfile', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: required and optional params', async () => { const response = await client.accounts.businessProfile.retrieve('profile_id', { account_id: 'account_id', }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: only required params', async () => { const responsePromise = client.accounts.businessProfile.update('profile_id', { account_id: 'account_id', @@ -58,7 +58,7 @@ describe('resource businessProfile', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: required and optional params', async () => { const response = await client.accounts.businessProfile.update('profile_id', { account_id: 'account_id', @@ -208,7 +208,7 @@ describe('resource businessProfile', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list', async () => { const responsePromise = client.accounts.businessProfile.list('account_id'); const rawResponse = await responsePromise.asResponse(); @@ -220,7 +220,7 @@ describe('resource businessProfile', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('delete: only required params', async () => { const responsePromise = client.accounts.businessProfile.delete('profile_id', { account_id: 'account_id', @@ -234,7 +234,7 @@ describe('resource businessProfile', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('delete: required and optional params', async () => { const response = await client.accounts.businessProfile.delete('profile_id', { account_id: 'account_id' }); }); diff --git a/tests/api-resources/accounts/business-profile/dynamic-routing/contracts.test.ts b/tests/api-resources/accounts/business-profile/dynamic-routing/contracts.test.ts index 0eb3af5..8906a2e 100644 --- a/tests/api-resources/accounts/business-profile/dynamic-routing/contracts.test.ts +++ b/tests/api-resources/accounts/business-profile/dynamic-routing/contracts.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource contracts', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('toggle: only required params', async () => { const responsePromise = client.accounts.businessProfile.dynamicRouting.contracts.toggle('profile_id', { account_id: 'account_id', @@ -26,7 +26,7 @@ describe('resource contracts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('toggle: required and optional params', async () => { const response = await client.accounts.businessProfile.dynamicRouting.contracts.toggle('profile_id', { account_id: 'account_id', @@ -36,7 +36,7 @@ describe('resource contracts', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('updateConfig: only required params', async () => { const responsePromise = client.accounts.businessProfile.dynamicRouting.contracts.updateConfig( 'algorithm_id', @@ -51,7 +51,7 @@ describe('resource contracts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('updateConfig: required and optional params', async () => { const response = await client.accounts.businessProfile.dynamicRouting.contracts.updateConfig( 'algorithm_id', diff --git a/tests/api-resources/accounts/business-profile/dynamic-routing/elimination.test.ts b/tests/api-resources/accounts/business-profile/dynamic-routing/elimination.test.ts index d6ba28c..a665d46 100644 --- a/tests/api-resources/accounts/business-profile/dynamic-routing/elimination.test.ts +++ b/tests/api-resources/accounts/business-profile/dynamic-routing/elimination.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource elimination', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('toggle: only required params', async () => { const responsePromise = client.accounts.businessProfile.dynamicRouting.elimination.toggle('profile_id', { account_id: 'account_id', @@ -26,7 +26,7 @@ describe('resource elimination', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('toggle: required and optional params', async () => { const response = await client.accounts.businessProfile.dynamicRouting.elimination.toggle('profile_id', { account_id: 'account_id', diff --git a/tests/api-resources/accounts/business-profile/dynamic-routing/success-based.test.ts b/tests/api-resources/accounts/business-profile/dynamic-routing/success-based.test.ts index ba3377d..dafd065 100644 --- a/tests/api-resources/accounts/business-profile/dynamic-routing/success-based.test.ts +++ b/tests/api-resources/accounts/business-profile/dynamic-routing/success-based.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource successBased', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('toggle: only required params', async () => { const responsePromise = client.accounts.businessProfile.dynamicRouting.successBased.toggle('profile_id', { account_id: 'account_id', @@ -26,7 +26,7 @@ describe('resource successBased', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('toggle: required and optional params', async () => { const response = await client.accounts.businessProfile.dynamicRouting.successBased.toggle('profile_id', { account_id: 'account_id', @@ -34,7 +34,7 @@ describe('resource successBased', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('updateConfig: only required params', async () => { const responsePromise = client.accounts.businessProfile.dynamicRouting.successBased.updateConfig( 'algorithm_id', @@ -49,7 +49,7 @@ describe('resource successBased', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('updateConfig: required and optional params', async () => { const response = await client.accounts.businessProfile.dynamicRouting.successBased.updateConfig( 'algorithm_id', diff --git a/tests/api-resources/accounts/connectors.test.ts b/tests/api-resources/accounts/connectors.test.ts index e962cf1..cb721b4 100644 --- a/tests/api-resources/accounts/connectors.test.ts +++ b/tests/api-resources/accounts/connectors.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource connectors', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.accounts.connectors.create('account_id', { connector_name: 'adyen', @@ -26,7 +26,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.accounts.connectors.create('account_id', { connector_name: 'adyen', @@ -103,7 +103,7 @@ describe('resource connectors', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: only required params', async () => { const responsePromise = client.accounts.connectors.retrieve('merchant_connector_id', { account_id: 'account_id', @@ -117,14 +117,14 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: required and optional params', async () => { const response = await client.accounts.connectors.retrieve('merchant_connector_id', { account_id: 'account_id', }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: only required params', async () => { const responsePromise = client.accounts.connectors.update('merchant_connector_id', { account_id: 'account_id', @@ -140,7 +140,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: required and optional params', async () => { const response = await client.accounts.connectors.update('merchant_connector_id', { account_id: 'account_id', @@ -201,7 +201,7 @@ describe('resource connectors', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list', async () => { const responsePromise = client.accounts.connectors.list('account_id'); const rawResponse = await responsePromise.asResponse(); @@ -213,7 +213,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('delete: only required params', async () => { const responsePromise = client.accounts.connectors.delete('merchant_connector_id', { account_id: 'account_id', @@ -227,7 +227,7 @@ describe('resource connectors', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('delete: required and optional params', async () => { const response = await client.accounts.connectors.delete('merchant_connector_id', { account_id: 'account_id', diff --git a/tests/api-resources/api-keys.test.ts b/tests/api-resources/api-keys.test.ts index bc6214f..c8f1277 100644 --- a/tests/api-resources/api-keys.test.ts +++ b/tests/api-resources/api-keys.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource apiKeys', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.apiKeys.create('merchant_id', { expiration: 'never', @@ -26,7 +26,7 @@ describe('resource apiKeys', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.apiKeys.create('merchant_id', { expiration: 'never', @@ -35,7 +35,7 @@ describe('resource apiKeys', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: only required params', async () => { const responsePromise = client.apiKeys.retrieve('key_id', { merchant_id: 'merchant_id' }); const rawResponse = await responsePromise.asResponse(); @@ -47,12 +47,12 @@ describe('resource apiKeys', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: required and optional params', async () => { const response = await client.apiKeys.retrieve('key_id', { merchant_id: 'merchant_id' }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: only required params', async () => { const responsePromise = client.apiKeys.update('key_id', { merchant_id: 'merchant_id' }); const rawResponse = await responsePromise.asResponse(); @@ -64,7 +64,7 @@ describe('resource apiKeys', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: required and optional params', async () => { const response = await client.apiKeys.update('key_id', { merchant_id: 'merchant_id', @@ -74,7 +74,7 @@ describe('resource apiKeys', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list', async () => { const responsePromise = client.apiKeys.list('merchant_id'); const rawResponse = await responsePromise.asResponse(); @@ -86,7 +86,7 @@ describe('resource apiKeys', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -94,7 +94,7 @@ describe('resource apiKeys', () => { ).rejects.toThrow(Hyperswitch.NotFoundError); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('revoke: only required params', async () => { const responsePromise = client.apiKeys.revoke('key_id', { merchant_id: 'merchant_id' }); const rawResponse = await responsePromise.asResponse(); @@ -106,7 +106,7 @@ describe('resource apiKeys', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('revoke: required and optional params', async () => { const response = await client.apiKeys.revoke('key_id', { merchant_id: 'merchant_id' }); }); diff --git a/tests/api-resources/authentication.test.ts b/tests/api-resources/authentication.test.ts index f3b3fcd..f6c0cfe 100644 --- a/tests/api-resources/authentication.test.ts +++ b/tests/api-resources/authentication.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource authentication', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.authentication.create({ amount: 0, currency: 'AED' }); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource authentication', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.authentication.create({ amount: 0, diff --git a/tests/api-resources/blocklist.test.ts b/tests/api-resources/blocklist.test.ts index ee41a66..1e8d1a0 100644 --- a/tests/api-resources/blocklist.test.ts +++ b/tests/api-resources/blocklist.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource blocklist', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.blocklist.create({ data: 'data', type: 'card_bin' }); const rawResponse = await responsePromise.asResponse(); @@ -23,12 +23,12 @@ describe('resource blocklist', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.blocklist.create({ data: 'data', type: 'card_bin' }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: only required params', async () => { const responsePromise = client.blocklist.retrieve({ data_kind: 'payment_method' }); const rawResponse = await responsePromise.asResponse(); @@ -40,12 +40,12 @@ describe('resource blocklist', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: required and optional params', async () => { const response = await client.blocklist.retrieve({ data_kind: 'payment_method' }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('delete: only required params', async () => { const responsePromise = client.blocklist.delete({ data: 'data', type: 'card_bin' }); const rawResponse = await responsePromise.asResponse(); @@ -57,12 +57,12 @@ describe('resource blocklist', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('delete: required and optional params', async () => { const response = await client.blocklist.delete({ data: 'data', type: 'card_bin' }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('toggle: only required params', async () => { const responsePromise = client.blocklist.toggle({ status: true }); const rawResponse = await responsePromise.asResponse(); @@ -74,7 +74,7 @@ describe('resource blocklist', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('toggle: required and optional params', async () => { const response = await client.blocklist.toggle({ status: true }); }); diff --git a/tests/api-resources/customers/customers.test.ts b/tests/api-resources/customers/customers.test.ts index 21de1e1..dbd0c0e 100644 --- a/tests/api-resources/customers/customers.test.ts +++ b/tests/api-resources/customers/customers.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource customers', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create', async () => { const responsePromise = client.customers.create({}); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource customers', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.customers.retrieve('customer_id'); const rawResponse = await responsePromise.asResponse(); @@ -35,7 +35,7 @@ describe('resource customers', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update', async () => { const responsePromise = client.customers.update('customer_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -47,7 +47,7 @@ describe('resource customers', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list', async () => { const responsePromise = client.customers.list(); const rawResponse = await responsePromise.asResponse(); @@ -59,7 +59,7 @@ describe('resource customers', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -67,7 +67,7 @@ describe('resource customers', () => { ).rejects.toThrow(Hyperswitch.NotFoundError); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('delete', async () => { const responsePromise = client.customers.delete('customer_id'); const rawResponse = await responsePromise.asResponse(); @@ -79,7 +79,7 @@ describe('resource customers', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('listMandates', async () => { const responsePromise = client.customers.listMandates('customer_id'); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/customers/payment-methods.test.ts b/tests/api-resources/customers/payment-methods.test.ts index 8416283..f622760 100644 --- a/tests/api-resources/customers/payment-methods.test.ts +++ b/tests/api-resources/customers/payment-methods.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource paymentMethods', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list', async () => { const responsePromise = client.customers.paymentMethods.list('customer_id'); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource paymentMethods', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -44,7 +44,7 @@ describe('resource paymentMethods', () => { ).rejects.toThrow(Hyperswitch.NotFoundError); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('listSaved', async () => { const responsePromise = client.customers.paymentMethods.listSaved(); const rawResponse = await responsePromise.asResponse(); @@ -56,7 +56,7 @@ describe('resource paymentMethods', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('listSaved: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( diff --git a/tests/api-resources/disputes.test.ts b/tests/api-resources/disputes.test.ts index c1022b3..72652a7 100644 --- a/tests/api-resources/disputes.test.ts +++ b/tests/api-resources/disputes.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource disputes', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.disputes.retrieve('dispute_id'); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource disputes', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list', async () => { const responsePromise = client.disputes.list(); const rawResponse = await responsePromise.asResponse(); @@ -35,7 +35,7 @@ describe('resource disputes', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( diff --git a/tests/api-resources/events/events.test.ts b/tests/api-resources/events/events.test.ts index 93022ef..77509b7 100644 --- a/tests/api-resources/events/events.test.ts +++ b/tests/api-resources/events/events.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource events', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list', async () => { const responsePromise = client.events.list('merchant_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource events', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('deliveryAttempts: only required params', async () => { const responsePromise = client.events.deliveryAttempts('event_id', { merchant_id: 'merchant_id' }); const rawResponse = await responsePromise.asResponse(); @@ -35,12 +35,12 @@ describe('resource events', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('deliveryAttempts: required and optional params', async () => { const response = await client.events.deliveryAttempts('event_id', { merchant_id: 'merchant_id' }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retry: only required params', async () => { const responsePromise = client.events.retry('event_id', { merchant_id: 'merchant_id' }); const rawResponse = await responsePromise.asResponse(); @@ -52,7 +52,7 @@ describe('resource events', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retry: required and optional params', async () => { const response = await client.events.retry('event_id', { merchant_id: 'merchant_id' }); }); diff --git a/tests/api-resources/events/profile.test.ts b/tests/api-resources/events/profile.test.ts index 3fd49ab..bc5e1cf 100644 --- a/tests/api-resources/events/profile.test.ts +++ b/tests/api-resources/events/profile.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource profile', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list', async () => { const responsePromise = client.events.profile.list({}); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/gsm.test.ts b/tests/api-resources/gsm.test.ts index 55fa37f..e91d1b1 100644 --- a/tests/api-resources/gsm.test.ts +++ b/tests/api-resources/gsm.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource gsm', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.gsm.create({ clear_pan_possible: true, @@ -33,7 +33,7 @@ describe('resource gsm', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.gsm.create({ clear_pan_possible: true, @@ -52,7 +52,7 @@ describe('resource gsm', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: only required params', async () => { const responsePromise = client.gsm.retrieve({ code: 'code', @@ -70,7 +70,7 @@ describe('resource gsm', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: required and optional params', async () => { const response = await client.gsm.retrieve({ code: 'code', @@ -81,7 +81,7 @@ describe('resource gsm', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: only required params', async () => { const responsePromise = client.gsm.update({ code: 'code', @@ -99,7 +99,7 @@ describe('resource gsm', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: required and optional params', async () => { const response = await client.gsm.update({ code: 'code', @@ -118,7 +118,7 @@ describe('resource gsm', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('delete: only required params', async () => { const responsePromise = client.gsm.delete({ code: 'code', @@ -136,7 +136,7 @@ describe('resource gsm', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('delete: required and optional params', async () => { const response = await client.gsm.delete({ code: 'code', diff --git a/tests/api-resources/mandates.test.ts b/tests/api-resources/mandates.test.ts index 4adb784..f73e20e 100644 --- a/tests/api-resources/mandates.test.ts +++ b/tests/api-resources/mandates.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource mandates', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.mandates.retrieve('mandate_id'); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource mandates', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('revoke', async () => { const responsePromise = client.mandates.revoke('mandate_id'); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/organization.test.ts b/tests/api-resources/organization.test.ts index 393cd39..6032508 100644 --- a/tests/api-resources/organization.test.ts +++ b/tests/api-resources/organization.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource organization', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.organization.create({ organization_name: 'organization_abc' }); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource organization', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.organization.create({ organization_name: 'organization_abc', @@ -32,7 +32,7 @@ describe('resource organization', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.organization.retrieve('id'); const rawResponse = await responsePromise.asResponse(); @@ -44,7 +44,7 @@ describe('resource organization', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: only required params', async () => { const responsePromise = client.organization.update('id', { platform_merchant_id: 'platform_merchant_id', @@ -58,7 +58,7 @@ describe('resource organization', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: required and optional params', async () => { const response = await client.organization.update('id', { platform_merchant_id: 'platform_merchant_id', diff --git a/tests/api-resources/payment-link.test.ts b/tests/api-resources/payment-link.test.ts index ea55857..4c946dd 100644 --- a/tests/api-resources/payment-link.test.ts +++ b/tests/api-resources/payment-link.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource paymentLink', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.paymentLink.retrieve('payment_link_id'); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource paymentLink', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( diff --git a/tests/api-resources/payment-methods.test.ts b/tests/api-resources/payment-methods.test.ts index 0eeab77..d5caee4 100644 --- a/tests/api-resources/payment-methods.test.ts +++ b/tests/api-resources/payment-methods.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource paymentMethods', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.paymentMethods.create({ payment_method: 'card' }); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource paymentMethods', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.paymentMethods.create({ payment_method: 'card', @@ -90,7 +90,7 @@ describe('resource paymentMethods', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.paymentMethods.retrieve('method_id'); const rawResponse = await responsePromise.asResponse(); @@ -102,7 +102,7 @@ describe('resource paymentMethods', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update', async () => { const responsePromise = client.paymentMethods.update('method_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -114,7 +114,7 @@ describe('resource paymentMethods', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('delete', async () => { const responsePromise = client.paymentMethods.delete('method_id'); const rawResponse = await responsePromise.asResponse(); @@ -126,7 +126,7 @@ describe('resource paymentMethods', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('setDefault: only required params', async () => { const responsePromise = client.paymentMethods.setDefault('payment_method_id', { customer_id: 'customer_id', @@ -140,7 +140,7 @@ describe('resource paymentMethods', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('setDefault: required and optional params', async () => { const response = await client.paymentMethods.setDefault('payment_method_id', { customer_id: 'customer_id', diff --git a/tests/api-resources/payments/number-3ds.test.ts b/tests/api-resources/payments/number-3ds.test.ts index fea9e98..f67ebc5 100644 --- a/tests/api-resources/payments/number-3ds.test.ts +++ b/tests/api-resources/payments/number-3ds.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource number3DS', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('authenticate: only required params', async () => { const responsePromise = client.payments.number3DS.authenticate('payment_id', { client_secret: 'client_secret', @@ -27,7 +27,7 @@ describe('resource number3DS', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('authenticate: required and optional params', async () => { const response = await client.payments.number3DS.authenticate('payment_id', { client_secret: 'client_secret', diff --git a/tests/api-resources/payments/payments.test.ts b/tests/api-resources/payments/payments.test.ts index ec2fcb0..fe7697f 100644 --- a/tests/api-resources/payments/payments.test.ts +++ b/tests/api-resources/payments/payments.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource payments', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.payments.create({ amount: 6540, currency: 'USD' }); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.payments.create({ amount: 6540, @@ -277,7 +277,7 @@ describe('resource payments', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.payments.retrieve('payment_id'); const rawResponse = await responsePromise.asResponse(); @@ -289,7 +289,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -301,7 +301,7 @@ describe('resource payments', () => { ).rejects.toThrow(Hyperswitch.NotFoundError); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update', async () => { const responsePromise = client.payments.update('payment_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -313,7 +313,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list', async () => { const responsePromise = client.payments.list(); const rawResponse = await responsePromise.asResponse(); @@ -325,7 +325,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -346,7 +346,7 @@ describe('resource payments', () => { ).rejects.toThrow(Hyperswitch.NotFoundError); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('cancel', async () => { const responsePromise = client.payments.cancel('payment_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -358,7 +358,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('capture', async () => { const responsePromise = client.payments.capture('payment_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -370,7 +370,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('completeAuthorize: only required params', async () => { const responsePromise = client.payments.completeAuthorize('payment_id', { client_secret: 'client_secret', @@ -384,7 +384,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('completeAuthorize: required and optional params', async () => { const response = await client.payments.completeAuthorize('payment_id', { client_secret: 'client_secret', @@ -407,7 +407,7 @@ describe('resource payments', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('confirm', async () => { const responsePromise = client.payments.confirm('payment_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -419,7 +419,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('createSessionToken: only required params', async () => { const responsePromise = client.payments.createSessionToken({ client_secret: 'client_secret', @@ -435,7 +435,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('createSessionToken: required and optional params', async () => { const response = await client.payments.createSessionToken({ client_secret: 'client_secret', @@ -448,7 +448,7 @@ describe('resource payments', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('incrementalAuthorization: only required params', async () => { const responsePromise = client.payments.incrementalAuthorization('payment_id', { amount: 6540 }); const rawResponse = await responsePromise.asResponse(); @@ -460,7 +460,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('incrementalAuthorization: required and optional params', async () => { const response = await client.payments.incrementalAuthorization('payment_id', { amount: 6540, @@ -468,7 +468,7 @@ describe('resource payments', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('postSessionTokens: only required params', async () => { const responsePromise = client.payments.postSessionTokens('payment_id', { client_secret: 'client_secret', @@ -484,7 +484,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('postSessionTokens: required and optional params', async () => { const response = await client.payments.postSessionTokens('payment_id', { client_secret: 'client_secret', @@ -493,7 +493,7 @@ describe('resource payments', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('updateMetadata: only required params', async () => { const responsePromise = client.payments.updateMetadata('payment_id', { metadata: {} }); const rawResponse = await responsePromise.asResponse(); @@ -505,7 +505,7 @@ describe('resource payments', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('updateMetadata: required and optional params', async () => { const response = await client.payments.updateMetadata('payment_id', { metadata: {} }); }); diff --git a/tests/api-resources/payouts/list.test.ts b/tests/api-resources/payouts/list.test.ts index 2f37f81..193dd57 100644 --- a/tests/api-resources/payouts/list.test.ts +++ b/tests/api-resources/payouts/list.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource list', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: only required params', async () => { const responsePromise = client.payouts.list.retrieve({ created: 'created', @@ -30,7 +30,7 @@ describe('resource list', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: required and optional params', async () => { const response = await client.payouts.list.retrieve({ created: 'created', @@ -42,7 +42,7 @@ describe('resource list', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('withFilters: only required params', async () => { const responsePromise = client.payouts.list.withFilters({ currency: 'AED', @@ -58,7 +58,7 @@ describe('resource list', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('withFilters: required and optional params', async () => { const response = await client.payouts.list.withFilters({ currency: 'AED', diff --git a/tests/api-resources/payouts/payouts.test.ts b/tests/api-resources/payouts/payouts.test.ts index ccd2d38..3ef1a48 100644 --- a/tests/api-resources/payouts/payouts.test.ts +++ b/tests/api-resources/payouts/payouts.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource payouts', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.payouts.create({ amount: 0, currency: 'AED' }); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource payouts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.payouts.create({ amount: 0, @@ -96,7 +96,7 @@ describe('resource payouts', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.payouts.retrieve('payout_id'); const rawResponse = await responsePromise.asResponse(); @@ -108,7 +108,7 @@ describe('resource payouts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -116,7 +116,7 @@ describe('resource payouts', () => { ).rejects.toThrow(Hyperswitch.NotFoundError); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update', async () => { const responsePromise = client.payouts.update('payout_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -128,7 +128,7 @@ describe('resource payouts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('cancel: only required params', async () => { const responsePromise = client.payouts.cancel('payout_id', { body_payout_id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', @@ -142,14 +142,14 @@ describe('resource payouts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('cancel: required and optional params', async () => { const response = await client.payouts.cancel('payout_id', { body_payout_id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('confirm: only required params', async () => { const responsePromise = client.payouts.confirm('payout_id', { client_secret: 'client_secret' }); const rawResponse = await responsePromise.asResponse(); @@ -161,7 +161,7 @@ describe('resource payouts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('confirm: required and optional params', async () => { const response = await client.payouts.confirm('payout_id', { client_secret: 'client_secret', @@ -234,7 +234,7 @@ describe('resource payouts', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('fulfill: only required params', async () => { const responsePromise = client.payouts.fulfill('payout_id', { body_payout_id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', @@ -248,14 +248,14 @@ describe('resource payouts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('fulfill: required and optional params', async () => { const response = await client.payouts.fulfill('payout_id', { body_payout_id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('listFilters: only required params', async () => { const responsePromise = client.payouts.listFilters({ start_time: '2019-12-27T18:11:19.117Z' }); const rawResponse = await responsePromise.asResponse(); @@ -267,7 +267,7 @@ describe('resource payouts', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('listFilters: required and optional params', async () => { const response = await client.payouts.listFilters({ start_time: '2019-12-27T18:11:19.117Z', diff --git a/tests/api-resources/poll.test.ts b/tests/api-resources/poll.test.ts index 42c9824..4d7a6d7 100644 --- a/tests/api-resources/poll.test.ts +++ b/tests/api-resources/poll.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource poll', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieveStatus', async () => { const responsePromise = client.poll.retrieveStatus('poll_id'); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/profile-acquirers.test.ts b/tests/api-resources/profile-acquirers.test.ts index 7038cb2..5fb16ed 100644 --- a/tests/api-resources/profile-acquirers.test.ts +++ b/tests/api-resources/profile-acquirers.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource profileAcquirers', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.profileAcquirers.create({ acquirer_assigned_merchant_id: 'M123456789', @@ -31,7 +31,7 @@ describe('resource profileAcquirers', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.profileAcquirers.create({ acquirer_assigned_merchant_id: 'M123456789', @@ -45,7 +45,7 @@ describe('resource profileAcquirers', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: only required params', async () => { const responsePromise = client.profileAcquirers.update('profile_acquirer_id', { profile_id: 'profile_id', @@ -59,7 +59,7 @@ describe('resource profileAcquirers', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: required and optional params', async () => { const response = await client.profileAcquirers.update('profile_acquirer_id', { profile_id: 'profile_id', diff --git a/tests/api-resources/refunds.test.ts b/tests/api-resources/refunds.test.ts index c307aac..791661f 100644 --- a/tests/api-resources/refunds.test.ts +++ b/tests/api-resources/refunds.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource refunds', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.refunds.create({ payment_id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource refunds', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.refunds.create({ payment_id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', @@ -41,7 +41,7 @@ describe('resource refunds', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.refunds.retrieve('refund_id'); const rawResponse = await responsePromise.asResponse(); @@ -53,7 +53,7 @@ describe('resource refunds', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update', async () => { const responsePromise = client.refunds.update('refund_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -65,7 +65,7 @@ describe('resource refunds', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list: only required params', async () => { const responsePromise = client.refunds.list({ start_time: '2019-12-27T18:11:19.117Z' }); const rawResponse = await responsePromise.asResponse(); @@ -77,7 +77,7 @@ describe('resource refunds', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list: required and optional params', async () => { const response = await client.refunds.list({ start_time: '2019-12-27T18:11:19.117Z', diff --git a/tests/api-resources/relay.test.ts b/tests/api-resources/relay.test.ts index a284b9c..736773d 100644 --- a/tests/api-resources/relay.test.ts +++ b/tests/api-resources/relay.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource relay', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: only required params', async () => { const responsePromise = client.relay.create({ connector_id: 'mca_5apGeP94tMts6rg3U3kR', @@ -29,7 +29,7 @@ describe('resource relay', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.relay.create({ connector_id: 'mca_5apGeP94tMts6rg3U3kR', @@ -41,7 +41,7 @@ describe('resource relay', () => { }); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: only required params', async () => { const responsePromise = client.relay.retrieve('relay_id', { 'X-Profile-Id': 'X-Profile-Id' }); const rawResponse = await responsePromise.asResponse(); @@ -53,7 +53,7 @@ describe('resource relay', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve: required and optional params', async () => { const response = await client.relay.retrieve('relay_id', { 'X-Profile-Id': 'X-Profile-Id' }); }); diff --git a/tests/api-resources/routing/default/default.test.ts b/tests/api-resources/routing/default/default.test.ts index b9f8456..0af6332 100644 --- a/tests/api-resources/routing/default/default.test.ts +++ b/tests/api-resources/routing/default/default.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource default', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.routing.default.retrieve(); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource default', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: only required params', async () => { const responsePromise = client.routing.default.update({ body: [{ connector: 'adyenplatform' }] }); const rawResponse = await responsePromise.asResponse(); @@ -35,7 +35,7 @@ describe('resource default', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: required and optional params', async () => { const response = await client.routing.default.update({ body: [{ connector: 'adyenplatform', merchant_connector_id: 'merchant_connector_id' }], diff --git a/tests/api-resources/routing/default/profile.test.ts b/tests/api-resources/routing/default/profile.test.ts index 6c22d81..ce8732b 100644 --- a/tests/api-resources/routing/default/profile.test.ts +++ b/tests/api-resources/routing/default/profile.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource profile', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.routing.default.profile.retrieve(); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource profile', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: only required params', async () => { const responsePromise = client.routing.default.profile.update('profile_id', { body: [{ connector: 'adyenplatform' }], @@ -37,7 +37,7 @@ describe('resource profile', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('update: required and optional params', async () => { const response = await client.routing.default.profile.update('profile_id', { body: [{ connector: 'adyenplatform', merchant_connector_id: 'merchant_connector_id' }], diff --git a/tests/api-resources/routing/routing.test.ts b/tests/api-resources/routing/routing.test.ts index 82fa850..2dfc854 100644 --- a/tests/api-resources/routing/routing.test.ts +++ b/tests/api-resources/routing/routing.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource routing', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('create', async () => { const responsePromise = client.routing.create({}); const rawResponse = await responsePromise.asResponse(); @@ -23,7 +23,7 @@ describe('resource routing', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieve', async () => { const responsePromise = client.routing.retrieve('routing_algorithm_id'); const rawResponse = await responsePromise.asResponse(); @@ -35,7 +35,7 @@ describe('resource routing', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list', async () => { const responsePromise = client.routing.list(); const rawResponse = await responsePromise.asResponse(); @@ -47,7 +47,7 @@ describe('resource routing', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('list: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( @@ -58,7 +58,7 @@ describe('resource routing', () => { ).rejects.toThrow(Hyperswitch.NotFoundError); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('activate', async () => { const responsePromise = client.routing.activate('routing_algorithm_id'); const rawResponse = await responsePromise.asResponse(); @@ -70,7 +70,7 @@ describe('resource routing', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('deactivate', async () => { const responsePromise = client.routing.deactivate({}); const rawResponse = await responsePromise.asResponse(); @@ -82,7 +82,7 @@ describe('resource routing', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieveActive', async () => { const responsePromise = client.routing.retrieveActive(); const rawResponse = await responsePromise.asResponse(); @@ -94,7 +94,7 @@ describe('resource routing', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('retrieveActive: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( diff --git a/tests/api-resources/three-ds-decision.test.ts b/tests/api-resources/three-ds-decision.test.ts index dddcdb7..b87459d 100644 --- a/tests/api-resources/three-ds-decision.test.ts +++ b/tests/api-resources/three-ds-decision.test.ts @@ -11,7 +11,7 @@ const client = new Hyperswitch({ }); describe('resource threeDSDecision', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('execute: only required params', async () => { const responsePromise = client.threeDSDecision.execute({ payment: { amount: 0, currency: 'AED' }, @@ -26,7 +26,7 @@ describe('resource threeDSDecision', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('execute: required and optional params', async () => { const response = await client.threeDSDecision.execute({ payment: { amount: 0, currency: 'AED' }, diff --git a/tests/index.test.ts b/tests/index.test.ts index 3894abc..7e28ee5 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -29,13 +29,13 @@ describe('instantiate client', () => { publishableKey: 'My Publishable Key', }); - test('they are used in the request', () => { - const { req } = client.buildRequest({ path: '/foo', method: 'post' }); + test('they are used in the request', async () => { + const { req } = await client.buildRequest({ path: '/foo', method: 'post' }); expect(req.headers.get('x-my-default-header')).toEqual('2'); }); - test('can ignore `undefined` and leave the default', () => { - const { req } = client.buildRequest({ + test('can ignore `undefined` and leave the default', async () => { + const { req } = await client.buildRequest({ path: '/foo', method: 'post', headers: { 'X-My-Default-Header': undefined }, @@ -43,8 +43,8 @@ describe('instantiate client', () => { expect(req.headers.get('x-my-default-header')).toEqual('2'); }); - test('can be removed with `null`', () => { - const { req } = client.buildRequest({ + test('can be removed with `null`', async () => { + const { req } = await client.buildRequest({ path: '/foo', method: 'post', headers: { 'X-My-Default-Header': null }, @@ -477,7 +477,7 @@ describe('instantiate client', () => { }); describe('withOptions', () => { - test('creates a new client with overridden options', () => { + test('creates a new client with overridden options', async () => { const client = new Hyperswitch({ baseURL: 'http://localhost:5000/', maxRetries: 3, @@ -505,7 +505,7 @@ describe('instantiate client', () => { expect(newClient.constructor).toBe(client.constructor); }); - test('inherits options from the parent client', () => { + test('inherits options from the parent client', async () => { const client = new Hyperswitch({ baseURL: 'http://localhost:5000/', defaultHeaders: { 'X-Test-Header': 'test-value' }, @@ -523,7 +523,7 @@ describe('instantiate client', () => { // Test inherited options remain the same expect(newClient.buildURL('/foo', null)).toEqual('http://localhost:5001/foo?test-param=test-value'); - const { req } = newClient.buildRequest({ path: '/foo', method: 'get' }); + const { req } = await newClient.buildRequest({ path: '/foo', method: 'get' }); expect(req.headers.get('x-test-header')).toEqual('test-value'); }); @@ -602,8 +602,8 @@ describe('request building', () => { }); describe('custom headers', () => { - test('handles undefined', () => { - const { req } = client.buildRequest({ + test('handles undefined', async () => { + const { req } = await client.buildRequest({ path: '/foo', method: 'post', body: { value: 'hello' }, @@ -643,8 +643,8 @@ describe('default encoder', () => { } } for (const jsonValue of [{}, [], { __proto__: null }, new Serializable(), new Collection(['item'])]) { - test(`serializes ${util.inspect(jsonValue)} as json`, () => { - const { req } = client.buildRequest({ + test(`serializes ${util.inspect(jsonValue)} as json`, async () => { + const { req } = await client.buildRequest({ path: '/foo', method: 'post', body: jsonValue, @@ -667,7 +667,7 @@ describe('default encoder', () => { asyncIterable, ]) { test(`converts ${util.inspect(streamValue)} to ReadableStream`, async () => { - const { req } = client.buildRequest({ + const { req } = await client.buildRequest({ path: '/foo', method: 'post', body: streamValue, @@ -680,7 +680,7 @@ describe('default encoder', () => { } test(`can set content-type for ReadableStream`, async () => { - const { req } = client.buildRequest({ + const { req } = await client.buildRequest({ path: '/foo', method: 'post', body: new Response('a\nb\nc\n').body, diff --git a/yarn.lock b/yarn.lock index 58c08d5..8311caf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -938,11 +938,11 @@ undici-types "~5.26.4" "@types/node@^20.17.6": - version "20.17.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.17.6.tgz#6e4073230c180d3579e8c60141f99efdf5df0081" - integrity sha512-VEI7OdvK2wP7XHnsuXbAJnEpEkF6NjSN45QJlL4VGqZSXsnicpesdTWsg9RISeSdYd3yeRj/y3k5KGjUXYnFwQ== + version "20.19.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.19.11.tgz#728cab53092bd5f143beed7fbba7ba99de3c16c4" + integrity sha512-uug3FEEGv0r+jrecvUUpbY8lLisvIjg6AAic6a2bSP5OEOLeJsDSnvhCDov7ipFFMXS3orMpzlmi0ZcuGkBbow== dependencies: - undici-types "~6.19.2" + undici-types "~6.21.0" "@types/stack-utils@^2.0.0": version "2.0.3" @@ -3283,9 +3283,9 @@ ts-node@^10.5.0: v8-compile-cache-lib "^3.0.0" yn "3.1.1" -"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz": - version "1.1.8" - resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz#f544b359b8f05e607771ffacc280e58201476b04" +"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz": + version "1.1.9" + resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz#777f6f5d9e26bf0e94e5170990dd3a841d6707cd" dependencies: debug "^4.3.7" fast-glob "^3.3.2" @@ -3353,10 +3353,10 @@ undici-types@~5.26.4: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -undici-types@~6.19.2: - version "6.19.8" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" - integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== +undici-types@~6.21.0: + version "6.21.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" + integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== unicode-emoji-modifier-base@^1.0.0: version "1.0.0"