diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 763462fad..43fd5a73f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,9 +9,7 @@ "postCreateCommand": "yarn install", "customizations": { "vscode": { - "extensions": [ - "esbenp.prettier-vscode" - ] + "extensions": ["esbenp.prettier-vscode"] } } } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a2fdde41..f1ca7188f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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/finch-node' + env: + URL: https://pkg.stainless.com/s?subpackage=mcp-server + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + BASE_PATH: packages/mcp-server + run: ./scripts/utils/upload-artifact.sh test: timeout-minutes: 10 name: test diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 63f1d2ed4..459a68590 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -16,6 +16,8 @@ jobs: publish: name: publish runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v4 @@ -39,3 +41,10 @@ jobs: yarn tsn scripts/publish-packages.ts "{ \"paths_released\": \"$PATHS_RELEASED\" }" env: NPM_TOKEN: ${{ secrets.FINCH_NPM_TOKEN || secrets.NPM_TOKEN }} + + - name: Upload MCP Server DXT GitHub release asset + run: | + gh release upload ${{ github.event.release.tag_name }} \ + packages/mcp-server/tryfinch_finch_api_api.mcpb + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index d98d51a88..d62bea500 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ dist dist-deno /*.tgz .idea/ - +.eslintcache +dist-bundle +*.mcpb diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 509abc6f1..a25f0a9b1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "6.37.0" + ".": "6.38.0" } diff --git a/.stats.yml b/.stats.yml index 9d73576a7..ee6074218 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 46 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-6d0c6a1feba5ccb895a6779cd98c2a0ae87d6394f5e98a9da51f17258c4eb297.yml -openapi_spec_hash: ac3be0c8a992103e5f467fe1bcb20a81 -config_hash: 5146b12344dae76238940989dac1e8a0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-0105d239fcaf84750c886dfa6c2cfbf2b2087f89a48f8827c4cbe28479ebfb13.yml +openapi_spec_hash: 34895c3d3c137fb9f5a019ac5370afbb +config_hash: 6d3585c0032e08d723d077d660fc8448 diff --git a/CHANGELOG.md b/CHANGELOG.md index 31cf2632e..b12249840 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,70 @@ # Changelog +## 6.38.0 (2025-10-27) + +Full Changelog: [v6.37.0...v6.38.0](https://github.com/Finch-API/finch-api-node/compare/v6.37.0...v6.38.0) + +### Features + +* **api:** api update ([4d57031](https://github.com/Finch-API/finch-api-node/commit/4d5703128cd8a626dec68fe4ffc34980579bcd6f)) +* **api:** api update ([50af0c2](https://github.com/Finch-API/finch-api-node/commit/50af0c2c4756708e0de6bdb3c1eaacce3d24733b)) +* **api:** api update ([9fb854f](https://github.com/Finch-API/finch-api-node/commit/9fb854f6ceaac25e21901b4a035d2207de994901)) +* **api:** api update ([96d3f66](https://github.com/Finch-API/finch-api-node/commit/96d3f666690caea95b650b954dfd681eeb686c8e)) +* **api:** api update ([b331c10](https://github.com/Finch-API/finch-api-node/commit/b331c108e3912c503e4cc8393587bac2a927f4f7)) +* **api:** api update ([99a20c2](https://github.com/Finch-API/finch-api-node/commit/99a20c267f645658d3928f269f5da7a33b287d17)) +* **api:** api update ([f9c7e06](https://github.com/Finch-API/finch-api-node/commit/f9c7e0685ff5ab28614353eacc1fc7887ec6a0ff)) +* **api:** api update ([1c4f073](https://github.com/Finch-API/finch-api-node/commit/1c4f073cc8e8f06e58069dcc2bc5b708e3a8be34)) +* **api:** api update ([843b525](https://github.com/Finch-API/finch-api-node/commit/843b525f6a3f07edda04ca213a35dd3d2d37fdb3)) +* **api:** api update ([9bc9a38](https://github.com/Finch-API/finch-api-node/commit/9bc9a38df44189e734248cf7ad06259f93e25b82)) +* **api:** api update ([09d2e93](https://github.com/Finch-API/finch-api-node/commit/09d2e939a8c42d495d9207ad2d73841f6e9e8732)) +* **api:** make client id, client secret optional again ([d67f867](https://github.com/Finch-API/finch-api-node/commit/d67f867f1b3c9e4886d21da21a1cccab5760aa9d)) +* **mcp:** add docs search tool ([a9e8666](https://github.com/Finch-API/finch-api-node/commit/a9e866662d47e0f39a1988339101d46ba149fb9d)) +* **mcp:** add mcp bundles to build script ([45794fe](https://github.com/Finch-API/finch-api-node/commit/45794fe7a8d09dd0160ac3d2a64941fff12837d5)) +* **mcp:** add option for including docs tools ([fef1f5b](https://github.com/Finch-API/finch-api-node/commit/fef1f5b0cc05c737db89097378c88a38e8973089)) +* **mcp:** allow setting logging level ([4634f9a](https://github.com/Finch-API/finch-api-node/commit/4634f9a04f0fd3a7daa781876a1d93e170f1941d)) +* **mcp:** change remote server query option parsing logic ([13ef1bd](https://github.com/Finch-API/finch-api-node/commit/13ef1bd4400e1ae2b2197a35f33e79703af34e08)) +* **mcp:** enable experimental docs search tool ([8ec38f6](https://github.com/Finch-API/finch-api-node/commit/8ec38f6536ca6a6e7324dd827db0dc9ee9234f61)) +* **mcp:** expose client options in `streamableHTTPApp` ([39cdb76](https://github.com/Finch-API/finch-api-node/commit/39cdb7601c55b6d723132edeb320c3898e697fa2)) + + +### Bug Fixes + +* **ci:** set permissions for DXT publish action ([6a6dd0a](https://github.com/Finch-API/finch-api-node/commit/6a6dd0af7e290990c7773447615e3e5d99ff217b)) +* **client:** incorrect offset pagination check ([2600077](https://github.com/Finch-API/finch-api-node/commit/26000775b7ab71e9e3994196806a847383905853)) +* coerce nullable values to undefined ([aa135f5](https://github.com/Finch-API/finch-api-node/commit/aa135f5fdfe89359b6ad8c49b1908e7faee4ebaa)) +* **mcp:** avoid importing unsupported libraries on non-node environments ([8c380a8](https://github.com/Finch-API/finch-api-node/commit/8c380a8499435e8a92155664943e6fc631f7ba1a)) +* **mcp:** fix cli argument parsing logic ([277ba31](https://github.com/Finch-API/finch-api-node/commit/277ba31b242825bd569a6566a8f2a136ec0b595d)) +* **mcp:** fix query options parsing ([9087760](https://github.com/Finch-API/finch-api-node/commit/90877607933fa892f5d05c8931fa2de9d139e769)) +* **mcp:** fix uploading dxt release assets ([70f9a36](https://github.com/Finch-API/finch-api-node/commit/70f9a36f47190f4b78de043e63d65e21df6ce116)) +* **mcp:** resolve a linting issue in server code ([90b7ae2](https://github.com/Finch-API/finch-api-node/commit/90b7ae260d427cebb7bcd7f2d3e854a0efaccd19)) + + +### Performance Improvements + +* faster formatting ([163982a](https://github.com/Finch-API/finch-api-node/commit/163982a884bcf10684b5b3e242b0d52d547fc62b)) + + +### Chores + +* ci build action ([f0c3633](https://github.com/Finch-API/finch-api-node/commit/f0c3633571f7eea46803cb75ba244c41cac5a7b4)) +* **codegen:** internal codegen update ([27ec1f5](https://github.com/Finch-API/finch-api-node/commit/27ec1f5a8d71f31a327021745f7dab0aeebc4b7b)) +* do not install brew dependencies in ./scripts/bootstrap by default ([1758c0d](https://github.com/Finch-API/finch-api-node/commit/1758c0de64e97975332bb8a0c6b55a23ed82a036)) +* extract some types in mcp docs ([55c3799](https://github.com/Finch-API/finch-api-node/commit/55c37998bdb39779bfb9ae62ee5310a2a423248d)) +* **internal:** codegen related update ([d020050](https://github.com/Finch-API/finch-api-node/commit/d0200501b52ae4ac9e7c8de91d2f883e27db34c5)) +* **internal:** codegen related update ([697d211](https://github.com/Finch-API/finch-api-node/commit/697d211b9600d388aa101879ac6c400e4eb4ac53)) +* **internal:** codegen related update ([ac835bf](https://github.com/Finch-API/finch-api-node/commit/ac835bf6af93d53e551d73001d048baa95e1c334)) +* **internal:** fix incremental formatting in some cases ([40ecf6a](https://github.com/Finch-API/finch-api-node/commit/40ecf6a887ea44d156672f155abf70ab2d146921)) +* **internal:** gitignore .mcpb files ([73c778e](https://github.com/Finch-API/finch-api-node/commit/73c778e3b9d157f8296c43131cd0db764d5086bc)) +* **internal:** ignore .eslintcache ([4d90156](https://github.com/Finch-API/finch-api-node/commit/4d901569e987fa9c93c12ae77844972b4655fa8f)) +* **internal:** remove .eslintcache ([64d2197](https://github.com/Finch-API/finch-api-node/commit/64d21976509a6d6b6d0095bf1867ad9bdd153e03)) +* **internal:** remove deprecated `compilerOptions.baseUrl` from tsconfig.json ([5955e29](https://github.com/Finch-API/finch-api-node/commit/5955e291311d6d8192a3e8c3eb87f4eac9bdbdbc)) +* **internal:** use npm pack for build uploads ([7df5a28](https://github.com/Finch-API/finch-api-node/commit/7df5a28a1be002645785fa2d59cd94da5df28889)) +* **mcp:** allow pointing `docs_search` tool at other URLs ([bb7f182](https://github.com/Finch-API/finch-api-node/commit/bb7f182ef3959a99a7728cdab685d972e4110756)) +* **mcp:** rename dxt to mcpb ([68a9c07](https://github.com/Finch-API/finch-api-node/commit/68a9c079dfb35ab661f58780405036399fbaf31e)) +* **mcp:** upload dxt as release asset ([256c717](https://github.com/Finch-API/finch-api-node/commit/256c717c7eb0bd947322b14d85fc15cd7f919724)) +* update CI script ([47843c8](https://github.com/Finch-API/finch-api-node/commit/47843c85864215c19edd9826952bd625e79ca78c)) +* update lockfile ([0601d2a](https://github.com/Finch-API/finch-api-node/commit/0601d2aca7eeb80b8967d3bc89dea5b5ab527565)) + ## 6.37.0 (2025-08-21) Full Changelog: [v6.36.0...v6.37.0](https://github.com/Finch-API/finch-api-node/compare/v6.36.0...v6.37.0) diff --git a/api.md b/api.md index 9558c4af0..4395a45a7 100644 --- a/api.md +++ b/api.md @@ -40,7 +40,7 @@ Types: Methods: -- client.hris.company.retrieve() -> Company +- client.hris.company.retrieve({ ...params }) -> Company ### PayStatementItem @@ -65,8 +65,8 @@ Methods: - client.hris.company.payStatementItem.rules.create({ ...params }) -> RuleCreateResponse - client.hris.company.payStatementItem.rules.update(ruleId, { ...params }) -> RuleUpdateResponse -- client.hris.company.payStatementItem.rules.list() -> RuleListResponsesPage -- client.hris.company.payStatementItem.rules.delete(ruleId) -> RuleDeleteResponse +- client.hris.company.payStatementItem.rules.list({ ...params }) -> RuleListResponsesPage +- client.hris.company.payStatementItem.rules.delete(ruleId, { ...params }) -> RuleDeleteResponse ## Directory @@ -136,7 +136,7 @@ Types: Methods: - client.hris.documents.list({ ...params }) -> DocumentListResponse -- client.hris.documents.retreive(documentId) -> DocumentRetreiveResponse +- client.hris.documents.retreive(documentId, { ...params }) -> DocumentRetreiveResponse ## Benefits @@ -157,10 +157,10 @@ Types: Methods: - client.hris.benefits.create({ ...params }) -> CreateCompanyBenefitsResponse -- client.hris.benefits.retrieve(benefitId) -> CompanyBenefit +- client.hris.benefits.retrieve(benefitId, { ...params }) -> CompanyBenefit - client.hris.benefits.update(benefitId, { ...params }) -> UpdateCompanyBenefitResponse -- client.hris.benefits.list() -> CompanyBenefitsSinglePage -- client.hris.benefits.listSupportedBenefits() -> SupportedBenefitsSinglePage +- client.hris.benefits.list({ ...params }) -> CompanyBenefitsSinglePage +- client.hris.benefits.listSupportedBenefits({ ...params }) -> SupportedBenefitsSinglePage ### Individuals @@ -174,7 +174,7 @@ Types: Methods: - client.hris.benefits.individuals.enrollMany(benefitId, [ ...individuals ]) -> EnrolledIndividualBenefitResponse -- client.hris.benefits.individuals.enrolledIds(benefitId) -> IndividualEnrolledIDsResponse +- client.hris.benefits.individuals.enrolledIds(benefitId, { ...params }) -> IndividualEnrolledIDsResponse - client.hris.benefits.individuals.retrieveManyBenefits(benefitId, { ...params }) -> IndividualBenefitsSinglePage - client.hris.benefits.individuals.unenrollMany(benefitId, { ...params }) -> UnenrolledIndividualBenefitResponse @@ -183,10 +183,11 @@ Methods: Types: - Provider +- ProviderListResponse Methods: -- client.providers.list() -> ProvidersSinglePage +- client.providers.list() -> ProviderListResponsesSinglePage # Account @@ -243,7 +244,7 @@ Types: Methods: - client.jobs.automated.create({ ...params }) -> AutomatedCreateResponse -- client.jobs.automated.retrieve(jobId, { ...params }) -> AutomatedAsyncJob +- client.jobs.automated.retrieve(jobId) -> AutomatedAsyncJob - client.jobs.automated.list({ ...params }) -> AutomatedListResponse ## Manual @@ -254,7 +255,7 @@ Types: Methods: -- client.jobs.manual.retrieve(jobId, { ...params }) -> ManualAsyncJob +- client.jobs.manual.retrieve(jobId) -> ManualAsyncJob # Sandbox @@ -363,7 +364,7 @@ Types: Methods: -- client.payroll.payGroups.retrieve(payGroupId) -> PayGroupRetrieveResponse +- client.payroll.payGroups.retrieve(payGroupId, { ...params }) -> PayGroupRetrieveResponse - client.payroll.payGroups.list({ ...params }) -> PayGroupListResponsesSinglePage # Connect diff --git a/package.json b/package.json index ef7d34037..a88f5e6a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tryfinch/finch-api", - "version": "6.37.0", + "version": "6.38.0", "description": "The official TypeScript library for the Finch API", "author": "Finch ", "types": "dist/index.d.ts", diff --git a/packages/mcp-server/README.md b/packages/mcp-server/README.md index e8a5ab16c..647e03e8d 100644 --- a/packages/mcp-server/README.md +++ b/packages/mcp-server/README.md @@ -238,7 +238,6 @@ The following tools are available in this MCP server. ### Resource `hris.directory`: - `list_hris_directory` (`read`): Read company directory and organization structure -- `list_individuals_hris_directory` (`read`): Read company directory and organization structure ### Resource `hris.individuals`: diff --git a/packages/mcp-server/build b/packages/mcp-server/build index 7430081b7..0bc3f3586 100644 --- a/packages/mcp-server/build +++ b/packages/mcp-server/build @@ -30,3 +30,27 @@ cp tsconfig.dist-src.json dist/src/tsconfig.json chmod +x dist/index.js DIST_PATH=./dist PKG_IMPORT_PATH=@tryfinch/finch-api-mcp/ node ../../scripts/utils/postprocess-files.cjs + +# mcp bundle +rm -rf dist-bundle tryfinch_finch_api_api.mcpb; mkdir dist-bundle + +# copy package.json +PKG_JSON_PATH=../../packages/mcp-server/package.json node ../../scripts/utils/make-dist-package-json.cjs > dist-bundle/package.json + +# copy files +node scripts/copy-bundle-files.cjs + +# install runtime deps +cd dist-bundle +npm install +cd .. + +# pack bundle +cp manifest.json dist-bundle + +npx mcpb pack dist-bundle tryfinch_finch_api_api.mcpb + +npx mcpb sign tryfinch_finch_api_api.mcpb --self-signed + +# clean up +rm -rf dist-bundle diff --git a/packages/mcp-server/manifest.json b/packages/mcp-server/manifest.json new file mode 100644 index 000000000..2901767d0 --- /dev/null +++ b/packages/mcp-server/manifest.json @@ -0,0 +1,64 @@ +{ + "dxt_version": "0.2", + "name": "@tryfinch/finch-api-mcp", + "version": "6.37.0", + "description": "The official MCP Server for the Finch API", + "author": { + "name": "Finch", + "email": "founders@tryfinch.com" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Finch-API/finch-api-node.git" + }, + "homepage": "https://github.com/Finch-API/finch-api-node/tree/main/packages/mcp-server#readme", + "documentation": "https://developer.tryfinch.com/", + "server": { + "type": "node", + "entry_point": "index.js", + "mcp_config": { + "command": "node", + "args": ["${__dirname}/index.js"], + "env": { + "FINCH_ACCESS_TOKEN": "${user_config.FINCH_ACCESS_TOKEN}", + "FINCH_CLIENT_ID": "${user_config.FINCH_CLIENT_ID}", + "FINCH_CLIENT_SECRET": "${user_config.FINCH_CLIENT_SECRET}", + "FINCH_WEBHOOK_SECRET": "${user_config.FINCH_WEBHOOK_SECRET}" + } + } + }, + "user_config": { + "FINCH_ACCESS_TOKEN": { + "title": "access_token", + "description": "", + "required": false, + "type": "string" + }, + "FINCH_CLIENT_ID": { + "title": "client_id", + "description": "", + "required": false, + "type": "string" + }, + "FINCH_CLIENT_SECRET": { + "title": "client_secret", + "description": "", + "required": false, + "type": "string" + }, + "FINCH_WEBHOOK_SECRET": { + "title": "webhook_secret", + "description": "", + "required": false, + "type": "string" + } + }, + "tools": [], + "tools_generated": true, + "compatibility": { + "runtimes": { + "node": ">=18.0.0" + } + }, + "keywords": ["api"] +} diff --git a/packages/mcp-server/package.json b/packages/mcp-server/package.json index 64744cdba..3f3f0a6cf 100644 --- a/packages/mcp-server/package.json +++ b/packages/mcp-server/package.json @@ -1,6 +1,6 @@ { "name": "@tryfinch/finch-api-mcp", - "version": "6.37.0", + "version": "6.38.0", "description": "The official MCP Server for the Finch API", "author": "Finch ", "types": "dist/index.d.ts", @@ -47,6 +47,7 @@ "mcp-server": "dist/index.js" }, "devDependencies": { + "@anthropic-ai/mcpb": "^1.1.0", "@types/cors": "^2.8.19", "@types/express": "^5.0.3", "@types/jest": "^29.4.0", diff --git a/packages/mcp-server/scripts/copy-bundle-files.cjs b/packages/mcp-server/scripts/copy-bundle-files.cjs new file mode 100644 index 000000000..08ba18122 --- /dev/null +++ b/packages/mcp-server/scripts/copy-bundle-files.cjs @@ -0,0 +1,36 @@ +const fs = require('fs'); +const path = require('path'); +const pkgJson = require('../dist-bundle/package.json'); + +const distDir = path.resolve(__dirname, '..', 'dist'); +const distBundleDir = path.resolve(__dirname, '..', 'dist-bundle'); +const distBundlePkgJson = path.join(distBundleDir, 'package.json'); + +async function* walk(dir) { + for await (const d of await fs.promises.opendir(dir)) { + const entry = path.join(dir, d.name); + if (d.isDirectory()) yield* walk(entry); + else if (d.isFile()) yield entry; + } +} + +async function copyFiles() { + // copy runtime files + for await (const file of walk(distDir)) { + if (!/[cm]?js$/.test(file)) continue; + const dest = path.join(distBundleDir, path.relative(distDir, file)); + await fs.promises.mkdir(path.dirname(dest), { recursive: true }); + await fs.promises.copyFile(file, dest); + } + + // replace package.json reference with local reference + for (const dep in pkgJson.dependencies) { + if (dep === '@tryfinch/finch-api') { + pkgJson.dependencies[dep] = 'file:../../../dist/'; + } + } + + await fs.promises.writeFile(distBundlePkgJson, JSON.stringify(pkgJson, null, 2)); +} + +copyFiles(); diff --git a/packages/mcp-server/src/code-tool-paths.cts b/packages/mcp-server/src/code-tool-paths.cts index 3d6655afc..15ce7f555 100644 --- a/packages/mcp-server/src/code-tool-paths.cts +++ b/packages/mcp-server/src/code-tool-paths.cts @@ -1,3 +1,3 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export const workerPath = require.resolve('./code-tool-worker.mjs') +export const workerPath = require.resolve('./code-tool-worker.mjs'); diff --git a/packages/mcp-server/src/code-tool.ts b/packages/mcp-server/src/code-tool.ts index 29def9de7..8e5e5e2f9 100644 --- a/packages/mcp-server/src/code-tool.ts +++ b/packages/mcp-server/src/code-tool.ts @@ -7,9 +7,7 @@ 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. @@ -20,7 +18,7 @@ import { workerPath } from './code-tool-paths.cjs'; * * @param endpoints - The endpoints to include in the list. */ -export function codeTool(): Endpoint { +export async function codeTool(): Promise { const metadata: Metadata = { resource: 'all', operation: 'write', tags: [] }; const tool: Tool = { name: 'execute', @@ -29,6 +27,10 @@ export function codeTool(): Endpoint { inputSchema: { type: 'object', properties: { code: { type: 'string' } } }, }; + // Import dynamically to avoid failing at import time in cases where the environment is not well-supported. + const { newDenoHTTPWorker } = await import('@valtown/deno-http-worker'); + const { workerPath } = await import('./code-tool-paths.cjs'); + const handler = async (client: Finch, args: unknown) => { const baseURLHostname = new URL(client.baseURL).hostname; const { code } = args as { code: string }; diff --git a/packages/mcp-server/src/docs-search-tool.ts b/packages/mcp-server/src/docs-search-tool.ts new file mode 100644 index 000000000..0ef8ccb90 --- /dev/null +++ b/packages/mcp-server/src/docs-search-tool.ts @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { Metadata, asTextContentResult } from './tools/types'; + +import { Tool } from '@modelcontextprotocol/sdk/types.js'; + +export const metadata: Metadata = { + resource: 'all', + operation: 'read', + tags: [], + httpMethod: 'get', +}; + +export const tool: Tool = { + name: 'search_docs', + description: + 'Search for documentation for how to use the client to interact with the API.\nThe tool will return an array of Markdown-formatted documentation pages.', + inputSchema: { + type: 'object', + properties: { + query: { + type: 'string', + description: 'The query to search for.', + }, + language: { + type: 'string', + description: 'The language for the SDK to search for.', + enum: ['http', 'python', 'go', 'typescript', 'terraform', 'ruby', 'java', 'kotlin'], + }, + }, + required: ['query', 'language'], + }, + annotations: { + readOnlyHint: true, + }, +}; + +const docsSearchURL = + process.env['DOCS_SEARCH_URL'] || 'https://api.stainless.com/api/projects/finch/docs/search'; + +export const handler = async (_: unknown, args: Record | undefined) => { + const body = args as any; + const query = new URLSearchParams(body).toString(); + const result = await fetch(`${docsSearchURL}?${query}`); + return asTextContentResult(await result.json()); +}; + +export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/http.ts b/packages/mcp-server/src/http.ts index c11185b7b..ec34ab47d 100644 --- a/packages/mcp-server/src/http.ts +++ b/packages/mcp-server/src/http.ts @@ -6,14 +6,20 @@ import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/ import express from 'express'; import { fromError } from 'zod-validation-error/v3'; import { McpOptions, parseQueryOptions } from './options'; -import { initMcpServer, newMcpServer } from './server'; +import { ClientOptions, initMcpServer, newMcpServer } from './server'; import { parseAuthHeaders } from './headers'; -const newServer = ( - defaultMcpOptions: McpOptions, - req: express.Request, - res: express.Response, -): McpServer | null => { +const newServer = ({ + clientOptions, + mcpOptions: defaultMcpOptions, + req, + res, +}: { + clientOptions: ClientOptions; + mcpOptions: McpOptions; + req: express.Request; + res: express.Response; +}): McpServer | null => { const server = newMcpServer(); let mcpOptions: McpOptions; @@ -35,10 +41,8 @@ const newServer = ( initMcpServer({ server: server, clientOptions: { + ...clientOptions, ...authOptions, - defaultHeaders: { - 'X-Stainless-MCP': 'true', - }, }, mcpOptions, }); @@ -56,17 +60,19 @@ const newServer = ( 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 post = + (options: { clientOptions: ClientOptions; mcpOptions: McpOptions }) => + async (req: express.Request, res: express.Response) => { + const server = newServer({ ...options, 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({ @@ -88,20 +94,26 @@ const del = async (req: express.Request, res: express.Response) => { }); }; -export const streamableHTTPApp = (options: McpOptions): express.Express => { +export const streamableHTTPApp = ({ + clientOptions = {}, + mcpOptions = {}, +}: { + clientOptions?: ClientOptions; + mcpOptions?: McpOptions; +}): express.Express => { const app = express(); app.set('query parser', 'extended'); app.use(express.json()); app.get('/', get); - app.post('/', post(options)); + app.post('/', post({ clientOptions, mcpOptions })); app.delete('/', del); return app; }; export const launchStreamableHTTPServer = async (options: McpOptions, port: number | string | undefined) => { - const app = streamableHTTPApp(options); + const app = streamableHTTPApp({ mcpOptions: options }); const server = app.listen(port); const address = server.address(); diff --git a/packages/mcp-server/src/index.ts b/packages/mcp-server/src/index.ts index c450e4bb4..4850a0e26 100644 --- a/packages/mcp-server/src/index.ts +++ b/packages/mcp-server/src/index.ts @@ -14,7 +14,7 @@ async function main() { return; } - const selectedTools = selectToolsOrError(endpoints, options); + const selectedTools = await selectToolsOrError(endpoints, options); console.error( `MCP Server starting with ${selectedTools.length} tools:`, @@ -47,9 +47,9 @@ function parseOptionsOrError() { } } -function selectToolsOrError(endpoints: Endpoint[], options: McpOptions): Endpoint[] { +async function selectToolsOrError(endpoints: Endpoint[], options: McpOptions): Promise { try { - const includedTools = selectTools(endpoints, options); + const includedTools = await selectTools(endpoints, options); if (includedTools.length === 0) { console.error('No tools match the provided filters.'); process.exit(1); diff --git a/packages/mcp-server/src/options.ts b/packages/mcp-server/src/options.ts index 9eb00b48d..4fe3b9875 100644 --- a/packages/mcp-server/src/options.ts +++ b/packages/mcp-server/src/options.ts @@ -17,6 +17,7 @@ export type McpOptions = { includeDynamicTools?: boolean | undefined; includeAllTools?: boolean | undefined; includeCodeTools?: boolean | undefined; + includeDocsTools?: boolean | undefined; filters?: Filter[] | undefined; capabilities?: Partial | undefined; }; @@ -55,13 +56,13 @@ export function parseCLIOptions(): CLIOptions { .option('tools', { type: 'string', array: true, - choices: ['dynamic', 'all', 'code'], + choices: ['dynamic', 'all', 'code', 'docs'], description: 'Use dynamic tools or all tools', }) .option('no-tools', { type: 'string', array: true, - choices: ['dynamic', 'all', 'code'], + choices: ['dynamic', 'all', 'code', 'docs'], description: 'Do not use any dynamic or all tools', }) .option('tool', { @@ -245,13 +246,15 @@ export function parseCLIOptions(): CLIOptions { } } - const shouldIncludeToolType = (toolType: 'dynamic' | 'all' | 'code') => - explicitTools ? argv.tools?.includes(toolType) && !argv.noTools?.includes(toolType) : undefined; + const shouldIncludeToolType = (toolType: 'dynamic' | 'all' | 'code' | 'docs') => + argv.noTools?.includes(toolType) ? false + : argv.tools?.includes(toolType) ? true + : undefined; - const explicitTools = Boolean(argv.tools || argv.noTools); const includeDynamicTools = shouldIncludeToolType('dynamic'); const includeAllTools = shouldIncludeToolType('all'); const includeCodeTools = shouldIncludeToolType('code'); + const includeDocsTools = shouldIncludeToolType('docs'); const transport = argv.transport as 'stdio' | 'http'; @@ -261,6 +264,7 @@ export function parseCLIOptions(): CLIOptions { includeDynamicTools, includeAllTools, includeCodeTools, + includeDocsTools, filters, capabilities: clientCapabilities, list: argv.list || false, @@ -280,8 +284,8 @@ const coerceArray = (zodType: T) => ); 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'), + tools: coerceArray(z.enum(['dynamic', 'all', 'docs'])).describe('Use dynamic tools or all tools'), + no_tools: coerceArray(z.enum(['dynamic', 'all', 'docs'])).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( @@ -366,17 +370,27 @@ export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): M } } + 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; + + let docsTools: boolean | undefined = + queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false + : queryOptions.tools?.includes('docs') ? true + : defaultOptions.includeDocsTools; + return { client: queryOptions.client ?? defaultOptions.client, - includeDynamicTools: - defaultOptions.includeDynamicTools === false ? - false - : queryOptions.tools?.includes('dynamic') && !queryOptions.no_tools?.includes('dynamic'), - includeAllTools: - defaultOptions.includeAllTools === false ? - false - : queryOptions.tools?.includes('all') && !queryOptions.no_tools?.includes('all'), + includeDynamicTools: dynamicTools, + includeAllTools: allTools, includeCodeTools: undefined, + includeDocsTools: docsTools, filters, capabilities: clientCapabilities, }; diff --git a/packages/mcp-server/src/server.ts b/packages/mcp-server/src/server.ts index 79913bb3a..bd37d253b 100644 --- a/packages/mcp-server/src/server.ts +++ b/packages/mcp-server/src/server.ts @@ -5,8 +5,8 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { Endpoint, endpoints, HandlerFunction, query } from './tools'; import { CallToolRequestSchema, - Implementation, ListToolsRequestSchema, + Implementation, Tool, } from '@modelcontextprotocol/sdk/types.js'; import { ClientOptions } from '@tryfinch/finch-api'; @@ -20,6 +20,7 @@ import { } from './compat'; import { dynamicTools } from './dynamic-tools'; import { codeTool } from './code-tool'; +import docsSearchTool from './docs-search-tool'; import { McpOptions } from './options'; export { McpOptions } from './options'; @@ -32,7 +33,7 @@ export const newMcpServer = () => new McpServer( { name: 'tryfinch_finch_api_api', - version: '6.37.0', + version: '6.38.0', }, { capabilities: { tools: {}, logging: {} } }, ); @@ -55,7 +56,7 @@ export function initMcpServer(params: { let providedEndpoints: Endpoint[] | null = null; let endpointMap: Record | null = null; - const initTools = (implementation?: Implementation) => { + const initTools = async (implementation?: Implementation) => { if (implementation && (!mcpOptions.client || mcpOptions.client === 'infer')) { mcpOptions.client = implementation.name.toLowerCase().includes('claude') ? 'claude' @@ -66,8 +67,8 @@ export function initMcpServer(params: { ...mcpOptions.capabilities, }; } - providedEndpoints = selectTools(endpoints, mcpOptions); - endpointMap = Object.fromEntries(providedEndpoints.map((endpoint) => [endpoint.tool.name, endpoint])); + providedEndpoints ??= await selectTools(endpoints, mcpOptions); + endpointMap ??= Object.fromEntries(providedEndpoints.map((endpoint) => [endpoint.tool.name, endpoint])); }; const client = new Finch({ @@ -82,7 +83,7 @@ export function initMcpServer(params: { server.setRequestHandler(ListToolsRequestSchema, async () => { if (providedEndpoints === null) { - initTools(server.getClientVersion()); + await initTools(server.getClientVersion()); } return { tools: providedEndpoints!.map((endpoint) => endpoint.tool), @@ -91,7 +92,7 @@ export function initMcpServer(params: { server.setRequestHandler(CallToolRequestSchema, async (request) => { if (endpointMap === null) { - initTools(server.getClientVersion()); + await initTools(server.getClientVersion()); } const { name, arguments: args } = request.params; const endpoint = endpointMap![name]; @@ -106,10 +107,10 @@ export function initMcpServer(params: { /** * Selects the tools to include in the MCP Server based on the provided options. */ -export function selectTools(endpoints: Endpoint[], options?: McpOptions): Endpoint[] { +export async function selectTools(endpoints: Endpoint[], options?: McpOptions): Promise { const filteredEndpoints = query(options?.filters ?? [], endpoints); - let includedTools = filteredEndpoints; + let includedTools = filteredEndpoints.slice(); if (includedTools.length > 0) { if (options?.includeDynamicTools) { @@ -117,16 +118,18 @@ export function selectTools(endpoints: Endpoint[], options?: McpOptions): Endpoi } } else { if (options?.includeAllTools) { - includedTools = endpoints; + includedTools = endpoints.slice(); } else if (options?.includeDynamicTools) { includedTools = dynamicTools(endpoints); } else if (options?.includeCodeTools) { - includedTools = [codeTool()]; + includedTools = [await codeTool()]; } else { - includedTools = endpoints; + includedTools = endpoints.slice(); } } - + if (options?.includeDocsTools ?? true) { + includedTools.push(docsSearchTool); + } const capabilities = { ...defaultClientCapabilities, ...options?.capabilities }; return applyCompatibilityTransformations(includedTools, capabilities); } diff --git a/packages/mcp-server/src/tools/access-tokens/create-access-tokens.ts b/packages/mcp-server/src/tools/access-tokens/create-access-tokens.ts index ab9650371..78e30059b 100644 --- a/packages/mcp-server/src/tools/access-tokens/create-access-tokens.ts +++ b/packages/mcp-server/src/tools/access-tokens/create-access-tokens.ts @@ -18,10 +18,14 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_access_tokens', 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\nExchange the authorization code for an access token\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/create_access_token_response',\n $defs: {\n create_access_token_response: {\n type: 'object',\n properties: {\n access_token: {\n type: 'string',\n description: 'The access token for the connection'\n },\n client_type: {\n type: 'string',\n title: 'ClientType',\n description: 'The type of application associated with a token.',\n enum: [ 'development',\n 'production',\n 'sandbox'\n ]\n },\n connection_id: {\n type: 'string',\n description: 'The Finch UUID of the connection associated with the `access_token`'\n },\n connection_type: {\n type: 'string',\n title: 'ConnectionType',\n description: 'The type of the connection associated with the token.\\n- `provider` - connection to an external provider\\n- `finch` - finch-generated data.',\n enum: [ 'finch',\n 'provider'\n ]\n },\n products: {\n type: 'array',\n description: 'An array of the authorized products associated with the `access_token`',\n items: {\n type: 'string'\n }\n },\n provider_id: {\n type: 'string',\n description: 'The ID of the provider associated with the `access_token`'\n },\n token_type: {\n type: 'string',\n description: 'The RFC 8693 token type (Finch uses `bearer` tokens)'\n },\n account_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to identify the connection instead of this account ID'\n },\n company_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to identify the connection instead of this company ID'\n },\n customer_id: {\n type: 'string',\n description: 'The ID of your customer you provided to Finch when a connect session was created for this connection'\n }\n },\n required: [ 'access_token',\n 'client_type',\n 'connection_id',\n 'connection_type',\n 'products',\n 'provider_id',\n 'token_type'\n ]\n }\n }\n}\n```", + "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\nExchange the authorization code for an access token\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/create_access_token_response',\n $defs: {\n create_access_token_response: {\n type: 'object',\n properties: {\n access_token: {\n type: 'string',\n description: 'The access token for the connection'\n },\n client_type: {\n type: 'string',\n title: 'ClientType',\n description: 'The type of application associated with a token.',\n enum: [ 'development',\n 'production',\n 'sandbox'\n ]\n },\n connection_id: {\n type: 'string',\n description: 'The Finch UUID of the connection associated with the `access_token`'\n },\n connection_type: {\n type: 'string',\n title: 'ConnectionType',\n description: 'The type of the connection associated with the token.\\n- `provider` - connection to an external provider\\n- `finch` - finch-generated data.',\n enum: [ 'finch',\n 'provider'\n ]\n },\n entity_ids: {\n type: 'array',\n description: 'An array of entity IDs that can be accessed with this access token',\n items: {\n type: 'string'\n }\n },\n products: {\n type: 'array',\n description: 'An array of the authorized products associated with the `access_token`',\n items: {\n type: 'string'\n }\n },\n provider_id: {\n type: 'string',\n description: 'The ID of the provider associated with the `access_token`'\n },\n token_type: {\n type: 'string',\n description: 'The RFC 8693 token type (Finch uses `bearer` tokens)'\n },\n account_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to identify the connection instead of this account ID'\n },\n company_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to identify the connection instead of this company ID'\n },\n customer_id: {\n type: 'string',\n description: 'The ID of your customer you provided to Finch when a connect session was created for this connection'\n }\n },\n required: [ 'access_token',\n 'client_type',\n 'connection_id',\n 'connection_type',\n 'entity_ids',\n 'products',\n 'provider_id',\n 'token_type'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { + code: { + type: 'string', + description: 'The authorization code received from the authorization server', + }, client_id: { type: 'string', description: 'The client ID for your application', @@ -30,10 +34,6 @@ export const tool: Tool = { type: 'string', description: 'The client secret for your application', }, - code: { - type: 'string', - description: 'The authorization code received from the authorization server', - }, redirect_uri: { type: 'string', description: 'The redirect URI used in the authorization request (optional)', @@ -45,7 +45,7 @@ export const tool: Tool = { '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: ['client_id', 'client_secret', 'code'], + required: ['code'], }, annotations: {}, }; diff --git a/packages/mcp-server/src/tools/account/introspect-account.ts b/packages/mcp-server/src/tools/account/introspect-account.ts index bdc030fbb..f826f4bfc 100644 --- a/packages/mcp-server/src/tools/account/introspect-account.ts +++ b/packages/mcp-server/src/tools/account/introspect-account.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'introspect_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\nRead account information associated with an `access_token`\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/introspection',\n $defs: {\n introspection: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'The Finch UUID of the token being introspected'\n },\n client_id: {\n type: 'string',\n description: 'The client ID of the application associated with the `access_token`'\n },\n client_type: {\n type: 'string',\n title: 'ClientType',\n description: 'The type of application associated with a token.',\n enum: [ 'development',\n 'production',\n 'sandbox'\n ]\n },\n connection_id: {\n type: 'string',\n description: 'The Finch UUID of the connection associated with the `access_token`'\n },\n connection_status: {\n type: 'object',\n properties: {\n status: {\n $ref: '#/$defs/connection_status_type'\n },\n last_successful_sync: {\n anyOf: [ {\n type: 'string',\n format: 'date-time'\n },\n {\n type: 'string'\n }\n ],\n description: 'The datetime when the connection was last successfully synced'\n },\n message: {\n type: 'string'\n }\n },\n required: [ 'status'\n ]\n },\n connection_type: {\n type: 'string',\n title: 'ConnectionType',\n description: 'The type of the connection associated with the token.\\n- `provider` - connection to an external provider\\n- `finch` - finch-generated data.',\n enum: [ 'finch',\n 'provider'\n ]\n },\n products: {\n type: 'array',\n description: 'An array of the authorized products associated with the `access_token`.',\n items: {\n type: 'string'\n }\n },\n provider_id: {\n type: 'string',\n description: 'The ID of the provider associated with the `access_token`.'\n },\n account_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this account ID'\n },\n authentication_methods: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n description: 'The type of authentication method',\n enum: [ 'assisted',\n 'credential',\n 'api_token',\n 'api_credential',\n 'oauth'\n ]\n },\n connection_status: {\n type: 'object',\n properties: {\n status: {\n $ref: '#/$defs/connection_status_type'\n },\n last_successful_sync: {\n anyOf: [ {\n type: 'string',\n format: 'date-time'\n },\n {\n type: 'string'\n }\n ],\n description: 'The datetime when the connection was last successfully synced'\n },\n message: {\n type: 'string'\n }\n },\n required: [ 'status'\n ]\n },\n products: {\n type: 'array',\n description: 'An array of the authorized products associated with the `access_token`',\n items: {\n type: 'string'\n }\n }\n },\n required: [ 'type'\n ]\n }\n },\n company_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this company ID'\n },\n customer_email: {\n type: 'string',\n description: 'The email of your customer you provided to Finch when a connect session was created for this connection'\n },\n customer_id: {\n type: 'string',\n description: 'The ID of your customer you provided to Finch when a connect session was created for this connection'\n },\n customer_name: {\n type: 'string',\n description: 'The name of your customer you provided to Finch when a connect session was created for this connection'\n },\n manual: {\n type: 'boolean',\n description: 'Whether the connection associated with the `access_token` uses the Assisted Connect Flow. (`true` if using Assisted Connect, `false` if connection is automated)'\n },\n payroll_provider_id: {\n type: 'string',\n description: '[DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider ID.'\n },\n username: {\n type: 'string',\n description: 'The account username used for login associated with the `access_token`.'\n }\n },\n required: [ 'id',\n 'client_id',\n 'client_type',\n 'connection_id',\n 'connection_status',\n 'connection_type',\n 'products',\n 'provider_id'\n ]\n },\n connection_status_type: {\n type: 'string',\n enum: [ 'pending',\n 'processing',\n 'connected',\n 'error_no_account_setup',\n 'error_permissions',\n 'reauth'\n ]\n }\n }\n}\n```", + "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\nRead account information associated with an `access_token`\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/introspection',\n $defs: {\n introspection: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'The Finch UUID of the token being introspected'\n },\n client_id: {\n type: 'string',\n description: 'The client ID of the application associated with the `access_token`'\n },\n client_type: {\n type: 'string',\n title: 'ClientType',\n description: 'The type of application associated with a token.',\n enum: [ 'development',\n 'production',\n 'sandbox'\n ]\n },\n connection_id: {\n type: 'string',\n description: 'The Finch UUID of the connection associated with the `access_token`'\n },\n connection_status: {\n type: 'object',\n properties: {\n status: {\n $ref: '#/$defs/connection_status_type'\n },\n last_successful_sync: {\n anyOf: [ {\n type: 'string',\n format: 'date-time'\n },\n {\n type: 'string'\n }\n ],\n description: 'The datetime when the connection was last successfully synced'\n },\n message: {\n type: 'string'\n }\n },\n required: [ 'status'\n ]\n },\n connection_type: {\n type: 'string',\n title: 'ConnectionType',\n description: 'The type of the connection associated with the token.\\n- `provider` - connection to an external provider\\n- `finch` - finch-generated data.',\n enum: [ 'finch',\n 'provider'\n ]\n },\n products: {\n type: 'array',\n description: 'An array of the authorized products associated with the `access_token`.',\n items: {\n type: 'string'\n }\n },\n provider_id: {\n type: 'string',\n description: 'The ID of the provider associated with the `access_token`.'\n },\n account_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this account ID'\n },\n authentication_methods: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n description: 'The type of authentication method',\n enum: [ 'assisted',\n 'credential',\n 'api_token',\n 'api_credential',\n 'oauth'\n ]\n },\n connection_status: {\n type: 'object',\n properties: {\n status: {\n $ref: '#/$defs/connection_status_type'\n },\n last_successful_sync: {\n anyOf: [ {\n type: 'string',\n format: 'date-time'\n },\n {\n type: 'string'\n }\n ],\n description: 'The datetime when the connection was last successfully synced'\n },\n message: {\n type: 'string'\n }\n },\n required: [ 'status'\n ]\n },\n products: {\n type: 'array',\n description: 'An array of the authorized products associated with the `access_token`',\n items: {\n type: 'string'\n }\n }\n },\n required: [ 'type'\n ]\n }\n },\n company_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this company ID'\n },\n customer_email: {\n type: 'string',\n description: 'The email of your customer you provided to Finch when a connect session was created for this connection'\n },\n customer_id: {\n type: 'string',\n description: 'The ID of your customer you provided to Finch when a connect session was created for this connection'\n },\n customer_name: {\n type: 'string',\n description: 'The name of your customer you provided to Finch when a connect session was created for this connection'\n },\n entities: {\n type: 'array',\n description: 'Array of detailed entity information for each connected account in multi-account mode',\n items: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'The connection account ID for this entity'\n },\n name: {\n type: 'string',\n description: 'The name of the entity (payroll provider company name)'\n },\n source_id: {\n type: 'string',\n description: 'The source ID of the entity'\n },\n type: {\n type: 'string',\n description: 'The type of entity'\n }\n },\n required: [ 'id',\n 'name',\n 'source_id',\n 'type'\n ]\n }\n },\n manual: {\n type: 'boolean',\n description: 'Whether the connection associated with the `access_token` uses the Assisted Connect Flow. (`true` if using Assisted Connect, `false` if connection is automated)'\n },\n payroll_provider_id: {\n type: 'string',\n description: '[DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider ID.'\n },\n username: {\n type: 'string',\n description: 'The account username used for login associated with the `access_token`.'\n }\n },\n required: [ 'id',\n 'client_id',\n 'client_type',\n 'connection_id',\n 'connection_status',\n 'connection_type',\n 'products',\n 'provider_id'\n ]\n },\n connection_status_type: {\n type: 'string',\n enum: [ 'pending',\n 'processing',\n 'connected',\n 'error_no_account_setup',\n 'error_permissions',\n 'reauth'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { diff --git a/packages/mcp-server/src/tools/connect/sessions/new-connect-sessions.ts b/packages/mcp-server/src/tools/connect/sessions/new-connect-sessions.ts index a1914cffd..0333a867e 100644 --- a/packages/mcp-server/src/tools/connect/sessions/new-connect-sessions.ts +++ b/packages/mcp-server/src/tools/connect/sessions/new-connect-sessions.ts @@ -18,63 +18,74 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'new_connect_sessions', 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 connect session for an employer\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n connect_url: {\n type: 'string',\n description: 'The Connect URL to redirect the user to for authentication'\n },\n session_id: {\n type: 'string',\n description: 'The unique identifier for the created connect session'\n }\n },\n required: [ 'connect_url',\n 'session_id'\n ]\n}\n```", + "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 connect session for an employer\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/session_new_response',\n $defs: {\n session_new_response: {\n type: 'object',\n properties: {\n connect_url: {\n type: 'string',\n description: 'The Connect URL to redirect the user to for authentication'\n },\n session_id: {\n type: 'string',\n description: 'The unique identifier for the created connect session'\n }\n },\n required: [ 'connect_url',\n 'session_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { - customer_id: { + customer_email: { type: 'string', + description: 'Email address of the customer', }, - customer_name: { + customer_id: { type: 'string', + description: 'Unique identifier for the customer', }, - products: { - type: 'array', - items: { - type: 'string', - description: 'The Finch products that can be requested during the Connect flow.', - enum: [ - 'company', - 'directory', - 'individual', - 'employment', - 'payment', - 'pay_statement', - 'benefits', - 'ssn', - 'deduction', - 'documents', - ], - }, - }, - customer_email: { + customer_name: { type: 'string', + description: 'Name of the customer', }, integration: { type: 'object', + description: 'Integration configuration for the connect session', properties: { auth_method: { type: 'string', + description: 'The authentication method to use', enum: ['assisted', 'credential', 'oauth', 'api_token'], }, provider: { type: 'string', + description: 'The provider to integrate with', }, }, + required: ['auth_method', 'provider'], }, manual: { type: 'boolean', + description: 'Enable manual authentication mode', }, minutes_to_expire: { type: 'number', description: 'The number of minutes until the session expires (defaults to 129,600, which is 90 days)', }, + products: { + type: 'array', + description: 'The Finch products to request access to', + items: { + type: 'string', + description: 'The Finch products that can be requested during the Connect flow.', + enum: [ + 'benefits', + 'company', + 'deduction', + 'directory', + 'documents', + 'employment', + 'individual', + 'payment', + 'pay_statement', + 'ssn', + ], + }, + }, redirect_uri: { type: 'string', + description: 'The URI to redirect to after the Connect flow is completed', }, sandbox: { type: 'string', + description: 'Sandbox mode for testing', enum: ['finch', 'provider'], }, jq_filter: { @@ -84,7 +95,17 @@ export const tool: Tool = { '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', 'customer_name', 'products'], + required: [ + 'customer_email', + 'customer_id', + 'customer_name', + 'integration', + 'manual', + 'minutes_to_expire', + 'products', + 'redirect_uri', + 'sandbox', + ], }, annotations: {}, }; diff --git a/packages/mcp-server/src/tools/connect/sessions/reauthenticate-connect-sessions.ts b/packages/mcp-server/src/tools/connect/sessions/reauthenticate-connect-sessions.ts index 017a780cd..028508c64 100644 --- a/packages/mcp-server/src/tools/connect/sessions/reauthenticate-connect-sessions.ts +++ b/packages/mcp-server/src/tools/connect/sessions/reauthenticate-connect-sessions.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'reauthenticate_connect_sessions', 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 Connect session for reauthenticating an existing connection\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n connect_url: {\n type: 'string',\n description: 'The Connect URL to redirect the user to for reauthentication'\n },\n session_id: {\n type: 'string',\n description: 'The unique identifier for the created connect session'\n }\n },\n required: [ 'connect_url',\n 'session_id'\n ]\n}\n```", + "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 Connect session for reauthenticating an existing connection\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/session_reauthenticate_response',\n $defs: {\n session_reauthenticate_response: {\n type: 'object',\n properties: {\n connect_url: {\n type: 'string',\n description: 'The Connect URL to redirect the user to for reauthentication'\n },\n session_id: {\n type: 'string',\n description: 'The unique identifier for the created connect session'\n }\n },\n required: [ 'connect_url',\n 'session_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -37,16 +37,16 @@ export const tool: Tool = { type: 'string', description: 'The Finch products that can be requested during the Connect flow.', enum: [ + 'benefits', 'company', + 'deduction', 'directory', - 'individual', + 'documents', 'employment', + 'individual', 'payment', 'pay_statement', - 'benefits', 'ssn', - 'deduction', - 'documents', ], }, }, @@ -61,7 +61,7 @@ export const tool: Tool = { '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: ['connection_id'], + required: ['connection_id', 'minutes_to_expire', 'products', 'redirect_uri'], }, annotations: {}, }; diff --git a/packages/mcp-server/src/tools/hris/benefits/create-hris-benefits.ts b/packages/mcp-server/src/tools/hris/benefits/create-hris-benefits.ts index 2f3e37ff8..dd236291a 100644 --- a/packages/mcp-server/src/tools/hris/benefits/create-hris-benefits.ts +++ b/packages/mcp-server/src/tools/hris/benefits/create-hris-benefits.ts @@ -22,6 +22,13 @@ export const tool: Tool = { inputSchema: { type: 'object', properties: { + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, company_contribution: { type: 'object', title: 'BenefitCompanyMatchContribution', diff --git a/packages/mcp-server/src/tools/hris/benefits/individuals/enroll-many-benefits-hris-individuals.ts b/packages/mcp-server/src/tools/hris/benefits/individuals/enroll-many-benefits-hris-individuals.ts index b4370f4af..0df297acd 100644 --- a/packages/mcp-server/src/tools/hris/benefits/individuals/enroll-many-benefits-hris-individuals.ts +++ b/packages/mcp-server/src/tools/hris/benefits/individuals/enroll-many-benefits-hris-individuals.ts @@ -25,6 +25,13 @@ export const tool: Tool = { benefit_id: { type: 'string', }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, individuals: { type: 'array', description: 'Array of the individual_id to enroll and a configuration object.', @@ -56,9 +63,29 @@ export const tool: Tool = { description: 'Amount in cents for fixed type or basis points (1/100th of a percent) for percent type', }, + tiers: { + type: 'array', + description: + 'Array of tier objects for tiered contribution matching (required when type is tiered)', + items: { + type: 'object', + properties: { + match: { + type: 'integer', + description: 'The employer match percentage in basis points (0-10000 = 0-100%)', + }, + threshold: { + type: 'integer', + description: + 'The employee contribution threshold in basis points (0-10000 = 0-100%)', + }, + }, + required: ['match', 'threshold'], + }, + }, type: { type: 'string', - enum: ['fixed', 'percent'], + enum: ['fixed', 'percent', 'tiered'], }, }, }, @@ -105,10 +132,7 @@ export const tool: Tool = { export const handler = async (client: Finch, args: Record | undefined) => { const { benefit_id, jq_filter, ...body } = args as any; return asTextContentResult( - await maybeFilter( - jq_filter, - await client.hris.benefits.individuals.enrollMany(benefit_id, body['individuals']), - ), + await maybeFilter(jq_filter, await client.hris.benefits.individuals.enrollMany(benefit_id, body)), ); }; diff --git a/packages/mcp-server/src/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.ts b/packages/mcp-server/src/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.ts index 4c85d9429..86a7f2bb9 100644 --- a/packages/mcp-server/src/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.ts +++ b/packages/mcp-server/src/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.ts @@ -18,13 +18,20 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'enrolled_ids_benefits_hris_individuals', 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 individuals currently enrolled in a given deduction.\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n benefit_id: {\n type: 'string',\n description: 'The id of the benefit.'\n },\n individual_ids: {\n type: 'array',\n items: {\n type: 'string',\n description: 'A stable Finch `id` (UUID v4) for an individual in the company.'\n }\n }\n },\n required: [ 'benefit_id',\n 'individual_ids'\n ]\n}\n```", + "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 individuals currently enrolled in a given deduction.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/individual_enrolled_ids_response',\n $defs: {\n individual_enrolled_ids_response: {\n type: 'object',\n properties: {\n benefit_id: {\n type: 'string',\n description: 'The id of the benefit.'\n },\n individual_ids: {\n type: 'array',\n items: {\n type: 'string',\n description: 'A stable Finch `id` (UUID v4) for an individual in the company.'\n }\n }\n },\n required: [ 'benefit_id',\n 'individual_ids'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { benefit_id: { type: 'string', }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, jq_filter: { type: 'string', title: 'jq Filter', @@ -42,7 +49,7 @@ export const tool: Tool = { export const handler = async (client: Finch, args: Record | undefined) => { const { benefit_id, jq_filter, ...body } = args as any; return asTextContentResult( - await maybeFilter(jq_filter, await client.hris.benefits.individuals.enrolledIds(benefit_id)), + await maybeFilter(jq_filter, await client.hris.benefits.individuals.enrolledIds(benefit_id, body)), ); }; diff --git a/packages/mcp-server/src/tools/hris/benefits/individuals/retrieve-many-benefits-benefits-hris-individuals.ts b/packages/mcp-server/src/tools/hris/benefits/individuals/retrieve-many-benefits-benefits-hris-individuals.ts index 96265c984..4613572da 100644 --- a/packages/mcp-server/src/tools/hris/benefits/individuals/retrieve-many-benefits-benefits-hris-individuals.ts +++ b/packages/mcp-server/src/tools/hris/benefits/individuals/retrieve-many-benefits-benefits-hris-individuals.ts @@ -18,13 +18,20 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_many_benefits_benefits_hris_individuals', 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\nGet enrollment information for the given individuals.\n\n# Response Schema\n```json\n{\n type: 'array',\n title: 'IndividualBenefits',\n items: {\n $ref: '#/$defs/individual_benefit'\n },\n $defs: {\n individual_benefit: {\n type: 'object',\n properties: {\n body: {\n anyOf: [ {\n type: 'object',\n properties: {\n annual_maximum: {\n type: 'integer',\n description: 'If the benefit supports annual maximum, the amount in cents for this individual.'\n },\n catch_up: {\n type: 'boolean',\n description: 'If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for this individual.'\n },\n company_contribution: {\n $ref: '#/$defs/benefit_contribution'\n },\n employee_deduction: {\n $ref: '#/$defs/benefit_contribution'\n },\n hsa_contribution_limit: {\n type: 'string',\n description: 'Type for HSA contribution limit if the benefit is a HSA.',\n enum: [ 'individual',\n 'family'\n ]\n }\n },\n required: [ 'annual_maximum',\n 'catch_up',\n 'company_contribution',\n 'employee_deduction'\n ]\n },\n {\n type: 'object',\n properties: {\n code: {\n type: 'number'\n },\n message: {\n type: 'string'\n },\n name: {\n type: 'string'\n },\n finch_code: {\n type: 'string'\n }\n },\n required: [ 'code',\n 'message',\n 'name'\n ]\n }\n ]\n },\n code: {\n type: 'integer'\n },\n individual_id: {\n type: 'string'\n }\n },\n required: [ 'body',\n 'code',\n 'individual_id'\n ]\n },\n benefit_contribution: {\n type: 'object',\n title: 'BenefitContribution',\n properties: {\n amount: {\n type: 'integer',\n description: 'Contribution amount in cents (if `fixed`) or basis points (if `percent`).'\n },\n type: {\n type: 'string',\n description: 'Contribution type.',\n enum: [ 'fixed',\n 'percent'\n ]\n }\n },\n required: [ 'amount',\n 'type'\n ]\n }\n }\n}\n```", + "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\nGet enrollment information for the given individuals.\n\n# Response Schema\n```json\n{\n type: 'array',\n title: 'IndividualBenefits',\n items: {\n $ref: '#/$defs/individual_benefit'\n },\n $defs: {\n individual_benefit: {\n type: 'object',\n properties: {\n body: {\n anyOf: [ {\n type: 'object',\n properties: {\n annual_maximum: {\n type: 'integer',\n description: 'If the benefit supports annual maximum, the amount in cents for this individual.'\n },\n catch_up: {\n type: 'boolean',\n description: 'If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for this individual.'\n },\n company_contribution: {\n anyOf: [ {\n type: 'object',\n properties: {\n amount: {\n type: 'integer',\n description: 'Contribution amount in cents.'\n },\n type: {\n type: 'string',\n description: 'Fixed contribution type.',\n enum: [ 'fixed'\n ]\n }\n },\n required: [ 'amount',\n 'type'\n ]\n },\n {\n type: 'object',\n properties: {\n amount: {\n type: 'integer',\n description: 'Contribution amount in basis points (1/100th of a percent).'\n },\n type: {\n type: 'string',\n description: 'Percentage contribution type.',\n enum: [ 'percent'\n ]\n }\n },\n required: [ 'amount',\n 'type'\n ]\n },\n {\n type: 'object',\n properties: {\n tiers: {\n type: 'array',\n description: 'Array of tier objects defining employer match tiers based on employee contribution thresholds.',\n items: {\n type: 'object',\n properties: {\n match: {\n type: 'integer'\n },\n threshold: {\n type: 'integer'\n }\n },\n required: [ 'match',\n 'threshold'\n ]\n }\n },\n type: {\n type: 'string',\n description: 'Tiered contribution type (only valid for company_contribution).',\n enum: [ 'tiered'\n ]\n }\n },\n required: [ 'tiers',\n 'type'\n ]\n }\n ],\n title: 'CompanyContribution'\n },\n employee_deduction: {\n anyOf: [ {\n type: 'object',\n properties: {\n amount: {\n type: 'integer',\n description: 'Contribution amount in cents.'\n },\n type: {\n type: 'string',\n description: 'Fixed contribution type.',\n enum: [ 'fixed'\n ]\n }\n },\n required: [ 'amount',\n 'type'\n ]\n },\n {\n type: 'object',\n properties: {\n amount: {\n type: 'integer',\n description: 'Contribution amount in basis points (1/100th of a percent).'\n },\n type: {\n type: 'string',\n description: 'Percentage contribution type.',\n enum: [ 'percent'\n ]\n }\n },\n required: [ 'amount',\n 'type'\n ]\n }\n ],\n title: 'EmployeeDeductionContribution'\n },\n hsa_contribution_limit: {\n type: 'string',\n description: 'Type for HSA contribution limit if the benefit is a HSA.',\n enum: [ 'individual',\n 'family'\n ]\n }\n },\n required: [ 'annual_maximum',\n 'catch_up',\n 'company_contribution',\n 'employee_deduction'\n ]\n },\n {\n type: 'object',\n properties: {\n code: {\n type: 'number'\n },\n message: {\n type: 'string'\n },\n name: {\n type: 'string'\n },\n finch_code: {\n type: 'string'\n }\n },\n required: [ 'code',\n 'message',\n 'name'\n ]\n }\n ]\n },\n code: {\n type: 'integer'\n },\n individual_id: {\n type: 'string'\n }\n },\n required: [ 'body',\n 'code',\n 'individual_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { benefit_id: { type: 'string', }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, individual_ids: { type: 'string', description: diff --git a/packages/mcp-server/src/tools/hris/benefits/individuals/unenroll-many-benefits-hris-individuals.ts b/packages/mcp-server/src/tools/hris/benefits/individuals/unenroll-many-benefits-hris-individuals.ts index 12f98446a..6efef5787 100644 --- a/packages/mcp-server/src/tools/hris/benefits/individuals/unenroll-many-benefits-hris-individuals.ts +++ b/packages/mcp-server/src/tools/hris/benefits/individuals/unenroll-many-benefits-hris-individuals.ts @@ -25,6 +25,13 @@ export const tool: Tool = { benefit_id: { type: 'string', }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, individual_ids: { type: 'array', description: 'Array of individual_ids to unenroll.', diff --git a/packages/mcp-server/src/tools/hris/benefits/list-hris-benefits.ts b/packages/mcp-server/src/tools/hris/benefits/list-hris-benefits.ts index d2db92707..a2524e0f1 100644 --- a/packages/mcp-server/src/tools/hris/benefits/list-hris-benefits.ts +++ b/packages/mcp-server/src/tools/hris/benefits/list-hris-benefits.ts @@ -22,6 +22,13 @@ export const tool: Tool = { inputSchema: { type: 'object', properties: { + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, jq_filter: { type: 'string', title: 'jq Filter', @@ -37,8 +44,8 @@ export const tool: Tool = { }; export const handler = async (client: Finch, args: Record | undefined) => { - const { jq_filter } = args as any; - const response = await client.hris.benefits.list().asResponse(); + const { jq_filter, ...body } = args as any; + const response = await client.hris.benefits.list(body).asResponse(); return asTextContentResult(await maybeFilter(jq_filter, await response.json())); }; diff --git a/packages/mcp-server/src/tools/hris/benefits/list-supported-benefits-hris-benefits.ts b/packages/mcp-server/src/tools/hris/benefits/list-supported-benefits-hris-benefits.ts index 49dc8e569..323e8f5fc 100644 --- a/packages/mcp-server/src/tools/hris/benefits/list-supported-benefits-hris-benefits.ts +++ b/packages/mcp-server/src/tools/hris/benefits/list-supported-benefits-hris-benefits.ts @@ -18,10 +18,17 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_supported_benefits_hris_benefits', 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\nGet deductions metadata\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/supported_benefit'\n },\n $defs: {\n supported_benefit: {\n type: 'object',\n title: 'BenefitFeature',\n properties: {\n annual_maximum: {\n type: 'boolean',\n description: 'Whether the provider supports an annual maximum for this benefit.'\n },\n company_contribution: {\n type: 'array',\n description: 'Supported contribution types. An empty array indicates contributions are not supported.',\n items: {\n type: 'string',\n enum: [ 'fixed',\n 'percent'\n ]\n }\n },\n description: {\n type: 'string'\n },\n employee_deduction: {\n type: 'array',\n description: 'Supported deduction types. An empty array indicates deductions are not supported.',\n items: {\n type: 'string',\n enum: [ 'fixed',\n 'percent'\n ]\n }\n },\n frequencies: {\n type: 'array',\n description: 'The list of frequencies supported by the provider for this benefit',\n items: {\n $ref: '#/$defs/benefit_frequency'\n }\n },\n catch_up: {\n type: 'boolean',\n description: 'Whether the provider supports catch up for this benefit. This field will only be true for retirement benefits.'\n },\n hsa_contribution_limit: {\n type: 'array',\n description: 'Whether the provider supports HSA contribution limits. Empty if this feature is not supported for the benefit. This array only has values for HSA benefits.',\n items: {\n type: 'string',\n enum: [ 'family',\n 'individual'\n ]\n }\n }\n },\n required: [ 'annual_maximum',\n 'company_contribution',\n 'description',\n 'employee_deduction',\n 'frequencies'\n ]\n },\n benefit_frequency: {\n type: 'string',\n title: 'BenefitFrequency',\n description: 'The frequency of the benefit deduction/contribution.',\n enum: [ 'every_paycheck',\n 'monthly',\n 'one_time'\n ]\n }\n }\n}\n```", + "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\nGet deductions metadata\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/supported_benefit'\n },\n $defs: {\n supported_benefit: {\n type: 'object',\n title: 'BenefitFeature',\n properties: {\n annual_maximum: {\n type: 'boolean',\n description: 'Whether the provider supports an annual maximum for this benefit.'\n },\n company_contribution: {\n type: 'array',\n description: 'Supported contribution types. An empty array indicates contributions are not supported.',\n items: {\n type: 'string',\n enum: [ 'fixed',\n 'percent',\n 'tiered'\n ]\n }\n },\n description: {\n type: 'string'\n },\n employee_deduction: {\n type: 'array',\n description: 'Supported deduction types. An empty array indicates deductions are not supported.',\n items: {\n type: 'string',\n enum: [ 'fixed',\n 'percent'\n ]\n }\n },\n frequencies: {\n type: 'array',\n description: 'The list of frequencies supported by the provider for this benefit',\n items: {\n $ref: '#/$defs/benefit_frequency'\n }\n },\n catch_up: {\n type: 'boolean',\n description: 'Whether the provider supports catch up for this benefit. This field will only be true for retirement benefits.'\n },\n hsa_contribution_limit: {\n type: 'array',\n description: 'Whether the provider supports HSA contribution limits. Empty if this feature is not supported for the benefit. This array only has values for HSA benefits.',\n items: {\n type: 'string',\n enum: [ 'family',\n 'individual'\n ]\n }\n }\n },\n required: [ 'annual_maximum',\n 'company_contribution',\n 'description',\n 'employee_deduction',\n 'frequencies'\n ]\n },\n benefit_frequency: {\n type: 'string',\n title: 'BenefitFrequency',\n description: 'The frequency of the benefit deduction/contribution.',\n enum: [ 'every_paycheck',\n 'monthly',\n 'one_time'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, jq_filter: { type: 'string', title: 'jq Filter', @@ -37,8 +44,8 @@ export const tool: Tool = { }; export const handler = async (client: Finch, args: Record | undefined) => { - const { jq_filter } = args as any; - const response = await client.hris.benefits.listSupportedBenefits().asResponse(); + const { jq_filter, ...body } = args as any; + const response = await client.hris.benefits.listSupportedBenefits(body).asResponse(); return asTextContentResult(await maybeFilter(jq_filter, await response.json())); }; diff --git a/packages/mcp-server/src/tools/hris/benefits/retrieve-hris-benefits.ts b/packages/mcp-server/src/tools/hris/benefits/retrieve-hris-benefits.ts index 962fea52a..3ba7ef8c8 100644 --- a/packages/mcp-server/src/tools/hris/benefits/retrieve-hris-benefits.ts +++ b/packages/mcp-server/src/tools/hris/benefits/retrieve-hris-benefits.ts @@ -25,6 +25,13 @@ export const tool: Tool = { benefit_id: { type: 'string', }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, jq_filter: { type: 'string', title: 'jq Filter', @@ -41,7 +48,9 @@ export const tool: Tool = { export const handler = async (client: Finch, args: Record | undefined) => { const { benefit_id, jq_filter, ...body } = args as any; - return asTextContentResult(await maybeFilter(jq_filter, await client.hris.benefits.retrieve(benefit_id))); + return asTextContentResult( + await maybeFilter(jq_filter, await client.hris.benefits.retrieve(benefit_id, body)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/hris/benefits/update-hris-benefits.ts b/packages/mcp-server/src/tools/hris/benefits/update-hris-benefits.ts index 62ba29eb5..6175fc5bf 100644 --- a/packages/mcp-server/src/tools/hris/benefits/update-hris-benefits.ts +++ b/packages/mcp-server/src/tools/hris/benefits/update-hris-benefits.ts @@ -25,6 +25,13 @@ export const tool: Tool = { benefit_id: { type: 'string', }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, description: { type: 'string', description: 'Updated name or description.', diff --git a/packages/mcp-server/src/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.ts b/packages/mcp-server/src/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.ts index bc1a82b09..00fee1e46 100644 --- a/packages/mcp-server/src/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.ts +++ b/packages/mcp-server/src/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_company_hris_pay_statement_item', 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**Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon\n Retrieve a list of detailed pay statement items for the access token's connection account.\n\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n responses: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n attributes: {\n type: 'object',\n description: 'The attributes of the pay statement item.',\n properties: {\n metadata: {\n type: 'object',\n description: 'The metadata of the pay statement item derived by the rules engine if available. Each attribute will be a key-value pair defined by a rule.',\n additionalProperties: true\n },\n employer: {\n type: 'boolean',\n description: '`true` if the amount is paid by the employers. This field is only available for taxes.'\n },\n pre_tax: {\n type: 'boolean',\n description: '`true` if the pay statement item is pre-tax. This field is only available for employee deductions.'\n },\n type: {\n type: 'string',\n description: 'The type of the pay statement item.'\n }\n },\n required: [ 'metadata'\n ]\n },\n category: {\n type: 'string',\n description: 'The category of the pay statement item.',\n enum: [ 'earnings',\n 'taxes',\n 'employee_deductions',\n 'employer_contributions'\n ]\n },\n name: {\n type: 'string',\n description: 'The name of the pay statement item.'\n }\n },\n required: [ 'attributes',\n 'category',\n 'name'\n ]\n }\n }\n },\n required: [ 'responses'\n ]\n}\n```", + "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**Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon\n Retrieve a list of detailed pay statement items for the access token's connection account.\n\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n responses: {\n type: 'array',\n items: {\n $ref: '#/$defs/pay_statement_item_list_response'\n }\n }\n },\n required: [ 'responses'\n ],\n $defs: {\n pay_statement_item_list_response: {\n type: 'object',\n properties: {\n attributes: {\n type: 'object',\n description: 'The attributes of the pay statement item.',\n properties: {\n metadata: {\n type: 'object',\n description: 'The metadata of the pay statement item derived by the rules engine if available. Each attribute will be a key-value pair defined by a rule.',\n additionalProperties: true\n },\n employer: {\n type: 'boolean',\n description: '`true` if the amount is paid by the employers. This field is only available for taxes.'\n },\n pre_tax: {\n type: 'boolean',\n description: '`true` if the pay statement item is pre-tax. This field is only available for employee deductions.'\n },\n type: {\n type: 'string',\n description: 'The type of the pay statement item.'\n }\n },\n required: [ 'metadata'\n ]\n },\n category: {\n type: 'string',\n description: 'The category of the pay statement item.',\n enum: [ 'earnings',\n 'taxes',\n 'employee_deductions',\n 'employer_contributions'\n ]\n },\n name: {\n type: 'string',\n description: 'The name of the pay statement item.'\n }\n },\n required: [ 'attributes',\n 'category',\n 'name'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -37,6 +37,13 @@ export const tool: Tool = { 'The end date to retrieve pay statement items by via their last seen pay date in `YYYY-MM-DD` format.', format: 'date', }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, name: { type: 'string', description: 'Case-insensitive partial match search by pay statement item name.', diff --git a/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.ts b/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.ts index 8367eeeac..c4e51c454 100644 --- a/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.ts +++ b/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.ts @@ -18,10 +18,17 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_pay_statement_item_company_hris_rules', 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**Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon\nCustom rules can be created to associate specific attributes to pay statement items depending on the use case. For example, pay statement items that meet certain conditions can be labeled as a pre-tax 401k. This metadata can be retrieved where pay statement item information is available.\n\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the rule.'\n },\n attributes: {\n type: 'object',\n description: 'Specifies the fields to be applied when the condition is met.',\n properties: {\n metadata: {\n type: 'object',\n description: 'The metadata to be attached in the entity. It is a key-value pairs where the values can be of any type (string, number, boolean, object, array, etc.).',\n additionalProperties: true\n }\n }\n },\n conditions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The field to be checked in the rule.'\n },\n operator: {\n type: 'string',\n description: 'The operator to be used in the rule.',\n enum: [ 'equals'\n ]\n },\n value: {\n type: 'string',\n description: 'The value of the field to be checked in the rule.'\n }\n }\n }\n },\n created_at: {\n type: 'string',\n description: 'The datetime when the rule was created.',\n format: 'date-time'\n },\n effective_end_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rules should stop applying rules based on the date.'\n },\n effective_start_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rule should begin applying based on the date.'\n },\n entity_type: {\n type: 'string',\n description: 'The entity type to which the rule is applied.',\n enum: [ 'pay_statement_item'\n ]\n },\n priority: {\n type: 'integer',\n description: 'The priority of the rule.'\n },\n updated_at: {\n type: 'string',\n description: 'The datetime when the rule was last updated.',\n format: 'date-time'\n }\n }\n}\n```", + "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**Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon\nCustom rules can be created to associate specific attributes to pay statement items depending on the use case. For example, pay statement items that meet certain conditions can be labeled as a pre-tax 401k. This metadata can be retrieved where pay statement item information is available.\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/rule_create_response',\n $defs: {\n rule_create_response: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the rule.'\n },\n attributes: {\n type: 'object',\n description: 'Specifies the fields to be applied when the condition is met.',\n properties: {\n metadata: {\n type: 'object',\n description: 'The metadata to be attached in the entity. It is a key-value pairs where the values can be of any type (string, number, boolean, object, array, etc.).',\n additionalProperties: true\n }\n }\n },\n conditions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The field to be checked in the rule.'\n },\n operator: {\n type: 'string',\n description: 'The operator to be used in the rule.',\n enum: [ 'equals'\n ]\n },\n value: {\n type: 'string',\n description: 'The value of the field to be checked in the rule.'\n }\n }\n }\n },\n created_at: {\n type: 'string',\n description: 'The datetime when the rule was created.',\n format: 'date-time'\n },\n effective_end_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rules should stop applying rules based on the date.'\n },\n effective_start_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rule should begin applying based on the date.'\n },\n entity_type: {\n type: 'string',\n description: 'The entity type to which the rule is applied.',\n enum: [ 'pay_statement_item'\n ]\n },\n priority: {\n type: 'integer',\n description: 'The priority of the rule.'\n },\n updated_at: {\n type: 'string',\n description: 'The datetime when the rule was last updated.',\n format: 'date-time'\n }\n }\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { + entity_ids: { + type: 'array', + description: 'The entity IDs to create the rule for.', + items: { + type: 'string', + }, + }, attributes: { type: 'object', description: 'Specifies the fields to be applied when the condition is met.', diff --git a/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.ts b/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.ts index e73d6584d..1211f96a1 100644 --- a/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.ts +++ b/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.ts @@ -18,13 +18,20 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'delete_pay_statement_item_company_hris_rules', 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**Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon\nDelete a rule for a pay statement item.\n\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the rule.'\n },\n attributes: {\n type: 'object',\n description: 'Specifies the fields to be applied when the condition is met.',\n properties: {\n metadata: {\n type: 'object',\n description: 'The metadata to be attached in the entity. It is a key-value pairs where the values can be of any type (string, number, boolean, object, array, etc.).',\n additionalProperties: true\n }\n }\n },\n conditions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The field to be checked in the rule.'\n },\n operator: {\n type: 'string',\n description: 'The operator to be used in the rule.',\n enum: [ 'equals'\n ]\n },\n value: {\n type: 'string',\n description: 'The value of the field to be checked in the rule.'\n }\n }\n }\n },\n created_at: {\n type: 'string',\n description: 'The datetime when the rule was created.',\n format: 'date-time'\n },\n deleted_at: {\n type: 'string',\n description: 'The datetime when the rule was deleted.',\n format: 'date-time'\n },\n effective_end_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rules should stop applying rules based on the date.'\n },\n effective_start_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rule should begin applying based on the date.'\n },\n entity_type: {\n type: 'string',\n description: 'The entity type to which the rule is applied.',\n enum: [ 'pay_statement_item'\n ]\n },\n priority: {\n type: 'integer',\n description: 'The priority of the rule.'\n },\n updated_at: {\n type: 'string',\n description: 'The datetime when the rule was last updated.',\n format: 'date-time'\n }\n }\n}\n```", + "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**Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon\nDelete a rule for a pay statement item.\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/rule_delete_response',\n $defs: {\n rule_delete_response: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the rule.'\n },\n attributes: {\n type: 'object',\n description: 'Specifies the fields to be applied when the condition is met.',\n properties: {\n metadata: {\n type: 'object',\n description: 'The metadata to be attached in the entity. It is a key-value pairs where the values can be of any type (string, number, boolean, object, array, etc.).',\n additionalProperties: true\n }\n }\n },\n conditions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The field to be checked in the rule.'\n },\n operator: {\n type: 'string',\n description: 'The operator to be used in the rule.',\n enum: [ 'equals'\n ]\n },\n value: {\n type: 'string',\n description: 'The value of the field to be checked in the rule.'\n }\n }\n }\n },\n created_at: {\n type: 'string',\n description: 'The datetime when the rule was created.',\n format: 'date-time'\n },\n deleted_at: {\n type: 'string',\n description: 'The datetime when the rule was deleted.',\n format: 'date-time'\n },\n effective_end_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rules should stop applying rules based on the date.'\n },\n effective_start_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rule should begin applying based on the date.'\n },\n entity_type: {\n type: 'string',\n description: 'The entity type to which the rule is applied.',\n enum: [ 'pay_statement_item'\n ]\n },\n priority: {\n type: 'integer',\n description: 'The priority of the rule.'\n },\n updated_at: {\n type: 'string',\n description: 'The datetime when the rule was last updated.',\n format: 'date-time'\n }\n }\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { rule_id: { type: 'string', }, + entity_ids: { + type: 'array', + description: 'The entity IDs to delete the rule for.', + items: { + type: 'string', + }, + }, jq_filter: { type: 'string', title: 'jq Filter', @@ -42,7 +49,7 @@ export const tool: Tool = { export const handler = async (client: Finch, args: Record | undefined) => { const { rule_id, jq_filter, ...body } = args as any; return asTextContentResult( - await maybeFilter(jq_filter, await client.hris.company.payStatementItem.rules.delete(rule_id)), + await maybeFilter(jq_filter, await client.hris.company.payStatementItem.rules.delete(rule_id, body)), ); }; diff --git a/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.ts b/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.ts index d6a05ed94..24e345b5f 100644 --- a/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.ts +++ b/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.ts @@ -18,10 +18,17 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_pay_statement_item_company_hris_rules', 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**Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon\nList all rules of a connection account.\n\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n responses: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the rule.'\n },\n attributes: {\n type: 'object',\n description: 'Specifies the fields to be applied when the condition is met.',\n properties: {\n metadata: {\n type: 'object',\n description: 'The metadata to be attached in the entity. It is a key-value pairs where the values can be of any type (string, number, boolean, object, array, etc.).',\n additionalProperties: true\n }\n }\n },\n conditions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The field to be checked in the rule.'\n },\n operator: {\n type: 'string',\n description: 'The operator to be used in the rule.',\n enum: [ 'equals'\n ]\n },\n value: {\n type: 'string',\n description: 'The value of the field to be checked in the rule.'\n }\n }\n }\n },\n created_at: {\n type: 'string',\n description: 'The datetime when the rule was created.',\n format: 'date-time'\n },\n effective_end_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rules should stop applying rules based on the date.'\n },\n effective_start_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rule should begin applying based on the date.'\n },\n entity_type: {\n type: 'string',\n description: 'The entity type to which the rule is applied.',\n enum: [ 'pay_statement_item'\n ]\n },\n priority: {\n type: 'integer',\n description: 'The priority of the rule.'\n },\n updated_at: {\n type: 'string',\n description: 'The datetime when the rule was last updated.',\n format: 'date-time'\n }\n }\n }\n }\n },\n required: [ 'responses'\n ]\n}\n```", + "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**Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon\nList all rules of a connection account.\n\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n responses: {\n type: 'array',\n items: {\n $ref: '#/$defs/rule_list_response'\n }\n }\n },\n required: [ 'responses'\n ],\n $defs: {\n rule_list_response: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the rule.'\n },\n attributes: {\n type: 'object',\n description: 'Specifies the fields to be applied when the condition is met.',\n properties: {\n metadata: {\n type: 'object',\n description: 'The metadata to be attached in the entity. It is a key-value pairs where the values can be of any type (string, number, boolean, object, array, etc.).',\n additionalProperties: true\n }\n }\n },\n conditions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The field to be checked in the rule.'\n },\n operator: {\n type: 'string',\n description: 'The operator to be used in the rule.',\n enum: [ 'equals'\n ]\n },\n value: {\n type: 'string',\n description: 'The value of the field to be checked in the rule.'\n }\n }\n }\n },\n created_at: {\n type: 'string',\n description: 'The datetime when the rule was created.',\n format: 'date-time'\n },\n effective_end_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rules should stop applying rules based on the date.'\n },\n effective_start_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rule should begin applying based on the date.'\n },\n entity_type: {\n type: 'string',\n description: 'The entity type to which the rule is applied.',\n enum: [ 'pay_statement_item'\n ]\n },\n priority: {\n type: 'integer',\n description: 'The priority of the rule.'\n },\n updated_at: {\n type: 'string',\n description: 'The datetime when the rule was last updated.',\n format: 'date-time'\n }\n }\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { + entity_ids: { + type: 'array', + description: 'The entity IDs to retrieve rules for.', + items: { + type: 'string', + }, + }, jq_filter: { type: 'string', title: 'jq Filter', @@ -37,8 +44,8 @@ export const tool: Tool = { }; export const handler = async (client: Finch, args: Record | undefined) => { - const { jq_filter } = args as any; - const response = await client.hris.company.payStatementItem.rules.list().asResponse(); + const { jq_filter, ...body } = args as any; + const response = await client.hris.company.payStatementItem.rules.list(body).asResponse(); return asTextContentResult(await maybeFilter(jq_filter, await response.json())); }; diff --git a/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/update-pay-statement-item-company-hris-rules.ts b/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/update-pay-statement-item-company-hris-rules.ts index f4fd4ff87..80f2e66d4 100644 --- a/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/update-pay-statement-item-company-hris-rules.ts +++ b/packages/mcp-server/src/tools/hris/company/pay-statement-item/rules/update-pay-statement-item-company-hris-rules.ts @@ -18,13 +18,20 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_pay_statement_item_company_hris_rules', 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**Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon\nUpdate a rule for a pay statement item.\n\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the rule.'\n },\n attributes: {\n type: 'object',\n description: 'Specifies the fields to be applied when the condition is met.',\n properties: {\n metadata: {\n type: 'object',\n description: 'The metadata to be attached in the entity. It is a key-value pairs where the values can be of any type (string, number, boolean, object, array, etc.).',\n additionalProperties: true\n }\n }\n },\n conditions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The field to be checked in the rule.'\n },\n operator: {\n type: 'string',\n description: 'The operator to be used in the rule.',\n enum: [ 'equals'\n ]\n },\n value: {\n type: 'string',\n description: 'The value of the field to be checked in the rule.'\n }\n }\n }\n },\n created_at: {\n type: 'string',\n description: 'The datetime when the rule was created.',\n format: 'date-time'\n },\n effective_end_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rules should stop applying rules based on the date.'\n },\n effective_start_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rule should begin applying based on the date.'\n },\n entity_type: {\n type: 'string',\n description: 'The entity type to which the rule is applied.',\n enum: [ 'pay_statement_item'\n ]\n },\n priority: {\n type: 'integer',\n description: 'The priority of the rule.'\n },\n updated_at: {\n type: 'string',\n description: 'The datetime when the rule was last updated.',\n format: 'date-time'\n }\n }\n}\n```", + "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**Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon\nUpdate a rule for a pay statement item.\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/rule_update_response',\n $defs: {\n rule_update_response: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the rule.'\n },\n attributes: {\n type: 'object',\n description: 'Specifies the fields to be applied when the condition is met.',\n properties: {\n metadata: {\n type: 'object',\n description: 'The metadata to be attached in the entity. It is a key-value pairs where the values can be of any type (string, number, boolean, object, array, etc.).',\n additionalProperties: true\n }\n }\n },\n conditions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The field to be checked in the rule.'\n },\n operator: {\n type: 'string',\n description: 'The operator to be used in the rule.',\n enum: [ 'equals'\n ]\n },\n value: {\n type: 'string',\n description: 'The value of the field to be checked in the rule.'\n }\n }\n }\n },\n created_at: {\n type: 'string',\n description: 'The datetime when the rule was created.',\n format: 'date-time'\n },\n effective_end_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rules should stop applying rules based on the date.'\n },\n effective_start_date: {\n type: 'string',\n title: 'Date',\n description: 'Specifies when the rule should begin applying based on the date.'\n },\n entity_type: {\n type: 'string',\n description: 'The entity type to which the rule is applied.',\n enum: [ 'pay_statement_item'\n ]\n },\n priority: {\n type: 'integer',\n description: 'The priority of the rule.'\n },\n updated_at: {\n type: 'string',\n description: 'The datetime when the rule was last updated.',\n format: 'date-time'\n }\n }\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { rule_id: { type: 'string', }, + entity_ids: { + type: 'array', + description: 'The entity IDs to update the rule for.', + items: { + type: 'string', + }, + }, optionalProperty: { type: 'object', additionalProperties: true, diff --git a/packages/mcp-server/src/tools/hris/company/retrieve-hris-company.ts b/packages/mcp-server/src/tools/hris/company/retrieve-hris-company.ts index 568a52c3b..234a6fc8a 100644 --- a/packages/mcp-server/src/tools/hris/company/retrieve-hris-company.ts +++ b/packages/mcp-server/src/tools/hris/company/retrieve-hris-company.ts @@ -22,6 +22,13 @@ export const tool: Tool = { inputSchema: { type: 'object', properties: { + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, jq_filter: { type: 'string', title: 'jq Filter', @@ -37,8 +44,8 @@ export const tool: Tool = { }; export const handler = async (client: Finch, args: Record | undefined) => { - const { jq_filter } = args as any; - return asTextContentResult(await maybeFilter(jq_filter, await client.hris.company.retrieve())); + const { jq_filter, ...body } = args as any; + return asTextContentResult(await maybeFilter(jq_filter, await client.hris.company.retrieve(body))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/hris/directory/list-hris-directory.ts b/packages/mcp-server/src/tools/hris/directory/list-hris-directory.ts index ccbe79736..0c6ca02b3 100644 --- a/packages/mcp-server/src/tools/hris/directory/list-hris-directory.ts +++ b/packages/mcp-server/src/tools/hris/directory/list-hris-directory.ts @@ -22,6 +22,13 @@ export const tool: Tool = { inputSchema: { type: 'object', properties: { + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, limit: { type: 'integer', description: 'Number of employees to return (defaults to all)', diff --git a/packages/mcp-server/src/tools/hris/directory/list-individuals-hris-directory.ts b/packages/mcp-server/src/tools/hris/directory/list-individuals-hris-directory.ts deleted file mode 100644 index 56e8cc37d..000000000 --- a/packages/mcp-server/src/tools/hris/directory/list-individuals-hris-directory.ts +++ /dev/null @@ -1,53 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { maybeFilter } from '@tryfinch/finch-api-mcp/filtering'; -import { Metadata, asTextContentResult } from '@tryfinch/finch-api-mcp/tools/types'; - -import { Tool } from '@modelcontextprotocol/sdk/types.js'; -import Finch from '@tryfinch/finch-api'; - -export const metadata: Metadata = { - resource: 'hris.directory', - operation: 'read', - tags: [], - httpMethod: 'get', - httpPath: '/employer/directory', - operationId: 'get-directory', -}; - -export const tool: Tool = { - name: 'list_individuals_hris_directory', - 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\nRead company directory and organization structure\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n individuals: {\n type: 'array',\n description: 'The array of employees.',\n items: {\n $ref: '#/$defs/individual_in_directory'\n }\n },\n paging: {\n $ref: '#/$defs/paging'\n }\n },\n required: [ 'individuals',\n 'paging'\n ],\n $defs: {\n individual_in_directory: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'A stable Finch `id` (UUID v4) for an individual in the company.'\n },\n department: {\n type: 'object',\n description: 'The department object.',\n properties: {\n name: {\n type: 'string',\n description: 'The name of the department.'\n }\n }\n },\n first_name: {\n type: 'string',\n description: 'The legal first name of the individual.'\n },\n is_active: {\n type: 'boolean',\n description: '`true` if the individual is an active employee or contractor at the company.'\n },\n last_name: {\n type: 'string',\n description: 'The legal last name of the individual.'\n },\n manager: {\n type: 'object',\n description: 'The manager object.',\n properties: {\n id: {\n type: 'string',\n description: 'A stable Finch `id` (UUID v4) for an individual in the company.'\n }\n },\n required: [ 'id'\n ]\n },\n middle_name: {\n type: 'string',\n description: 'The legal middle name of the individual.'\n }\n },\n required: [ 'id',\n 'department',\n 'first_name',\n 'is_active',\n 'last_name',\n 'manager',\n 'middle_name'\n ]\n },\n paging: {\n type: 'object',\n title: 'Paging',\n properties: {\n offset: {\n type: 'integer',\n description: 'The current start index of the returned list of elements'\n },\n count: {\n type: 'integer',\n description: 'The total number of elements for the entire query (not just the given page)'\n }\n },\n required: [ 'offset'\n ]\n }\n }\n}\n```", - inputSchema: { - type: 'object', - properties: { - limit: { - type: 'integer', - description: 'Number of employees to return (defaults to all)', - }, - offset: { - type: 'integer', - description: 'Index to start from (defaults to 0)', - }, - 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: Finch, args: Record | undefined) => { - const { jq_filter, ...body } = args as any; - const response = await client.hris.directory.listIndividuals(body).asResponse(); - return asTextContentResult(await maybeFilter(jq_filter, await response.json())); -}; - -export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/hris/documents/list-hris-documents.ts b/packages/mcp-server/src/tools/hris/documents/list-hris-documents.ts index e2b4bf898..edd287c36 100644 --- a/packages/mcp-server/src/tools/hris/documents/list-hris-documents.ts +++ b/packages/mcp-server/src/tools/hris/documents/list-hris-documents.ts @@ -18,10 +18,17 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_hris_documents', 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**Beta:** This endpoint is in beta and may change.\nRetrieve a list of company-wide documents.\n\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n documents: {\n type: 'array',\n items: {\n $ref: '#/$defs/document_response'\n }\n },\n paging: {\n $ref: '#/$defs/paging'\n }\n },\n required: [ 'documents',\n 'paging'\n ],\n $defs: {\n document_response: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'A stable Finch id for the document.'\n },\n individual_id: {\n type: 'string',\n description: 'The ID of the individual associated with the document. This will be null for employer-level documents.'\n },\n type: {\n type: 'string',\n description: 'The type of document.',\n enum: [ 'w4_2020',\n 'w4_2005'\n ]\n },\n url: {\n type: 'string',\n description: 'A URL to access the document. Format: `https://api.tryfinch.com/employer/documents/:document_id`.'\n },\n year: {\n type: 'number',\n description: 'The year the document applies to, if available.'\n }\n }\n },\n paging: {\n type: 'object',\n title: 'Paging',\n properties: {\n offset: {\n type: 'integer',\n description: 'The current start index of the returned list of elements'\n },\n count: {\n type: 'integer',\n description: 'The total number of elements for the entire query (not just the given page)'\n }\n },\n required: [ 'offset'\n ]\n }\n }\n}\n```", + "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**Beta:** This endpoint is in beta and may change.\nRetrieve a list of company-wide documents.\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/document_list_response',\n $defs: {\n document_list_response: {\n type: 'object',\n properties: {\n documents: {\n type: 'array',\n items: {\n $ref: '#/$defs/document_response'\n }\n },\n paging: {\n $ref: '#/$defs/paging'\n }\n },\n required: [ 'documents',\n 'paging'\n ]\n },\n document_response: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'A stable Finch id for the document.'\n },\n individual_id: {\n type: 'string',\n description: 'The ID of the individual associated with the document. This will be null for employer-level documents.'\n },\n type: {\n type: 'string',\n description: 'The type of document.',\n enum: [ 'w4_2020',\n 'w4_2005'\n ]\n },\n url: {\n type: 'string',\n description: 'A URL to access the document. Format: `https://api.tryfinch.com/employer/documents/:document_id`.'\n },\n year: {\n type: 'number',\n description: 'The year the document applies to, if available.'\n }\n },\n required: [ 'id',\n 'individual_id',\n 'type',\n 'url',\n 'year'\n ]\n },\n paging: {\n type: 'object',\n title: 'Paging',\n properties: {\n offset: {\n type: 'integer',\n description: 'The current start index of the returned list of elements'\n },\n count: {\n type: 'integer',\n description: 'The total number of elements for the entire query (not just the given page)'\n }\n },\n required: [ 'offset'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, individual_ids: { type: 'array', description: diff --git a/packages/mcp-server/src/tools/hris/documents/retreive-hris-documents.ts b/packages/mcp-server/src/tools/hris/documents/retreive-hris-documents.ts index ddb7e766c..bfb0d1072 100644 --- a/packages/mcp-server/src/tools/hris/documents/retreive-hris-documents.ts +++ b/packages/mcp-server/src/tools/hris/documents/retreive-hris-documents.ts @@ -18,13 +18,20 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retreive_hris_documents', 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**Beta:** This endpoint is in beta and may change.\nRetrieve details of a specific document by its ID.\n\n\n# Response Schema\n```json\n{\n anyOf: [ {\n $ref: '#/$defs/w42020'\n },\n {\n $ref: '#/$defs/w42005'\n }\n ],\n description: 'A 2020 version of the W-4 tax form containing information on an individual\\'s filing status, dependents, and withholding details.',\n $defs: {\n w42020: {\n type: 'object',\n description: 'A 2020 version of the W-4 tax form containing information on an individual\\'s filing status, dependents, and withholding details.',\n properties: {\n data: {\n type: 'object',\n description: 'Detailed information specific to the 2020 W4 form.',\n properties: {\n amount_for_other_dependents: {\n type: 'integer',\n description: 'Amount claimed for dependents other than qualifying children under 17 (in cents).'\n },\n amount_for_qualifying_children_under_17: {\n type: 'integer',\n description: 'Amount claimed for dependents under 17 years old (in cents).'\n },\n deductions: {\n type: 'integer',\n description: 'Deductible expenses (in cents).'\n },\n extra_withholding: {\n type: 'integer',\n description: 'Additional withholding amount (in cents).'\n },\n filing_status: {\n type: 'string',\n description: 'The individual\\'s filing status for tax purposes.',\n enum: [ 'head_of_household',\n 'married_filing_jointly_or_qualifying_surviving_spouse',\n 'single_or_married_filing_separately'\n ]\n },\n individual_id: {\n type: 'string',\n description: 'The unique identifier for the individual associated with this document.'\n },\n other_income: {\n type: 'integer',\n description: 'Additional income from sources outside of primary employment (in cents).'\n },\n total_claim_dependent_and_other_credits: {\n type: 'integer',\n description: 'Total amount claimed for dependents and other credits (in cents).'\n }\n }\n },\n type: {\n type: 'string',\n description: 'Specifies the form type, indicating that this document is a 2020 W4 form.',\n enum: [ 'w4_2020'\n ]\n },\n year: {\n type: 'number',\n description: 'The tax year this W4 document applies to.'\n }\n }\n },\n w42005: {\n type: 'object',\n description: 'A 2005 version of the W-4 tax form containing information on an individual\\'s filing status, dependents, and withholding details.',\n properties: {\n data: {\n type: 'object',\n description: 'Detailed information specific to the 2005 W4 form.',\n properties: {\n additional_withholding: {\n type: 'integer',\n description: 'Additional withholding amount (in cents).'\n },\n exemption: {\n type: 'string',\n description: 'Indicates exemption status from federal tax withholding.',\n enum: [ 'exempt',\n 'non_exempt'\n ]\n },\n filing_status: {\n type: 'string',\n description: 'The individual\\'s filing status for tax purposes.',\n enum: [ 'married',\n 'married_but_withhold_at_higher_single_rate',\n 'single'\n ]\n },\n individual_id: {\n type: 'string',\n description: 'The unique identifier for the individual associated with this 2005 W4 form.'\n },\n total_number_of_allowances: {\n type: 'integer',\n description: 'Total number of allowances claimed (in cents).'\n }\n }\n },\n type: {\n type: 'string',\n description: 'Specifies the form type, indicating that this document is a 2005 W4 form.',\n enum: [ 'w4_2005'\n ]\n },\n year: {\n type: 'number',\n description: 'The tax year this W4 document applies to.'\n }\n }\n }\n }\n}\n```", + "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**Beta:** This endpoint is in beta and may change.\nRetrieve details of a specific document by its ID.\n\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/document_retreive_response',\n $defs: {\n document_retreive_response: {\n anyOf: [ {\n $ref: '#/$defs/w42020'\n },\n {\n $ref: '#/$defs/w42005'\n }\n ],\n description: 'A 2020 version of the W-4 tax form containing information on an individual\\'s filing status, dependents, and withholding details.'\n },\n w42020: {\n type: 'object',\n description: 'A 2020 version of the W-4 tax form containing information on an individual\\'s filing status, dependents, and withholding details.',\n properties: {\n data: {\n type: 'object',\n description: 'Detailed information specific to the 2020 W4 form.',\n properties: {\n amount_for_other_dependents: {\n type: 'integer',\n description: 'Amount claimed for dependents other than qualifying children under 17 (in cents).'\n },\n amount_for_qualifying_children_under_17: {\n type: 'integer',\n description: 'Amount claimed for dependents under 17 years old (in cents).'\n },\n deductions: {\n type: 'integer',\n description: 'Deductible expenses (in cents).'\n },\n extra_withholding: {\n type: 'integer',\n description: 'Additional withholding amount (in cents).'\n },\n filing_status: {\n type: 'string',\n description: 'The individual\\'s filing status for tax purposes.',\n enum: [ 'head_of_household',\n 'married_filing_jointly_or_qualifying_surviving_spouse',\n 'single_or_married_filing_separately'\n ]\n },\n individual_id: {\n type: 'string',\n description: 'The unique identifier for the individual associated with this document.'\n },\n other_income: {\n type: 'integer',\n description: 'Additional income from sources outside of primary employment (in cents).'\n },\n total_claim_dependent_and_other_credits: {\n type: 'integer',\n description: 'Total amount claimed for dependents and other credits (in cents).'\n }\n },\n required: [ 'amount_for_other_dependents',\n 'amount_for_qualifying_children_under_17',\n 'deductions',\n 'extra_withholding',\n 'filing_status',\n 'individual_id',\n 'other_income',\n 'total_claim_dependent_and_other_credits'\n ]\n },\n type: {\n type: 'string',\n description: 'Specifies the form type, indicating that this document is a 2020 W4 form.',\n enum: [ 'w4_2020'\n ]\n },\n year: {\n type: 'number',\n description: 'The tax year this W4 document applies to.'\n }\n },\n required: [ 'data',\n 'type',\n 'year'\n ]\n },\n w42005: {\n type: 'object',\n description: 'A 2005 version of the W-4 tax form containing information on an individual\\'s filing status, dependents, and withholding details.',\n properties: {\n data: {\n type: 'object',\n description: 'Detailed information specific to the 2005 W4 form.',\n properties: {\n additional_withholding: {\n type: 'integer',\n description: 'Additional withholding amount (in cents).'\n },\n exemption: {\n type: 'string',\n description: 'Indicates exemption status from federal tax withholding.',\n enum: [ 'exempt',\n 'non_exempt'\n ]\n },\n filing_status: {\n type: 'string',\n description: 'The individual\\'s filing status for tax purposes.',\n enum: [ 'married',\n 'married_but_withhold_at_higher_single_rate',\n 'single'\n ]\n },\n individual_id: {\n type: 'string',\n description: 'The unique identifier for the individual associated with this 2005 W4 form.'\n },\n total_number_of_allowances: {\n type: 'integer',\n description: 'Total number of allowances claimed (in cents).'\n }\n },\n required: [ 'additional_withholding',\n 'exemption',\n 'filing_status',\n 'individual_id',\n 'total_number_of_allowances'\n ]\n },\n type: {\n type: 'string',\n description: 'Specifies the form type, indicating that this document is a 2005 W4 form.',\n enum: [ 'w4_2005'\n ]\n },\n year: {\n type: 'number',\n description: 'The tax year this W4 document applies to.'\n }\n },\n required: [ 'data',\n 'type',\n 'year'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { document_id: { type: 'string', }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, jq_filter: { type: 'string', title: 'jq Filter', @@ -41,7 +48,9 @@ export const tool: Tool = { export const handler = async (client: Finch, args: Record | undefined) => { const { document_id, jq_filter, ...body } = args as any; - return asTextContentResult(await maybeFilter(jq_filter, await client.hris.documents.retreive(document_id))); + return asTextContentResult( + await maybeFilter(jq_filter, await client.hris.documents.retreive(document_id, body)), + ); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/hris/employments/retrieve-many-hris-employments.ts b/packages/mcp-server/src/tools/hris/employments/retrieve-many-hris-employments.ts index 3b6d7bd60..e562d8f7c 100644 --- a/packages/mcp-server/src/tools/hris/employments/retrieve-many-hris-employments.ts +++ b/packages/mcp-server/src/tools/hris/employments/retrieve-many-hris-employments.ts @@ -35,6 +35,13 @@ export const tool: Tool = { required: ['individual_id'], }, }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, }, required: ['requests'], }, diff --git a/packages/mcp-server/src/tools/hris/individuals/retrieve-many-hris-individuals.ts b/packages/mcp-server/src/tools/hris/individuals/retrieve-many-hris-individuals.ts index b57109a39..c42ab6e0e 100644 --- a/packages/mcp-server/src/tools/hris/individuals/retrieve-many-hris-individuals.ts +++ b/packages/mcp-server/src/tools/hris/individuals/retrieve-many-hris-individuals.ts @@ -22,6 +22,13 @@ export const tool: Tool = { inputSchema: { type: 'object', properties: { + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, options: { type: 'object', properties: { diff --git a/packages/mcp-server/src/tools/hris/pay-statements/retrieve-many-hris-pay-statements.ts b/packages/mcp-server/src/tools/hris/pay-statements/retrieve-many-hris-pay-statements.ts index fb2723a81..d638c697a 100644 --- a/packages/mcp-server/src/tools/hris/pay-statements/retrieve-many-hris-pay-statements.ts +++ b/packages/mcp-server/src/tools/hris/pay-statements/retrieve-many-hris-pay-statements.ts @@ -43,6 +43,13 @@ export const tool: Tool = { required: ['payment_id'], }, }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, }, required: ['requests'], }, diff --git a/packages/mcp-server/src/tools/hris/payments/list-hris-payments.ts b/packages/mcp-server/src/tools/hris/payments/list-hris-payments.ts index 1844ee357..4f4163fce 100644 --- a/packages/mcp-server/src/tools/hris/payments/list-hris-payments.ts +++ b/packages/mcp-server/src/tools/hris/payments/list-hris-payments.ts @@ -32,6 +32,13 @@ export const tool: Tool = { description: 'The start date to retrieve payments by a company (inclusive) in `YYYY-MM-DD` format.', format: 'date', }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, jq_filter: { type: 'string', title: 'jq Filter', diff --git a/packages/mcp-server/src/tools/index.ts b/packages/mcp-server/src/tools/index.ts index 80324ba0b..438763953 100644 --- a/packages/mcp-server/src/tools/index.ts +++ b/packages/mcp-server/src/tools/index.ts @@ -12,7 +12,6 @@ import update_pay_statement_item_company_hris_rules from './hris/company/pay-sta import list_pay_statement_item_company_hris_rules from './hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules'; import delete_pay_statement_item_company_hris_rules from './hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules'; import list_hris_directory from './hris/directory/list-hris-directory'; -import list_individuals_hris_directory from './hris/directory/list-individuals-hris-directory'; import retrieve_many_hris_individuals from './hris/individuals/retrieve-many-hris-individuals'; import retrieve_many_hris_employments from './hris/employments/retrieve-many-hris-employments'; import list_hris_payments from './hris/payments/list-hris-payments'; @@ -66,7 +65,6 @@ addEndpoint(update_pay_statement_item_company_hris_rules); addEndpoint(list_pay_statement_item_company_hris_rules); addEndpoint(delete_pay_statement_item_company_hris_rules); addEndpoint(list_hris_directory); -addEndpoint(list_individuals_hris_directory); addEndpoint(retrieve_many_hris_individuals); addEndpoint(retrieve_many_hris_employments); addEndpoint(list_hris_payments); diff --git a/packages/mcp-server/src/tools/jobs/automated/create-jobs-automated.ts b/packages/mcp-server/src/tools/jobs/automated/create-jobs-automated.ts index 8c03a23cd..efd870cbc 100644 --- a/packages/mcp-server/src/tools/jobs/automated/create-jobs-automated.ts +++ b/packages/mcp-server/src/tools/jobs/automated/create-jobs-automated.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_jobs_automated', 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\nEnqueue an automated job.\n\n`data_sync_all`: Enqueue a job to re-sync all data for a connection. `data_sync_all` has a concurrency limit of 1 job at a time per connection. This means that if this endpoint is called while a job is already in progress for this connection, Finch will return the `job_id` of the job that is currently in progress. Finch allows a fixed window rate limit of 1 forced refresh per hour per connection.\n\n`w4_form_employee_sync`: Enqueues a job for sync W-4 data for a particular individual, identified by `individual_id`. This feature is currently in beta.\n\nThis endpoint is available for *Scale* tier customers as an add-on. To request access to this endpoint, please contact your Finch account manager.\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n allowed_refreshes: {\n type: 'integer',\n description: 'The number of allowed refreshes per hour (per hour, fixed window)'\n },\n remaining_refreshes: {\n type: 'integer',\n description: 'The number of remaining refreshes available (per hour, fixed window)'\n },\n job_id: {\n type: 'string',\n description: 'The id of the job that has been created.'\n },\n job_url: {\n type: 'string',\n description: 'The url that can be used to retrieve the job status'\n },\n retry_at: {\n type: 'string',\n description: 'ISO 8601 timestamp indicating when to retry the request'\n }\n },\n required: [ 'allowed_refreshes',\n 'remaining_refreshes'\n ]\n}\n```", + "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\nEnqueue an automated job.\n\n`data_sync_all`: Enqueue a job to re-sync all data for a connection. `data_sync_all` has a concurrency limit of 1 job at a time per connection. This means that if this endpoint is called while a job is already in progress for this connection, Finch will return the `job_id` of the job that is currently in progress. Finch allows a fixed window rate limit of 1 forced refresh per hour per connection.\n\n`w4_form_employee_sync`: Enqueues a job for sync W-4 data for a particular individual, identified by `individual_id`. This feature is currently in beta.\n\nThis endpoint is available for *Scale* tier customers as an add-on. To request access to this endpoint, please contact your Finch account manager.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/automated_create_response',\n $defs: {\n automated_create_response: {\n type: 'object',\n properties: {\n allowed_refreshes: {\n type: 'integer',\n description: 'The number of allowed refreshes per hour (per hour, fixed window)'\n },\n remaining_refreshes: {\n type: 'integer',\n description: 'The number of remaining refreshes available (per hour, fixed window)'\n },\n job_id: {\n type: 'string',\n description: 'The id of the job that has been created.'\n },\n job_url: {\n type: 'string',\n description: 'The url that can be used to retrieve the job status'\n },\n retry_at: {\n type: 'string',\n description: 'ISO 8601 timestamp indicating when to retry the request'\n }\n },\n required: [ 'allowed_refreshes',\n 'remaining_refreshes'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', anyOf: [ diff --git a/packages/mcp-server/src/tools/jobs/automated/list-jobs-automated.ts b/packages/mcp-server/src/tools/jobs/automated/list-jobs-automated.ts index 7e9fbc59e..dde710268 100644 --- a/packages/mcp-server/src/tools/jobs/automated/list-jobs-automated.ts +++ b/packages/mcp-server/src/tools/jobs/automated/list-jobs-automated.ts @@ -18,15 +18,10 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_jobs_automated', 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\nGet all automated jobs. Automated jobs are completed by a machine. By default, jobs are sorted in descending order by submission time. For scheduled jobs such as data syncs, only the next scheduled job is shown.\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n data: {\n type: 'array',\n items: {\n $ref: '#/$defs/automated_async_job'\n }\n },\n meta: {\n type: 'object',\n properties: {\n quotas: {\n type: 'object',\n description: 'Information about remaining quotas for this connection. Only applicable for customers opted in to use Finch\\'s Data Sync Refresh endpoint (`POST /jobs/automated`). Please contact a Finch representative for more details.',\n properties: {\n data_sync_all: {\n type: 'object',\n properties: {\n allowed_refreshes: {\n type: 'integer'\n },\n remaining_refreshes: {\n type: 'integer'\n }\n }\n }\n }\n }\n }\n }\n },\n required: [ 'data',\n 'meta'\n ],\n $defs: {\n automated_async_job: {\n type: 'object',\n title: 'AutomatedAsyncJob',\n properties: {\n completed_at: {\n type: 'string',\n description: 'The datetime the job completed.',\n format: 'date-time'\n },\n created_at: {\n type: 'string',\n description: 'The datetime when the job was created. for scheduled jobs, this will be the initial connection time. For ad-hoc jobs, this will be the time the creation request was received.',\n format: 'date-time'\n },\n job_id: {\n type: 'string',\n description: 'The id of the job that has been created.'\n },\n job_url: {\n type: 'string',\n description: 'The url that can be used to retrieve the job status'\n },\n params: {\n type: 'object',\n description: 'The input parameters for the job.',\n properties: {\n individual_id: {\n type: 'string',\n description: 'The ID of the individual that the job was completed for.'\n }\n }\n },\n scheduled_at: {\n type: 'string',\n description: 'The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in the future if the job has not yet been enqueued. For ad-hoc jobs, this field will be null.',\n format: 'date-time'\n },\n started_at: {\n type: 'string',\n description: 'The datetime a job entered into the job queue.',\n format: 'date-time'\n },\n status: {\n type: 'string',\n enum: [ 'pending',\n 'in_progress',\n 'complete',\n 'error',\n 'reauth_error',\n 'permissions_error'\n ]\n },\n type: {\n type: 'string',\n description: 'The type of automated job',\n enum: [ 'data_sync_all',\n 'w4_form_employee_sync'\n ]\n }\n },\n required: [ 'completed_at',\n 'created_at',\n 'job_id',\n 'job_url',\n 'params',\n 'scheduled_at',\n 'started_at',\n 'status',\n 'type'\n ]\n }\n }\n}\n```", + "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\nGet all automated jobs. Automated jobs are completed by a machine. By default, jobs are sorted in descending order by submission time. For scheduled jobs such as data syncs, only the next scheduled job is shown.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/automated_list_response',\n $defs: {\n automated_list_response: {\n type: 'object',\n properties: {\n data: {\n type: 'array',\n items: {\n $ref: '#/$defs/automated_async_job'\n }\n },\n meta: {\n type: 'object',\n properties: {\n quotas: {\n type: 'object',\n description: 'Information about remaining quotas for this connection. Only applicable for customers opted in to use Finch\\'s Data Sync Refresh endpoint (`POST /jobs/automated`). Please contact a Finch representative for more details.',\n properties: {\n data_sync_all: {\n type: 'object',\n properties: {\n allowed_refreshes: {\n type: 'integer'\n },\n remaining_refreshes: {\n type: 'integer'\n }\n }\n }\n }\n }\n }\n }\n },\n required: [ 'data',\n 'meta'\n ]\n },\n automated_async_job: {\n type: 'object',\n title: 'AutomatedAsyncJob',\n properties: {\n completed_at: {\n type: 'string',\n description: 'The datetime the job completed.',\n format: 'date-time'\n },\n created_at: {\n type: 'string',\n description: 'The datetime when the job was created. for scheduled jobs, this will be the initial connection time. For ad-hoc jobs, this will be the time the creation request was received.',\n format: 'date-time'\n },\n job_id: {\n type: 'string',\n description: 'The id of the job that has been created.'\n },\n job_url: {\n type: 'string',\n description: 'The url that can be used to retrieve the job status'\n },\n params: {\n type: 'object',\n description: 'The input parameters for the job.',\n properties: {\n individual_id: {\n type: 'string',\n description: 'The ID of the individual that the job was completed for.'\n }\n }\n },\n scheduled_at: {\n type: 'string',\n description: 'The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in the future if the job has not yet been enqueued. For ad-hoc jobs, this field will be null.',\n format: 'date-time'\n },\n started_at: {\n type: 'string',\n description: 'The datetime a job entered into the job queue.',\n format: 'date-time'\n },\n status: {\n type: 'string',\n enum: [ 'pending',\n 'in_progress',\n 'complete',\n 'error',\n 'reauth_error',\n 'permissions_error'\n ]\n },\n type: {\n type: 'string',\n description: 'The type of automated job',\n enum: [ 'data_sync_all',\n 'w4_form_employee_sync'\n ]\n }\n },\n required: [ 'completed_at',\n 'created_at',\n 'job_id',\n 'job_url',\n 'params',\n 'scheduled_at',\n 'started_at',\n 'status',\n 'type'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { - entity_id: { - type: 'string', - description: - "The entity ID to use when authenticating with a multi-account token. Required when using a multi-account token to specify which entity's data to access. Example: `123e4567-e89b-12d3-a456-426614174000`", - }, limit: { type: 'integer', description: 'Number of items to return', diff --git a/packages/mcp-server/src/tools/jobs/automated/retrieve-jobs-automated.ts b/packages/mcp-server/src/tools/jobs/automated/retrieve-jobs-automated.ts index 08a53cd0f..212feeaed 100644 --- a/packages/mcp-server/src/tools/jobs/automated/retrieve-jobs-automated.ts +++ b/packages/mcp-server/src/tools/jobs/automated/retrieve-jobs-automated.ts @@ -25,11 +25,6 @@ export const tool: Tool = { job_id: { type: 'string', }, - entity_id: { - type: 'string', - description: - "The entity ID to use when authenticating with a multi-account token. Required when using a multi-account token to specify which entity's data to access. Example: `123e4567-e89b-12d3-a456-426614174000`", - }, jq_filter: { type: 'string', title: 'jq Filter', @@ -46,9 +41,7 @@ export const tool: Tool = { export const handler = async (client: Finch, args: Record | undefined) => { const { job_id, jq_filter, ...body } = args as any; - return asTextContentResult( - await maybeFilter(jq_filter, await client.jobs.automated.retrieve(job_id, body)), - ); + return asTextContentResult(await maybeFilter(jq_filter, await client.jobs.automated.retrieve(job_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/jobs/manual/retrieve-jobs-manual.ts b/packages/mcp-server/src/tools/jobs/manual/retrieve-jobs-manual.ts index e6273579a..39670f067 100644 --- a/packages/mcp-server/src/tools/jobs/manual/retrieve-jobs-manual.ts +++ b/packages/mcp-server/src/tools/jobs/manual/retrieve-jobs-manual.ts @@ -25,11 +25,6 @@ export const tool: Tool = { job_id: { type: 'string', }, - entity_id: { - type: 'string', - description: - "The entity ID to use when authenticating with a multi-account token. Required when using a multi-account token to specify which entity's data to access. Example: `123e4567-e89b-12d3-a456-426614174000`", - }, jq_filter: { type: 'string', title: 'jq Filter', @@ -46,7 +41,7 @@ export const tool: Tool = { export const handler = async (client: Finch, args: Record | undefined) => { const { job_id, jq_filter, ...body } = args as any; - return asTextContentResult(await maybeFilter(jq_filter, await client.jobs.manual.retrieve(job_id, body))); + return asTextContentResult(await maybeFilter(jq_filter, await client.jobs.manual.retrieve(job_id))); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/payroll/pay-groups/list-payroll-pay-groups.ts b/packages/mcp-server/src/tools/payroll/pay-groups/list-payroll-pay-groups.ts index de9b9fd0b..e76086bc6 100644 --- a/packages/mcp-server/src/tools/payroll/pay-groups/list-payroll-pay-groups.ts +++ b/packages/mcp-server/src/tools/payroll/pay-groups/list-payroll-pay-groups.ts @@ -18,10 +18,17 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_payroll_pay_groups', 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\nRead company pay groups and frequencies\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the pay group'\n },\n name: {\n type: 'string',\n description: 'Name of the pay group'\n },\n pay_frequencies: {\n type: 'array',\n description: 'List of pay frequencies associated with this pay group',\n items: {\n type: 'string',\n enum: [ 'annually',\n 'bi_weekly',\n 'daily',\n 'monthly',\n 'other',\n 'quarterly',\n 'semi_annually',\n 'semi_monthly',\n 'weekly'\n ]\n }\n }\n },\n required: [ 'id',\n 'name',\n 'pay_frequencies'\n ]\n }\n}\n```", + "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\nRead company pay groups and frequencies\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/pay_group_list_response'\n },\n $defs: {\n pay_group_list_response: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the pay group'\n },\n name: {\n type: 'string',\n description: 'Name of the pay group'\n },\n pay_frequencies: {\n type: 'array',\n description: 'List of pay frequencies associated with this pay group',\n items: {\n type: 'string',\n enum: [ 'annually',\n 'bi_weekly',\n 'daily',\n 'monthly',\n 'other',\n 'quarterly',\n 'semi_annually',\n 'semi_monthly',\n 'weekly'\n ]\n }\n }\n },\n required: [ 'id',\n 'name',\n 'pay_frequencies'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, individual_id: { type: 'string', }, diff --git a/packages/mcp-server/src/tools/payroll/pay-groups/retrieve-payroll-pay-groups.ts b/packages/mcp-server/src/tools/payroll/pay-groups/retrieve-payroll-pay-groups.ts index 9a6079b7f..be62e8bff 100644 --- a/packages/mcp-server/src/tools/payroll/pay-groups/retrieve-payroll-pay-groups.ts +++ b/packages/mcp-server/src/tools/payroll/pay-groups/retrieve-payroll-pay-groups.ts @@ -18,13 +18,20 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_payroll_pay_groups', 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\nRead information from a single pay group\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the pay group'\n },\n individual_ids: {\n type: 'array',\n items: {\n type: 'string',\n description: 'Finch id (uuidv4) for an individual assigned to this pay group'\n }\n },\n name: {\n type: 'string',\n description: 'Name of the pay group'\n },\n pay_frequencies: {\n type: 'array',\n description: 'List of pay frequencies associated with this pay group',\n items: {\n type: 'string',\n enum: [ 'annually',\n 'bi_weekly',\n 'daily',\n 'monthly',\n 'other',\n 'quarterly',\n 'semi_annually',\n 'semi_monthly',\n 'weekly'\n ]\n }\n }\n },\n required: [ 'id',\n 'individual_ids',\n 'name',\n 'pay_frequencies'\n ]\n}\n```", + "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\nRead information from a single pay group\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/pay_group_retrieve_response',\n $defs: {\n pay_group_retrieve_response: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Finch id (uuidv4) for the pay group'\n },\n individual_ids: {\n type: 'array',\n items: {\n type: 'string',\n description: 'Finch id (uuidv4) for an individual assigned to this pay group'\n }\n },\n name: {\n type: 'string',\n description: 'Name of the pay group'\n },\n pay_frequencies: {\n type: 'array',\n description: 'List of pay frequencies associated with this pay group',\n items: {\n type: 'string',\n enum: [ 'annually',\n 'bi_weekly',\n 'daily',\n 'monthly',\n 'other',\n 'quarterly',\n 'semi_annually',\n 'semi_monthly',\n 'weekly'\n ]\n }\n }\n },\n required: [ 'id',\n 'individual_ids',\n 'name',\n 'pay_frequencies'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { pay_group_id: { type: 'string', }, + entity_ids: { + type: 'array', + description: "The entity IDs to specify which entities' data to access.", + items: { + type: 'string', + }, + }, jq_filter: { type: 'string', title: 'jq Filter', @@ -42,7 +49,7 @@ export const tool: Tool = { export const handler = async (client: Finch, args: Record | undefined) => { const { pay_group_id, jq_filter, ...body } = args as any; return asTextContentResult( - await maybeFilter(jq_filter, await client.payroll.payGroups.retrieve(pay_group_id)), + await maybeFilter(jq_filter, await client.payroll.payGroups.retrieve(pay_group_id, body)), ); }; diff --git a/packages/mcp-server/src/tools/providers/list-providers.ts b/packages/mcp-server/src/tools/providers/list-providers.ts index c1c5a8a60..70e47a5df 100644 --- a/packages/mcp-server/src/tools/providers/list-providers.ts +++ b/packages/mcp-server/src/tools/providers/list-providers.ts @@ -1,5 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import { maybeFilter } from '@tryfinch/finch-api-mcp/filtering'; import { Metadata, asTextContentResult } from '@tryfinch/finch-api-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; @@ -16,10 +17,18 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'list_providers', - description: 'Return details on all available payroll and HR systems.', + 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\nReturn details on all available payroll and HR systems.\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/provider_list_response'\n },\n $defs: {\n provider_list_response: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'The id of the payroll provider used in Connect.'\n },\n display_name: {\n type: 'string',\n description: 'The display name of the payroll provider.'\n },\n products: {\n type: 'array',\n description: 'The list of Finch products supported on this payroll provider.',\n items: {\n type: 'string'\n }\n },\n authentication_methods: {\n type: 'array',\n description: 'The authentication methods supported by the provider.',\n items: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n description: 'The type of authentication method',\n enum: [ 'assisted',\n 'credential',\n 'api_token',\n 'api_credential',\n 'oauth',\n 'api'\n ]\n },\n benefits_support: {\n type: 'object',\n description: 'The supported benefit types and their configurations',\n additionalProperties: true\n },\n supported_fields: {\n type: 'object',\n description: 'The supported fields for each Finch product',\n additionalProperties: true\n }\n },\n required: [ 'type'\n ]\n }\n },\n beta: {\n type: 'boolean',\n description: '`true` if the integration is in a beta state, `false` otherwise'\n },\n icon: {\n type: 'string',\n description: 'The url to the official icon of the payroll provider.'\n },\n logo: {\n type: 'string',\n description: 'The url to the official logo of the payroll provider.'\n },\n manual: {\n type: 'boolean',\n description: '[DEPRECATED] Whether the Finch integration with this provider uses the Assisted Connect Flow by default. This field is now deprecated. Please check for a `type` of `assisted` in the `authentication_methods` field instead.'\n },\n mfa_required: {\n type: 'boolean',\n description: 'whether MFA is required for the provider.'\n },\n primary_color: {\n type: 'string',\n description: 'The hex code for the primary color of the payroll provider.'\n }\n },\n required: [ 'id',\n 'display_name',\n 'products'\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: { @@ -28,8 +37,9 @@ export const tool: Tool = { }; export const handler = async (client: Finch, args: Record | undefined) => { + const { jq_filter } = args as any; const response = await client.providers.list().asResponse(); - return asTextContentResult(await response.json()); + return asTextContentResult(await maybeFilter(jq_filter, await response.json())); }; export default { metadata, tool, handler }; diff --git a/packages/mcp-server/src/tools/request-forwarding/forward-request-forwarding.ts b/packages/mcp-server/src/tools/request-forwarding/forward-request-forwarding.ts index 56d2a3901..4407f890f 100644 --- a/packages/mcp-server/src/tools/request-forwarding/forward-request-forwarding.ts +++ b/packages/mcp-server/src/tools/request-forwarding/forward-request-forwarding.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'forward_request_forwarding', 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\nThe Forward API allows you to make direct requests to an employment system. If Finch's unified API\ndoesn't have a data model that cleanly fits your needs, then Forward allows you to push or pull\ndata models directly against an integration's API.\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n data: {\n type: 'string',\n description: 'A string representation of the HTTP response body of the forwarded request\\'s response received from the underlying integration\\'s API. This field may be null in the case where the upstream system\\'s response is empty.'\n },\n headers: {\n type: 'object',\n description: 'The HTTP headers of the forwarded request\\'s response, exactly as received from the underlying integration\\'s API.',\n additionalProperties: true\n },\n request: {\n type: 'object',\n description: 'An object containing details of your original forwarded request, for your ease of reference.',\n properties: {\n data: {\n type: 'string',\n description: 'The body that was specified for the forwarded request. If a value was not specified in the original request, this value will be returned as null ; otherwise, this value will always be returned as a string.'\n },\n headers: {\n type: 'object',\n description: 'The specified HTTP headers that were included in the forwarded request. If no headers were specified, this will be returned as `null`.',\n additionalProperties: true\n },\n method: {\n type: 'string',\n description: 'The HTTP method that was specified for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , `DELETE` , and `PATCH`.'\n },\n params: {\n type: 'object',\n description: 'The query parameters that were included in the forwarded request. If no query parameters were specified, this will be returned as `null`.',\n additionalProperties: true\n },\n route: {\n type: 'string',\n description: 'The URL route path that was specified for the forwarded request.'\n }\n },\n required: [ 'data',\n 'headers',\n 'method',\n 'params',\n 'route'\n ]\n },\n statusCode: {\n type: 'integer',\n description: 'The HTTP status code of the forwarded request\\'s response, exactly received from the underlying integration\\'s API. This value will be returned as an integer.'\n }\n },\n required: [ 'data',\n 'headers',\n 'request',\n 'statusCode'\n ]\n}\n```", + "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\nThe Forward API allows you to make direct requests to an employment system. If Finch's unified API\ndoesn't have a data model that cleanly fits your needs, then Forward allows you to push or pull\ndata models directly against an integration's API.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/request_forwarding_forward_response',\n $defs: {\n request_forwarding_forward_response: {\n type: 'object',\n properties: {\n request: {\n type: 'object',\n description: 'An object containing details of your original forwarded request, for your ease of reference.',\n properties: {\n method: {\n type: 'string',\n description: 'The HTTP method that was specified for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , `DELETE` , and `PATCH`.'\n },\n route: {\n type: 'string',\n description: 'The URL route path that was specified for the forwarded request.'\n },\n data: {\n anyOf: [ {\n type: 'string'\n },\n {\n type: 'object',\n additionalProperties: true\n }\n ],\n description: 'The body that was specified for the forwarded request.'\n },\n headers: {\n type: 'object',\n description: 'The HTTP headers that were specified for the forwarded request.',\n additionalProperties: true\n },\n params: {\n type: 'object',\n description: 'The query parameters that were specified for the forwarded request.',\n additionalProperties: true\n }\n },\n required: [ 'method',\n 'route'\n ]\n },\n statusCode: {\n type: 'integer',\n description: 'The HTTP status code of the forwarded request\\'s response, exactly received from the underlying integration\\'s API. This value will be returned as an integer.'\n },\n data: {\n type: 'string',\n description: 'A string representation of the HTTP response body of the forwarded request\\'s response received from the underlying integration\\'s API. This field may be null in the case where the upstream system\\'s response is empty.'\n },\n headers: {\n type: 'object',\n description: 'The HTTP headers of the forwarded request\\'s response, exactly as received from the underlying integration\\'s API.',\n additionalProperties: true\n }\n },\n required: [ 'request',\n 'statusCode'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { diff --git a/packages/mcp-server/src/tools/sandbox/company/update-sandbox-company.ts b/packages/mcp-server/src/tools/sandbox/company/update-sandbox-company.ts index 746321dba..e46a0642d 100644 --- a/packages/mcp-server/src/tools/sandbox/company/update-sandbox-company.ts +++ b/packages/mcp-server/src/tools/sandbox/company/update-sandbox-company.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_sandbox_company', 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 sandbox company's data\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n accounts: {\n type: 'array',\n description: 'An array of bank account objects associated with the payroll/HRIS system.',\n items: {\n type: 'object',\n properties: {\n account_name: {\n type: 'string',\n description: 'The name of the bank associated in the payroll/HRIS system.'\n },\n account_number: {\n type: 'string',\n description: '10-12 digit number to specify the bank account'\n },\n account_type: {\n type: 'string',\n description: 'The type of bank account.',\n enum: [ 'checking',\n 'savings'\n ]\n },\n institution_name: {\n type: 'string',\n description: 'Name of the banking institution.'\n },\n routing_number: {\n type: 'string',\n description: 'A nine-digit code that\\'s based on the U.S. Bank location where your account was opened.'\n }\n }\n }\n },\n departments: {\n type: 'array',\n description: 'The array of company departments.',\n items: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description: 'The department name.'\n },\n parent: {\n type: 'object',\n description: 'The parent department, if present.',\n properties: {\n name: {\n type: 'string',\n description: 'The parent department\\'s name.'\n }\n }\n }\n }\n }\n },\n ein: {\n type: 'string',\n description: 'The employer identification number.'\n },\n entity: {\n type: 'object',\n description: 'The entity type object.',\n properties: {\n subtype: {\n type: 'string',\n description: 'The tax payer subtype of the company.',\n enum: [ 's_corporation',\n 'c_corporation',\n 'b_corporation'\n ]\n },\n type: {\n type: 'string',\n description: 'The tax payer type of the company.',\n enum: [ 'llc',\n 'lp',\n 'corporation',\n 'sole_proprietor',\n 'non_profit',\n 'partnership',\n 'cooperative'\n ]\n }\n }\n },\n legal_name: {\n type: 'string',\n description: 'The legal name of the company.'\n },\n locations: {\n type: 'array',\n items: {\n $ref: '#/$defs/location'\n }\n },\n primary_email: {\n type: 'string',\n description: 'The email of the main administrator on the account.'\n },\n primary_phone_number: {\n type: 'string',\n description: 'The phone number of the main administrator on the account. Format: E.164, with extension where applicable, e.g. `+NNNNNNNNNNN xExtension`'\n }\n },\n required: [ 'accounts',\n 'departments',\n 'ein',\n 'entity',\n 'legal_name',\n 'locations',\n 'primary_email',\n 'primary_phone_number'\n ],\n $defs: {\n location: {\n type: 'object',\n title: 'Location',\n properties: {\n city: {\n type: 'string',\n description: 'City, district, suburb, town, or village.'\n },\n country: {\n type: 'string',\n description: 'The 2-letter ISO 3166 country code.'\n },\n line1: {\n type: 'string',\n description: 'Street address or PO box.'\n },\n line2: {\n type: 'string',\n description: 'Apartment, suite, unit, or building.'\n },\n postal_code: {\n type: 'string',\n description: 'The postal code or zip code.'\n },\n state: {\n type: 'string',\n description: 'The state code.'\n },\n name: {\n type: 'string'\n },\n source_id: {\n type: 'string'\n }\n },\n required: [ 'city',\n 'country',\n 'line1',\n 'line2',\n 'postal_code',\n 'state'\n ]\n }\n }\n}\n```", + "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 sandbox company's data\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/company_update_response',\n $defs: {\n company_update_response: {\n type: 'object',\n properties: {\n accounts: {\n type: 'array',\n description: 'An array of bank account objects associated with the payroll/HRIS system.',\n items: {\n type: 'object',\n properties: {\n account_name: {\n type: 'string',\n description: 'The name of the bank associated in the payroll/HRIS system.'\n },\n account_number: {\n type: 'string',\n description: '10-12 digit number to specify the bank account'\n },\n account_type: {\n type: 'string',\n description: 'The type of bank account.',\n enum: [ 'checking',\n 'savings'\n ]\n },\n institution_name: {\n type: 'string',\n description: 'Name of the banking institution.'\n },\n routing_number: {\n type: 'string',\n description: 'A nine-digit code that\\'s based on the U.S. Bank location where your account was opened.'\n }\n }\n }\n },\n departments: {\n type: 'array',\n description: 'The array of company departments.',\n items: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description: 'The department name.'\n },\n parent: {\n type: 'object',\n description: 'The parent department, if present.',\n properties: {\n name: {\n type: 'string',\n description: 'The parent department\\'s name.'\n }\n }\n }\n }\n }\n },\n ein: {\n type: 'string',\n description: 'The employer identification number.'\n },\n entity: {\n type: 'object',\n description: 'The entity type object.',\n properties: {\n subtype: {\n type: 'string',\n description: 'The tax payer subtype of the company.',\n enum: [ 's_corporation',\n 'c_corporation',\n 'b_corporation'\n ]\n },\n type: {\n type: 'string',\n description: 'The tax payer type of the company.',\n enum: [ 'llc',\n 'lp',\n 'corporation',\n 'sole_proprietor',\n 'non_profit',\n 'partnership',\n 'cooperative'\n ]\n }\n }\n },\n legal_name: {\n type: 'string',\n description: 'The legal name of the company.'\n },\n locations: {\n type: 'array',\n items: {\n $ref: '#/$defs/location'\n }\n },\n primary_email: {\n type: 'string',\n description: 'The email of the main administrator on the account.'\n },\n primary_phone_number: {\n type: 'string',\n description: 'The phone number of the main administrator on the account. Format: E.164, with extension where applicable, e.g. `+NNNNNNNNNNN xExtension`'\n }\n },\n required: [ 'accounts',\n 'departments',\n 'ein',\n 'entity',\n 'legal_name',\n 'locations',\n 'primary_email',\n 'primary_phone_number'\n ]\n },\n location: {\n type: 'object',\n title: 'Location',\n properties: {\n city: {\n type: 'string',\n description: 'City, district, suburb, town, or village.'\n },\n country: {\n type: 'string',\n description: 'The 2-letter ISO 3166 country code.'\n },\n line1: {\n type: 'string',\n description: 'Street address or PO box.'\n },\n line2: {\n type: 'string',\n description: 'Apartment, suite, unit, or building.'\n },\n postal_code: {\n type: 'string',\n description: 'The postal code or zip code.'\n },\n state: {\n type: 'string',\n description: 'The state code.'\n },\n name: {\n type: 'string'\n },\n source_id: {\n type: 'string'\n }\n },\n required: [ 'city',\n 'country',\n 'line1',\n 'line2',\n 'postal_code',\n 'state'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { diff --git a/packages/mcp-server/src/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.ts b/packages/mcp-server/src/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.ts index dd0a68ef7..e330b866e 100644 --- a/packages/mcp-server/src/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.ts +++ b/packages/mcp-server/src/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_connections_sandbox_accounts', 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 account for an existing connection (company/provider pair)\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n access_token: {\n type: 'string'\n },\n account_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n authentication_type: {\n type: 'string',\n title: 'AuthenticationType',\n enum: [ 'credential',\n 'api_token',\n 'oauth',\n 'assisted'\n ]\n },\n company_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n connection_id: {\n type: 'string',\n description: 'The ID of the new connection'\n },\n products: {\n type: 'array',\n items: {\n type: 'string'\n }\n },\n provider_id: {\n type: 'string',\n description: 'The ID of the provider associated with the `access_token`'\n }\n },\n required: [ 'access_token',\n 'account_id',\n 'authentication_type',\n 'company_id',\n 'connection_id',\n 'products',\n 'provider_id'\n ]\n}\n```", + "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 account for an existing connection (company/provider pair)\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/account_create_response',\n $defs: {\n account_create_response: {\n type: 'object',\n properties: {\n access_token: {\n type: 'string'\n },\n account_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n authentication_type: {\n type: 'string',\n title: 'AuthenticationType',\n enum: [ 'credential',\n 'api_token',\n 'oauth',\n 'assisted'\n ]\n },\n company_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n connection_id: {\n type: 'string',\n description: 'The ID of the new connection'\n },\n products: {\n type: 'array',\n items: {\n type: 'string'\n }\n },\n provider_id: {\n type: 'string',\n description: 'The ID of the provider associated with the `access_token`'\n }\n },\n required: [ 'access_token',\n 'account_id',\n 'authentication_type',\n 'company_id',\n 'connection_id',\n 'products',\n 'provider_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { diff --git a/packages/mcp-server/src/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.ts b/packages/mcp-server/src/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.ts index 5c404d615..0db70e8e7 100644 --- a/packages/mcp-server/src/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.ts +++ b/packages/mcp-server/src/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_connections_sandbox_accounts', 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 an existing sandbox account. Change the connection status to understand how the Finch API responds.\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n account_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n authentication_type: {\n type: 'string',\n title: 'AuthenticationType',\n enum: [ 'credential',\n 'api_token',\n 'oauth',\n 'assisted'\n ]\n },\n company_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n products: {\n type: 'array',\n items: {\n type: 'string'\n }\n },\n provider_id: {\n type: 'string',\n description: 'The ID of the provider associated with the `access_token`'\n },\n connection_id: {\n type: 'string',\n description: 'The ID of the new connection'\n }\n },\n required: [ 'account_id',\n 'authentication_type',\n 'company_id',\n 'products',\n 'provider_id'\n ]\n}\n```", + "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 an existing sandbox account. Change the connection status to understand how the Finch API responds.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/account_update_response',\n $defs: {\n account_update_response: {\n type: 'object',\n properties: {\n account_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n authentication_type: {\n type: 'string',\n title: 'AuthenticationType',\n enum: [ 'credential',\n 'api_token',\n 'oauth',\n 'assisted'\n ]\n },\n company_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n products: {\n type: 'array',\n items: {\n type: 'string'\n }\n },\n provider_id: {\n type: 'string',\n description: 'The ID of the provider associated with the `access_token`'\n },\n connection_id: {\n type: 'string',\n description: 'The ID of the new connection'\n }\n },\n required: [ 'account_id',\n 'authentication_type',\n 'company_id',\n 'products',\n 'provider_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { diff --git a/packages/mcp-server/src/tools/sandbox/connections/create-sandbox-connections.ts b/packages/mcp-server/src/tools/sandbox/connections/create-sandbox-connections.ts index 27f4cd8d8..a87e34ff2 100644 --- a/packages/mcp-server/src/tools/sandbox/connections/create-sandbox-connections.ts +++ b/packages/mcp-server/src/tools/sandbox/connections/create-sandbox-connections.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_sandbox_connections', 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 connection (new company/provider pair) with a new account\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n access_token: {\n type: 'string'\n },\n account_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n authentication_type: {\n type: 'string',\n title: 'AuthenticationType',\n enum: [ 'credential',\n 'api_token',\n 'oauth',\n 'assisted'\n ]\n },\n company_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n connection_id: {\n type: 'string',\n description: 'The ID of the new connection'\n },\n products: {\n type: 'array',\n items: {\n type: 'string'\n }\n },\n provider_id: {\n type: 'string',\n description: 'The ID of the provider associated with the `access_token`.'\n },\n token_type: {\n type: 'string'\n }\n },\n required: [ 'access_token',\n 'account_id',\n 'authentication_type',\n 'company_id',\n 'connection_id',\n 'products',\n 'provider_id'\n ]\n}\n```", + "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 connection (new company/provider pair) with a new account\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/connection_create_response',\n $defs: {\n connection_create_response: {\n type: 'object',\n properties: {\n access_token: {\n type: 'string'\n },\n account_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n authentication_type: {\n type: 'string',\n title: 'AuthenticationType',\n enum: [ 'credential',\n 'api_token',\n 'oauth',\n 'assisted'\n ]\n },\n company_id: {\n type: 'string',\n description: '[DEPRECATED] Use `connection_id` to associate a connection with an access token'\n },\n connection_id: {\n type: 'string',\n description: 'The ID of the new connection'\n },\n products: {\n type: 'array',\n items: {\n type: 'string'\n }\n },\n provider_id: {\n type: 'string',\n description: 'The ID of the provider associated with the `access_token`.'\n },\n token_type: {\n type: 'string'\n }\n },\n required: [ 'access_token',\n 'account_id',\n 'authentication_type',\n 'company_id',\n 'connection_id',\n 'products',\n 'provider_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { diff --git a/packages/mcp-server/src/tools/sandbox/directory/create-sandbox-directory.ts b/packages/mcp-server/src/tools/sandbox/directory/create-sandbox-directory.ts index ec52b6172..d0b01c8df 100644 --- a/packages/mcp-server/src/tools/sandbox/directory/create-sandbox-directory.ts +++ b/packages/mcp-server/src/tools/sandbox/directory/create-sandbox-directory.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_sandbox_directory', 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\nAdd new individuals to a sandbox company\n\n# Response Schema\n```json\n{\n type: 'array',\n description: 'The individuals which were created',\n items: {\n type: 'object',\n additionalProperties: true\n }\n}\n```", + "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\nAdd new individuals to a sandbox company\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/directory_create_response',\n $defs: {\n directory_create_response: {\n type: 'array',\n description: 'The individuals which were created',\n items: {\n type: 'object',\n additionalProperties: true\n }\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { diff --git a/packages/mcp-server/src/tools/sandbox/individual/update-sandbox-individual.ts b/packages/mcp-server/src/tools/sandbox/individual/update-sandbox-individual.ts index 6735cc5b0..6e57f5dd0 100644 --- a/packages/mcp-server/src/tools/sandbox/individual/update-sandbox-individual.ts +++ b/packages/mcp-server/src/tools/sandbox/individual/update-sandbox-individual.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'update_sandbox_individual', 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 sandbox individual\n\n# Response Schema\n```json\n{\n type: 'object',\n title: 'Individual',\n properties: {\n id: {\n type: 'string',\n description: 'A stable Finch `id` (UUID v4) for an individual in the company.'\n },\n dob: {\n type: 'string',\n title: 'Date'\n },\n emails: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n data: {\n type: 'string'\n },\n type: {\n type: 'string',\n enum: [ 'work',\n 'personal'\n ]\n }\n }\n }\n },\n encrypted_ssn: {\n type: 'string',\n description: 'Social Security Number of the individual in **encrypted** format. This field is only available with the `ssn` scope enabled and the `options: { include: [\\'ssn\\'] }` param set in the body.'\n },\n ethnicity: {\n type: 'string',\n description: 'The EEOC-defined ethnicity of the individual.',\n enum: [ 'asian',\n 'white',\n 'black_or_african_american',\n 'native_hawaiian_or_pacific_islander',\n 'american_indian_or_alaska_native',\n 'hispanic_or_latino',\n 'two_or_more_races',\n 'decline_to_specify'\n ]\n },\n first_name: {\n type: 'string',\n description: 'The legal first name of the individual.'\n },\n gender: {\n type: 'string',\n description: 'The gender of the individual.',\n enum: [ 'female',\n 'male',\n 'other',\n 'decline_to_specify'\n ]\n },\n last_name: {\n type: 'string',\n description: 'The legal last name of the individual.'\n },\n middle_name: {\n type: 'string',\n description: 'The legal middle name of the individual.'\n },\n phone_numbers: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n data: {\n type: 'string'\n },\n type: {\n type: 'string',\n enum: [ 'work',\n 'personal'\n ]\n }\n }\n }\n },\n preferred_name: {\n type: 'string',\n description: 'The preferred name of the individual.'\n },\n residence: {\n $ref: '#/$defs/location'\n },\n ssn: {\n type: 'string',\n description: 'Social Security Number of the individual. This field is only available with the `ssn` scope enabled and the `options: { include: [\\'ssn\\'] }` param set in the body. [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field).'\n }\n },\n $defs: {\n location: {\n type: 'object',\n title: 'Location',\n properties: {\n city: {\n type: 'string',\n description: 'City, district, suburb, town, or village.'\n },\n country: {\n type: 'string',\n description: 'The 2-letter ISO 3166 country code.'\n },\n line1: {\n type: 'string',\n description: 'Street address or PO box.'\n },\n line2: {\n type: 'string',\n description: 'Apartment, suite, unit, or building.'\n },\n postal_code: {\n type: 'string',\n description: 'The postal code or zip code.'\n },\n state: {\n type: 'string',\n description: 'The state code.'\n },\n name: {\n type: 'string'\n },\n source_id: {\n type: 'string'\n }\n },\n required: [ 'city',\n 'country',\n 'line1',\n 'line2',\n 'postal_code',\n 'state'\n ]\n }\n }\n}\n```", + "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 sandbox individual\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/individual_update_response',\n $defs: {\n individual_update_response: {\n type: 'object',\n title: 'Individual',\n properties: {\n id: {\n type: 'string',\n description: 'A stable Finch `id` (UUID v4) for an individual in the company.'\n },\n dob: {\n type: 'string',\n title: 'Date'\n },\n emails: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n data: {\n type: 'string'\n },\n type: {\n type: 'string',\n enum: [ 'work',\n 'personal'\n ]\n }\n }\n }\n },\n encrypted_ssn: {\n type: 'string',\n description: 'Social Security Number of the individual in **encrypted** format. This field is only available with the `ssn` scope enabled and the `options: { include: [\\'ssn\\'] }` param set in the body.'\n },\n ethnicity: {\n type: 'string',\n description: 'The EEOC-defined ethnicity of the individual.',\n enum: [ 'asian',\n 'white',\n 'black_or_african_american',\n 'native_hawaiian_or_pacific_islander',\n 'american_indian_or_alaska_native',\n 'hispanic_or_latino',\n 'two_or_more_races',\n 'decline_to_specify'\n ]\n },\n first_name: {\n type: 'string',\n description: 'The legal first name of the individual.'\n },\n gender: {\n type: 'string',\n description: 'The gender of the individual.',\n enum: [ 'female',\n 'male',\n 'other',\n 'decline_to_specify'\n ]\n },\n last_name: {\n type: 'string',\n description: 'The legal last name of the individual.'\n },\n middle_name: {\n type: 'string',\n description: 'The legal middle name of the individual.'\n },\n phone_numbers: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n data: {\n type: 'string'\n },\n type: {\n type: 'string',\n enum: [ 'work',\n 'personal'\n ]\n }\n }\n }\n },\n preferred_name: {\n type: 'string',\n description: 'The preferred name of the individual.'\n },\n residence: {\n $ref: '#/$defs/location'\n },\n ssn: {\n type: 'string',\n description: 'Social Security Number of the individual. This field is only available with the `ssn` scope enabled and the `options: { include: [\\'ssn\\'] }` param set in the body. [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field).'\n }\n }\n },\n location: {\n type: 'object',\n title: 'Location',\n properties: {\n city: {\n type: 'string',\n description: 'City, district, suburb, town, or village.'\n },\n country: {\n type: 'string',\n description: 'The 2-letter ISO 3166 country code.'\n },\n line1: {\n type: 'string',\n description: 'Street address or PO box.'\n },\n line2: {\n type: 'string',\n description: 'Apartment, suite, unit, or building.'\n },\n postal_code: {\n type: 'string',\n description: 'The postal code or zip code.'\n },\n state: {\n type: 'string',\n description: 'The state code.'\n },\n name: {\n type: 'string'\n },\n source_id: {\n type: 'string'\n }\n },\n required: [ 'city',\n 'country',\n 'line1',\n 'line2',\n 'postal_code',\n 'state'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { diff --git a/packages/mcp-server/src/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.ts b/packages/mcp-server/src/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.ts index c3dadac8d..c91dcfcd3 100644 --- a/packages/mcp-server/src/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.ts +++ b/packages/mcp-server/src/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'retrieve_jobs_sandbox_configuration', 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\nGet configurations for sandbox jobs\n\n# Response Schema\n```json\n{\n type: 'array',\n items: {\n $ref: '#/$defs/sandbox_job_configuration'\n },\n $defs: {\n sandbox_job_configuration: {\n type: 'object',\n title: 'SandboxJobConfiguration',\n properties: {\n completion_status: {\n type: 'string',\n enum: [ 'complete',\n 'reauth_error',\n 'permissions_error',\n 'error'\n ]\n },\n type: {\n type: 'string',\n enum: [ 'data_sync_all'\n ]\n }\n },\n required: [ 'completion_status',\n 'type'\n ]\n }\n }\n}\n```", + "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\nGet configurations for sandbox jobs\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/configuration_retrieve_response',\n $defs: {\n configuration_retrieve_response: {\n type: 'array',\n items: {\n $ref: '#/$defs/sandbox_job_configuration'\n }\n },\n sandbox_job_configuration: {\n type: 'object',\n title: 'SandboxJobConfiguration',\n properties: {\n completion_status: {\n type: 'string',\n enum: [ 'complete',\n 'reauth_error',\n 'permissions_error',\n 'error'\n ]\n },\n type: {\n type: 'string',\n enum: [ 'data_sync_all'\n ]\n }\n },\n required: [ 'completion_status',\n 'type'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { diff --git a/packages/mcp-server/src/tools/sandbox/jobs/create-sandbox-jobs.ts b/packages/mcp-server/src/tools/sandbox/jobs/create-sandbox-jobs.ts index 509929fc5..897d9b886 100644 --- a/packages/mcp-server/src/tools/sandbox/jobs/create-sandbox-jobs.ts +++ b/packages/mcp-server/src/tools/sandbox/jobs/create-sandbox-jobs.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_sandbox_jobs', 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\nEnqueue a new sandbox job\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n allowed_refreshes: {\n type: 'integer',\n description: 'The number of allowed refreshes per hour (per hour, fixed window)'\n },\n job_id: {\n type: 'string',\n description: 'The id of the job that has been created.'\n },\n job_url: {\n type: 'string',\n description: 'The url that can be used to retrieve the job status'\n },\n remaining_refreshes: {\n type: 'integer',\n description: 'The number of remaining refreshes available (per hour, fixed window)'\n }\n },\n required: [ 'allowed_refreshes',\n 'job_id',\n 'job_url',\n 'remaining_refreshes'\n ]\n}\n```", + "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\nEnqueue a new sandbox job\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/job_create_response',\n $defs: {\n job_create_response: {\n type: 'object',\n properties: {\n allowed_refreshes: {\n type: 'integer',\n description: 'The number of allowed refreshes per hour (per hour, fixed window)'\n },\n job_id: {\n type: 'string',\n description: 'The id of the job that has been created.'\n },\n job_url: {\n type: 'string',\n description: 'The url that can be used to retrieve the job status'\n },\n remaining_refreshes: {\n type: 'integer',\n description: 'The number of remaining refreshes available (per hour, fixed window)'\n }\n },\n required: [ 'allowed_refreshes',\n 'job_id',\n 'job_url',\n 'remaining_refreshes'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { diff --git a/packages/mcp-server/src/tools/sandbox/payment/create-sandbox-payment.ts b/packages/mcp-server/src/tools/sandbox/payment/create-sandbox-payment.ts index 3e10eb319..fcfb613d3 100644 --- a/packages/mcp-server/src/tools/sandbox/payment/create-sandbox-payment.ts +++ b/packages/mcp-server/src/tools/sandbox/payment/create-sandbox-payment.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'create_sandbox_payment', 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\nAdd a new sandbox payment\n\n# Response Schema\n```json\n{\n type: 'object',\n properties: {\n pay_date: {\n type: 'string',\n description: 'The date of the payment.'\n },\n payment_id: {\n type: 'string',\n description: 'The ID of the payment.'\n }\n },\n required: [ 'pay_date',\n 'payment_id'\n ]\n}\n```", + "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\nAdd a new sandbox payment\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/payment_create_response',\n $defs: {\n payment_create_response: {\n type: 'object',\n properties: {\n pay_date: {\n type: 'string',\n description: 'The date of the payment.'\n },\n payment_id: {\n type: 'string',\n description: 'The ID of the payment.'\n }\n },\n required: [ 'pay_date',\n 'payment_id'\n ]\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { diff --git a/packages/mcp-server/tests/options.test.ts b/packages/mcp-server/tests/options.test.ts index 24604b844..a8a5b81a9 100644 --- a/packages/mcp-server/tests/options.test.ts +++ b/packages/mcp-server/tests/options.test.ts @@ -297,7 +297,7 @@ describe('parseQueryOptions', () => { ]); expect(result.client).toBe('cursor'); - expect(result.includeDynamicTools).toBe(undefined); + expect(result.includeDynamicTools).toBe(true); }); it('should override client from default options', () => { diff --git a/packages/mcp-server/tsconfig.build.json b/packages/mcp-server/tsconfig.build.json index 13cb54cbf..df6c2b0a6 100644 --- a/packages/mcp-server/tsconfig.build.json +++ b/packages/mcp-server/tsconfig.build.json @@ -5,8 +5,8 @@ "compilerOptions": { "rootDir": "./dist/src", "paths": { - "@tryfinch/finch-api-mcp/*": ["dist/src/*"], - "@tryfinch/finch-api-mcp": ["dist/src/index.ts"] + "@tryfinch/finch-api-mcp/*": ["./dist/src/*"], + "@tryfinch/finch-api-mcp": ["./dist/src/index.ts"] }, "noEmit": false, "declaration": true, diff --git a/packages/mcp-server/tsconfig.json b/packages/mcp-server/tsconfig.json index a2bbc9f33..cded90d2d 100644 --- a/packages/mcp-server/tsconfig.json +++ b/packages/mcp-server/tsconfig.json @@ -7,10 +7,9 @@ "module": "commonjs", "moduleResolution": "node", "esModuleInterop": true, - "baseUrl": "./", "paths": { - "@tryfinch/finch-api-mcp/*": ["src/*"], - "@tryfinch/finch-api-mcp": ["src/index.ts"] + "@tryfinch/finch-api-mcp/*": ["./src/*"], + "@tryfinch/finch-api-mcp": ["./src/index.ts"] }, "noEmit": true, diff --git a/packages/mcp-server/yarn.lock b/packages/mcp-server/yarn.lock index 707a2de89..966d05755 100644 --- a/packages/mcp-server/yarn.lock +++ b/packages/mcp-server/yarn.lock @@ -725,6 +725,13 @@ dependencies: "@types/node" "*" +"@types/cors@^2.8.19": + version "2.8.19" + resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.19.tgz#d93ea2673fd8c9f697367f5eeefc2bbfa94f0342" + integrity sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg== + 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" @@ -795,7 +802,7 @@ dependencies: undici-types "~6.21.0" -"@types/qs@*": +"@types/qs@*", "@types/qs@^6.14.0": version "6.14.0" resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.14.0.tgz#d8b60cecf62f2db0fb68e5e006077b9178b85de5" integrity sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ== @@ -925,6 +932,11 @@ resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.3.0.tgz#d06bbb384ebcf6c505fde1c3d0ed4ddffe0aaff8" integrity sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g== +"@valtown/deno-http-worker@^0.0.21": + version "0.0.21" + resolved "https://registry.yarnpkg.com/@valtown/deno-http-worker/-/deno-http-worker-0.0.21.tgz#9ce3b5c1d0db211fe7ea8297881fe551838474ad" + integrity sha512-16kFuUykann75lNytnXXIQlmpzreZjzdyT27ebT3yNGCS3kKaS1iZYWHc3Si9An54Cphwr4qEcviChQkEeJBlA== + accepts@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/accepts/-/accepts-2.0.0.tgz#bbcf4ba5075467f3f2131eab3cffc73c2f5d7895" @@ -3387,9 +3399,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.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" diff --git a/release-please-config.json b/release-please-config.json index 63eb38a82..8204c04cd 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -59,10 +59,7 @@ "hidden": true } ], - "reviewers": [ - "jordanbrauer", - "minupalaniappan" - ], + "reviewers": ["jordanbrauer", "minupalaniappan"], "release-type": "node", "extra-files": [ "src/version.ts", diff --git a/scripts/bootstrap b/scripts/bootstrap index 0af58e251..f68bedacb 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,10 +4,18 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { - echo "==> Installing Homebrew dependencies…" - brew bundle + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo } fi diff --git a/scripts/fast-format b/scripts/fast-format new file mode 100755 index 000000000..8a8e9d590 --- /dev/null +++ b/scripts/fast-format @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "Script started with $# arguments" +echo "Arguments: $*" +echo "Script location: $(dirname "$0")" + +cd "$(dirname "$0")/.." +echo "Changed to directory: $(pwd)" + +if [ $# -eq 0 ]; then + echo "Usage: $0 [additional-formatter-args...]" + echo "The file should contain one file path per line" + exit 1 +fi + +FILE_LIST="$1" + +echo "Looking for file: $FILE_LIST" + +if [ ! -f "$FILE_LIST" ]; then + echo "Error: File '$FILE_LIST' not found" + exit 1 +fi + +echo "==> Running eslint --fix" +ESLINT_FILES="$(grep '\.ts$' "$FILE_LIST" || true)" +if ! [ -z "$ESLINT_FILES" ]; then + echo "$ESLINT_FILES" | ESLINT_USE_FLAT_CONFIG="false" xargs ./node_modules/.bin/eslint --cache --fix +fi + +echo "==> Running prettier --write" +# format things eslint didn't +PRETTIER_FILES="$(grep '\.\(js\|json\)$' "$FILE_LIST" || true)" +if ! [ -z "$PRETTIER_FILES" ]; then + echo "$PRETTIER_FILES" | xargs ./node_modules/.bin/prettier \ + --write --cache --cache-strategy metadata --no-error-on-unmatched-pattern \ + '!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs' +fi diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index 73865a386..84cc42860 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -12,9 +12,11 @@ if [[ "$SIGNED_URL" == "null" ]]; then exit 1 fi -UPLOAD_RESPONSE=$(tar -cz dist | curl -v -X PUT \ +TARBALL=$(cd dist && npm pack --silent) + +UPLOAD_RESPONSE=$(curl -v -X PUT \ -H "Content-Type: application/gzip" \ - --data-binary @- "$SIGNED_URL" 2>&1) + --data-binary "@dist/$TARBALL" "$SIGNED_URL" 2>&1) if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then echo -e "\033[32mUploaded build to Stainless storage.\033[0m" diff --git a/src/core.ts b/src/core.ts index bae4c2068..4eebc18a5 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1087,21 +1087,21 @@ export const coerceBoolean = (value: unknown): boolean => { }; export const maybeCoerceInteger = (value: unknown): number | undefined => { - if (value === undefined) { + if (value == null) { return undefined; } return coerceInteger(value); }; export const maybeCoerceFloat = (value: unknown): number | undefined => { - if (value === undefined) { + if (value == null) { return undefined; } return coerceFloat(value); }; export const maybeCoerceBoolean = (value: unknown): boolean | undefined => { - if (value === undefined) { + if (value == null) { return undefined; } return coerceBoolean(value); diff --git a/src/index.ts b/src/index.ts index bc0bdd404..000fafb69 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,12 @@ import * as Uploads from './uploads'; import * as API from './resources/index'; import { AccessTokenCreateParams, AccessTokens, CreateAccessTokenResponse } from './resources/access-tokens'; import { Account, DisconnectResponse, Introspection } from './resources/account'; -import { Provider, Providers, ProvidersSinglePage } from './resources/providers'; +import { + Provider, + ProviderListResponse, + ProviderListResponsesSinglePage, + Providers, +} from './resources/providers'; import { RequestForwarding, RequestForwardingForwardParams, @@ -360,7 +365,7 @@ export class Finch extends Core.APIClient { Finch.AccessTokens = AccessTokens; Finch.HRIS = HRIS; Finch.Providers = Providers; -Finch.ProvidersSinglePage = ProvidersSinglePage; +Finch.ProviderListResponsesSinglePage = ProviderListResponsesSinglePage; Finch.Account = Account; Finch.Webhooks = Webhooks; Finch.RequestForwarding = RequestForwarding; @@ -395,7 +400,12 @@ export declare namespace Finch { export { HRIS as HRIS, type Income as Income, type Location as Location, type Money as Money }; - export { Providers as Providers, type Provider as Provider, ProvidersSinglePage as ProvidersSinglePage }; + export { + Providers as Providers, + type Provider as Provider, + type ProviderListResponse as ProviderListResponse, + ProviderListResponsesSinglePage as ProviderListResponsesSinglePage, + }; export { Account as Account, diff --git a/src/pagination.ts b/src/pagination.ts index 649fc453c..3aed3e413 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -133,11 +133,7 @@ export class IndividualsPage } nextPageInfo(): PageInfo | null { - const offset = this.paging.offset; - if (!offset) { - return null; - } - + const offset = this.paging.offset ?? 0; const length = this.getPaginatedItems().length; const currentCount = offset + length; @@ -199,11 +195,7 @@ export class Page extends AbstractPage implements PageResponse } nextPageInfo(): PageInfo | null { - const offset = this.paging.offset; - if (!offset) { - return null; - } - + const offset = this.paging.offset ?? 0; const length = this.getPaginatedItems().length; const currentCount = offset + length; diff --git a/src/resources/access-tokens.ts b/src/resources/access-tokens.ts index e6daab6ac..586f6ff0b 100644 --- a/src/resources/access-tokens.ts +++ b/src/resources/access-tokens.ts @@ -62,6 +62,11 @@ export interface CreateAccessTokenResponse { */ connection_type: 'finch' | 'provider'; + /** + * An array of entity IDs that can be accessed with this access token + */ + entity_ids: Array; + /** * An array of the authorized products associated with the `access_token` */ @@ -98,19 +103,19 @@ export interface CreateAccessTokenResponse { export interface AccessTokenCreateParams { /** - * The client ID for your application + * The authorization code received from the authorization server */ - client_id: string; + code: string; /** - * The client secret for your application + * The client ID for your application */ - client_secret: string; + client_id?: string; /** - * The authorization code received from the authorization server + * The client secret for your application */ - code: string; + client_secret?: string; /** * The redirect URI used in the authorization request (optional) diff --git a/src/resources/account.ts b/src/resources/account.ts index 2df6c8d53..c6ff91247 100644 --- a/src/resources/account.ts +++ b/src/resources/account.ts @@ -100,6 +100,12 @@ export interface Introspection { */ customer_name?: string | null; + /** + * Array of detailed entity information for each connected account in multi-account + * mode + */ + entities?: Array; + /** * Whether the connection associated with the `access_token` uses the Assisted * Connect Flow. (`true` if using Assisted Connect, `false` if connection is @@ -157,6 +163,28 @@ export namespace Introspection { message?: string; } } + + export interface Entity { + /** + * The connection account ID for this entity + */ + id: string; + + /** + * The name of the entity (payroll provider company name) + */ + name: string | null; + + /** + * The source ID of the entity + */ + source_id: string | null; + + /** + * The type of entity + */ + type: string | null; + } } export declare namespace Account { diff --git a/src/resources/connect/sessions.ts b/src/resources/connect/sessions.ts index e0b55282e..1c3aa83ae 100644 --- a/src/resources/connect/sessions.ts +++ b/src/resources/connect/sessions.ts @@ -47,45 +47,78 @@ export interface SessionReauthenticateResponse { } export interface SessionNewParams { + /** + * Email address of the customer + */ + customer_email: string | null; + + /** + * Unique identifier for the customer + */ customer_id: string; + /** + * Name of the customer + */ customer_name: string; + /** + * Integration configuration for the connect session + */ + integration: SessionNewParams.Integration | null; + + /** + * Enable manual authentication mode + */ + manual: boolean | null; + + /** + * The number of minutes until the session expires (defaults to 129,600, which is + * 90 days) + */ + minutes_to_expire: number | null; + + /** + * The Finch products to request access to + */ products: Array< + | 'benefits' | 'company' + | 'deduction' | 'directory' - | 'individual' + | 'documents' | 'employment' + | 'individual' | 'payment' | 'pay_statement' - | 'benefits' | 'ssn' - | 'deduction' - | 'documents' >; - customer_email?: string | null; - - integration?: SessionNewParams.Integration | null; - - manual?: boolean | null; - /** - * The number of minutes until the session expires (defaults to 129,600, which is - * 90 days) + * The URI to redirect to after the Connect flow is completed */ - minutes_to_expire?: number | null; + redirect_uri: string | null; - redirect_uri?: string | null; - - sandbox?: 'finch' | 'provider' | null; + /** + * Sandbox mode for testing + */ + sandbox: 'finch' | 'provider' | null; } export namespace SessionNewParams { + /** + * Integration configuration for the connect session + */ export interface Integration { - auth_method?: 'assisted' | 'credential' | 'oauth' | 'api_token' | null; - - provider?: string | null; + /** + * The authentication method to use + */ + auth_method: 'assisted' | 'credential' | 'oauth' | 'api_token' | null; + + /** + * The provider to integrate with + */ + provider: string | null; } } @@ -99,28 +132,28 @@ export interface SessionReauthenticateParams { * The number of minutes until the session expires (defaults to 43,200, which is 30 * days) */ - minutes_to_expire?: number | null; + minutes_to_expire: number; /** * The products to request access to (optional for reauthentication) */ - products?: Array< + products: Array< + | 'benefits' | 'company' + | 'deduction' | 'directory' - | 'individual' + | 'documents' | 'employment' + | 'individual' | 'payment' | 'pay_statement' - | 'benefits' | 'ssn' - | 'deduction' - | 'documents' > | null; /** * The URI to redirect to after the Connect flow is completed */ - redirect_uri?: string | null; + redirect_uri: string | null; } export declare namespace Sessions { diff --git a/src/resources/hris/benefits/benefits.ts b/src/resources/hris/benefits/benefits.ts index 91be697e5..3024393ba 100644 --- a/src/resources/hris/benefits/benefits.ts +++ b/src/resources/hris/benefits/benefits.ts @@ -10,6 +10,7 @@ import { IndividualBenefit, IndividualBenefitsSinglePage, IndividualEnrollManyParams, + IndividualEnrolledIDsParams, IndividualEnrolledIDsResponse, IndividualRetrieveManyBenefitsParams, IndividualUnenrollManyParams, @@ -32,18 +33,19 @@ export class Benefits extends APIResource { * ``` */ create( - body?: BenefitCreateParams, + params?: BenefitCreateParams, options?: Core.RequestOptions, ): Core.APIPromise; create(options?: Core.RequestOptions): Core.APIPromise; create( - body: BenefitCreateParams | Core.RequestOptions = {}, + params: BenefitCreateParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.create({}, body); + if (isRequestOptions(params)) { + return this.create({}, params); } - return this._client.post('/employer/benefits', { body, ...options }); + const { entity_ids, ...body } = params; + return this._client.post('/employer/benefits', { query: { entity_ids }, body, ...options }); } /** @@ -56,8 +58,21 @@ export class Benefits extends APIResource { * ); * ``` */ - retrieve(benefitId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/employer/benefits/${benefitId}`, options); + retrieve( + benefitId: string, + query?: BenefitRetrieveParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + retrieve(benefitId: string, options?: Core.RequestOptions): Core.APIPromise; + retrieve( + benefitId: string, + query: BenefitRetrieveParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.retrieve(benefitId, {}, query); + } + return this._client.get(`/employer/benefits/${benefitId}`, { query, ...options }); } /** @@ -71,19 +86,20 @@ export class Benefits extends APIResource { */ update( benefitId: string, - body?: BenefitUpdateParams, + params?: BenefitUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise; update(benefitId: string, options?: Core.RequestOptions): Core.APIPromise; update( benefitId: string, - body: BenefitUpdateParams | Core.RequestOptions = {}, + params: BenefitUpdateParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.update(benefitId, {}, body); + if (isRequestOptions(params)) { + return this.update(benefitId, {}, params); } - return this._client.post(`/employer/benefits/${benefitId}`, { body, ...options }); + const { entity_ids, ...body } = params; + return this._client.post(`/employer/benefits/${benefitId}`, { query: { entity_ids }, body, ...options }); } /** @@ -97,8 +113,19 @@ export class Benefits extends APIResource { * } * ``` */ - list(options?: Core.RequestOptions): Core.PagePromise { - return this._client.getAPIList('/employer/benefits', CompanyBenefitsSinglePage, options); + list( + query?: BenefitListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list(options?: Core.RequestOptions): Core.PagePromise; + list( + query: BenefitListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list({}, query); + } + return this._client.getAPIList('/employer/benefits', CompanyBenefitsSinglePage, { query, ...options }); } /** @@ -112,10 +139,24 @@ export class Benefits extends APIResource { * } * ``` */ + listSupportedBenefits( + query?: BenefitListSupportedBenefitsParams, + options?: Core.RequestOptions, + ): Core.PagePromise; listSupportedBenefits( options?: Core.RequestOptions, + ): Core.PagePromise; + listSupportedBenefits( + query: BenefitListSupportedBenefitsParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, ): Core.PagePromise { - return this._client.getAPIList('/employer/benefits/meta', SupportedBenefitsSinglePage, options); + if (isRequestOptions(query)) { + return this.listSupportedBenefits({}, query); + } + return this._client.getAPIList('/employer/benefits/meta', SupportedBenefitsSinglePage, { + query, + ...options, + }); } } @@ -123,16 +164,56 @@ export class CompanyBenefitsSinglePage extends SinglePage {} export class SupportedBenefitsSinglePage extends SinglePage {} -export interface BenefitContribution { - /** - * Contribution amount in cents (if `fixed`) or basis points (if `percent`). - */ - amount: number | null; +export type BenefitContribution = + | BenefitContribution.UnionMember0 + | BenefitContribution.UnionMember1 + | BenefitContribution.UnionMember2; + +export namespace BenefitContribution { + export interface UnionMember0 { + /** + * Contribution amount in cents. + */ + amount: number; + + /** + * Fixed contribution type. + */ + type: 'fixed'; + } - /** - * Contribution type. - */ - type: 'fixed' | 'percent' | null; + export interface UnionMember1 { + /** + * Contribution amount in basis points (1/100th of a percent). + */ + amount: number; + + /** + * Percentage contribution type. + */ + type: 'percent'; + } + + export interface UnionMember2 { + /** + * Array of tier objects defining employer match tiers based on employee + * contribution thresholds. + */ + tiers: Array; + + /** + * Tiered contribution type (only valid for company_contribution). + */ + type: 'tiered'; + } + + export namespace UnionMember2 { + export interface Tier { + match: number; + + threshold: number; + } + } } export interface BenefitFeaturesAndOperations { @@ -271,7 +352,7 @@ export interface SupportedBenefit { * Supported contribution types. An empty array indicates contributions are not * supported. */ - company_contribution: Array<'fixed' | 'percent' | null> | null; + company_contribution: Array<'fixed' | 'percent' | 'tiered' | null> | null; description: string | null; @@ -315,24 +396,29 @@ export type BenfitContribution = BenefitContribution | null; export interface BenefitCreateParams { /** - * The company match for this benefit. + * Query param: The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; + + /** + * Body param: The company match for this benefit. */ company_contribution?: BenefitCreateParams.CompanyContribution | null; /** - * Name of the benefit as it appears in the provider and pay statements. Recommend - * limiting this to <30 characters due to limitations in specific providers (e.g. - * Justworks). + * Body param: Name of the benefit as it appears in the provider and pay + * statements. Recommend limiting this to <30 characters due to limitations in + * specific providers (e.g. Justworks). */ description?: string; /** - * The frequency of the benefit deduction/contribution. + * Body param: The frequency of the benefit deduction/contribution. */ frequency?: BenefitFrequency | null; /** - * Type of benefit. + * Body param: Type of benefit. */ type?: BenefitType | null; } @@ -356,13 +442,39 @@ export namespace BenefitCreateParams { } } +export interface BenefitRetrieveParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; +} + export interface BenefitUpdateParams { /** - * Updated name or description. + * Query param: The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; + + /** + * Body param: Updated name or description. */ description?: string; } +export interface BenefitListParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; +} + +export interface BenefitListSupportedBenefitsParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; +} + Benefits.CompanyBenefitsSinglePage = CompanyBenefitsSinglePage; Benefits.SupportedBenefitsSinglePage = SupportedBenefitsSinglePage; Benefits.Individuals = Individuals; @@ -384,7 +496,10 @@ export declare namespace Benefits { CompanyBenefitsSinglePage as CompanyBenefitsSinglePage, SupportedBenefitsSinglePage as SupportedBenefitsSinglePage, type BenefitCreateParams as BenefitCreateParams, + type BenefitRetrieveParams as BenefitRetrieveParams, type BenefitUpdateParams as BenefitUpdateParams, + type BenefitListParams as BenefitListParams, + type BenefitListSupportedBenefitsParams as BenefitListSupportedBenefitsParams, }; export { @@ -395,6 +510,7 @@ export declare namespace Benefits { type IndividualEnrolledIDsResponse as IndividualEnrolledIDsResponse, IndividualBenefitsSinglePage as IndividualBenefitsSinglePage, type IndividualEnrollManyParams as IndividualEnrollManyParams, + type IndividualEnrolledIDsParams as IndividualEnrolledIDsParams, type IndividualRetrieveManyBenefitsParams as IndividualRetrieveManyBenefitsParams, type IndividualUnenrollManyParams as IndividualUnenrollManyParams, }; diff --git a/src/resources/hris/benefits/index.ts b/src/resources/hris/benefits/index.ts index 64d5d0209..eb37c4099 100644 --- a/src/resources/hris/benefits/index.ts +++ b/src/resources/hris/benefits/index.ts @@ -16,7 +16,10 @@ export { type UpdateCompanyBenefitResponse, type BenfitContribution, type BenefitCreateParams, + type BenefitRetrieveParams, type BenefitUpdateParams, + type BenefitListParams, + type BenefitListSupportedBenefitsParams, } from './benefits'; export { IndividualBenefitsSinglePage, @@ -26,6 +29,7 @@ export { type UnenrolledIndividualBenefitResponse, type IndividualEnrolledIDsResponse, type IndividualEnrollManyParams, + type IndividualEnrolledIDsParams, type IndividualRetrieveManyBenefitsParams, type IndividualUnenrollManyParams, } from './individuals'; diff --git a/src/resources/hris/benefits/individuals.ts b/src/resources/hris/benefits/individuals.ts index 67ea17feb..b269ddd11 100644 --- a/src/resources/hris/benefits/individuals.ts +++ b/src/resources/hris/benefits/individuals.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as BenefitsAPI from './benefits'; import { SinglePage } from '../../../pagination'; export class Individuals extends APIResource { @@ -18,13 +17,12 @@ export class Individuals extends APIResource { * const enrolledIndividualBenefitResponse = * await client.hris.benefits.individuals.enrollMany( * 'benefit_id', - * [{}], * ); * ``` */ enrollMany( benefitId: string, - body?: IndividualEnrollManyParams, + params?: IndividualEnrollManyParams, options?: Core.RequestOptions, ): Core.APIPromise; enrollMany( @@ -33,13 +31,18 @@ export class Individuals extends APIResource { ): Core.APIPromise; enrollMany( benefitId: string, - body?: IndividualEnrollManyParams | Core.RequestOptions, + params?: IndividualEnrollManyParams | Core.RequestOptions, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.enrollMany(benefitId, undefined, body); + if (isRequestOptions(params)) { + return this.enrollMany(benefitId, undefined, params); } - return this._client.post(`/employer/benefits/${benefitId}/individuals`, { body, ...options }); + const { entity_ids, individuals } = params ?? {}; + return this._client.post(`/employer/benefits/${benefitId}/individuals`, { + query: { entity_ids }, + body: individuals, + ...options, + }); } /** @@ -55,9 +58,22 @@ export class Individuals extends APIResource { */ enrolledIds( benefitId: string, + query?: IndividualEnrolledIDsParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + enrolledIds( + benefitId: string, + options?: Core.RequestOptions, + ): Core.APIPromise; + enrolledIds( + benefitId: string, + query: IndividualEnrolledIDsParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { - return this._client.get(`/employer/benefits/${benefitId}/enrolled`, options); + if (isRequestOptions(query)) { + return this.enrolledIds(benefitId, {}, query); + } + return this._client.get(`/employer/benefits/${benefitId}/enrolled`, { query, ...options }); } /** @@ -110,7 +126,7 @@ export class Individuals extends APIResource { */ unenrollMany( benefitId: string, - body?: IndividualUnenrollManyParams, + params?: IndividualUnenrollManyParams, options?: Core.RequestOptions, ): Core.APIPromise; unenrollMany( @@ -119,13 +135,18 @@ export class Individuals extends APIResource { ): Core.APIPromise; unenrollMany( benefitId: string, - body: IndividualUnenrollManyParams | Core.RequestOptions = {}, + params: IndividualUnenrollManyParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.unenrollMany(benefitId, {}, body); + if (isRequestOptions(params)) { + return this.unenrollMany(benefitId, {}, params); } - return this._client.delete(`/employer/benefits/${benefitId}/individuals`, { body, ...options }); + const { entity_ids, ...body } = params; + return this._client.delete(`/employer/benefits/${benefitId}/individuals`, { + query: { entity_ids }, + body, + ...options, + }); } } @@ -156,9 +177,13 @@ export namespace IndividualBenefit { */ catch_up: boolean | null; - company_contribution: BenefitsAPI.BenefitContribution | null; + company_contribution: + | UnionMember0.UnionMember0 + | UnionMember0.UnionMember1 + | UnionMember0.UnionMember2 + | null; - employee_deduction: BenefitsAPI.BenefitContribution | null; + employee_deduction: UnionMember0.UnionMember0 | UnionMember0.UnionMember1 | null; /** * Type for HSA contribution limit if the benefit is a HSA. @@ -166,6 +191,77 @@ export namespace IndividualBenefit { hsa_contribution_limit?: 'individual' | 'family' | null; } + export namespace UnionMember0 { + export interface UnionMember0 { + /** + * Contribution amount in cents. + */ + amount: number; + + /** + * Fixed contribution type. + */ + type: 'fixed'; + } + + export interface UnionMember1 { + /** + * Contribution amount in basis points (1/100th of a percent). + */ + amount: number; + + /** + * Percentage contribution type. + */ + type: 'percent'; + } + + export interface UnionMember2 { + /** + * Array of tier objects defining employer match tiers based on employee + * contribution thresholds. + */ + tiers: Array; + + /** + * Tiered contribution type (only valid for company_contribution). + */ + type: 'tiered'; + } + + export namespace UnionMember2 { + export interface Tier { + match: number; + + threshold: number; + } + } + + export interface UnionMember0 { + /** + * Contribution amount in cents. + */ + amount: number; + + /** + * Fixed contribution type. + */ + type: 'fixed'; + } + + export interface UnionMember1 { + /** + * Contribution amount in basis points (1/100th of a percent). + */ + amount: number; + + /** + * Percentage contribution type. + */ + type: 'percent'; + } + } + export interface BatchError { code: number; @@ -190,7 +286,17 @@ export interface IndividualEnrolledIDsResponse { individual_ids: Array; } -export type IndividualEnrollManyParams = Array; +export interface IndividualEnrollManyParams { + /** + * Query param: The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; + + /** + * Body param: Array of the individual_id to enroll and a configuration object. + */ + individuals?: Array; +} export namespace IndividualEnrollManyParams { export interface Individual { @@ -238,7 +344,27 @@ export namespace IndividualEnrollManyParams { */ amount?: number; - type?: 'fixed' | 'percent'; + /** + * Array of tier objects for tiered contribution matching (required when type is + * tiered) + */ + tiers?: Array; + + type?: 'fixed' | 'percent' | 'tiered'; + } + + export namespace CompanyContribution { + export interface Tier { + /** + * The employer match percentage in basis points (0-10000 = 0-100%) + */ + match: number; + + /** + * The employee contribution threshold in basis points (0-10000 = 0-100%) + */ + threshold: number; + } } export interface EmployeeDeduction { @@ -254,7 +380,19 @@ export namespace IndividualEnrollManyParams { } } +export interface IndividualEnrolledIDsParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; +} + export interface IndividualRetrieveManyBenefitsParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; + /** * comma-delimited list of stable Finch uuids for each individual. If empty, * defaults to all individuals @@ -264,7 +402,12 @@ export interface IndividualRetrieveManyBenefitsParams { export interface IndividualUnenrollManyParams { /** - * Array of individual_ids to unenroll. + * Query param: The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; + + /** + * Body param: Array of individual_ids to unenroll. */ individual_ids?: Array; } @@ -279,6 +422,7 @@ export declare namespace Individuals { type IndividualEnrolledIDsResponse as IndividualEnrolledIDsResponse, IndividualBenefitsSinglePage as IndividualBenefitsSinglePage, type IndividualEnrollManyParams as IndividualEnrollManyParams, + type IndividualEnrolledIDsParams as IndividualEnrolledIDsParams, type IndividualRetrieveManyBenefitsParams as IndividualRetrieveManyBenefitsParams, type IndividualUnenrollManyParams as IndividualUnenrollManyParams, }; diff --git a/src/resources/hris/company/company.ts b/src/resources/hris/company/company.ts index 357637ea3..6a40f6002 100644 --- a/src/resources/hris/company/company.ts +++ b/src/resources/hris/company/company.ts @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; +import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; import * as HRISAPI from '../hris'; import * as PayStatementItemAPI from './pay-statement-item/pay-statement-item'; @@ -24,8 +25,16 @@ export class CompanyResource extends APIResource { * const company = await client.hris.company.retrieve(); * ``` */ - retrieve(options?: Core.RequestOptions): Core.APIPromise { - return this._client.get('/employer/company', options); + retrieve(query?: CompanyRetrieveParams, options?: Core.RequestOptions): Core.APIPromise; + retrieve(options?: Core.RequestOptions): Core.APIPromise; + retrieve( + query: CompanyRetrieveParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.retrieve({}, query); + } + return this._client.get('/employer/company', { query, ...options }); } } @@ -151,11 +160,18 @@ export namespace Company { } } +export interface CompanyRetrieveParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; +} + CompanyResource.PayStatementItem = PayStatementItem; CompanyResource.PayStatementItemListResponsesPage = PayStatementItemListResponsesPage; export declare namespace CompanyResource { - export { type Company as Company }; + export { type Company as Company, type CompanyRetrieveParams as CompanyRetrieveParams }; export { PayStatementItem as PayStatementItem, diff --git a/src/resources/hris/company/index.ts b/src/resources/hris/company/index.ts index 7c815639f..fb8496431 100644 --- a/src/resources/hris/company/index.ts +++ b/src/resources/hris/company/index.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { CompanyResource, type Company } from './company'; +export { CompanyResource, type Company, type CompanyRetrieveParams } from './company'; export { PayStatementItemListResponsesPage, PayStatementItem, diff --git a/src/resources/hris/company/pay-statement-item/index.ts b/src/resources/hris/company/pay-statement-item/index.ts index 99b195513..21d1080e6 100644 --- a/src/resources/hris/company/pay-statement-item/index.ts +++ b/src/resources/hris/company/pay-statement-item/index.ts @@ -15,4 +15,6 @@ export { type RuleDeleteResponse, type RuleCreateParams, type RuleUpdateParams, + type RuleListParams, + type RuleDeleteParams, } from './rules'; diff --git a/src/resources/hris/company/pay-statement-item/pay-statement-item.ts b/src/resources/hris/company/pay-statement-item/pay-statement-item.ts index 207ab0755..af89e364d 100644 --- a/src/resources/hris/company/pay-statement-item/pay-statement-item.ts +++ b/src/resources/hris/company/pay-statement-item/pay-statement-item.ts @@ -7,7 +7,9 @@ import * as RulesAPI from './rules'; import { RuleCreateParams, RuleCreateResponse, + RuleDeleteParams, RuleDeleteResponse, + RuleListParams, RuleListResponse, RuleListResponsesPage, RuleUpdateParams, @@ -115,6 +117,11 @@ export interface PayStatementItemListParams { */ end_date?: string; + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; + /** * Case-insensitive partial match search by pay statement item name. */ @@ -152,5 +159,7 @@ export declare namespace PayStatementItem { RuleListResponsesPage as RuleListResponsesPage, type RuleCreateParams as RuleCreateParams, type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, }; } diff --git a/src/resources/hris/company/pay-statement-item/rules.ts b/src/resources/hris/company/pay-statement-item/rules.ts index bbc056ce5..d8fb1de72 100644 --- a/src/resources/hris/company/pay-statement-item/rules.ts +++ b/src/resources/hris/company/pay-statement-item/rules.ts @@ -20,16 +20,21 @@ export class Rules extends APIResource { * await client.hris.company.payStatementItem.rules.create(); * ``` */ - create(body?: RuleCreateParams, options?: Core.RequestOptions): Core.APIPromise; + create(params?: RuleCreateParams, options?: Core.RequestOptions): Core.APIPromise; create(options?: Core.RequestOptions): Core.APIPromise; create( - body: RuleCreateParams | Core.RequestOptions = {}, + params: RuleCreateParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.create({}, body); + if (isRequestOptions(params)) { + return this.create({}, params); } - return this._client.post('/employer/pay-statement-item/rule', { body, ...options }); + const { entity_ids, ...body } = params; + return this._client.post('/employer/pay-statement-item/rule', { + query: { entity_ids }, + body, + ...options, + }); } /** @@ -46,19 +51,24 @@ export class Rules extends APIResource { */ update( ruleId: string, - body?: RuleUpdateParams, + params?: RuleUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise; update(ruleId: string, options?: Core.RequestOptions): Core.APIPromise; update( ruleId: string, - body: RuleUpdateParams | Core.RequestOptions = {}, + params: RuleUpdateParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.update(ruleId, {}, body); + if (isRequestOptions(params)) { + return this.update(ruleId, {}, params); } - return this._client.put(`/employer/pay-statement-item/rule/${ruleId}`, { body, ...options }); + const { entity_ids, ...body } = params; + return this._client.put(`/employer/pay-statement-item/rule/${ruleId}`, { + query: { entity_ids }, + body, + ...options, + }); } /** @@ -73,8 +83,22 @@ export class Rules extends APIResource { * } * ``` */ - list(options?: Core.RequestOptions): Core.PagePromise { - return this._client.getAPIList('/employer/pay-statement-item/rule', RuleListResponsesPage, options); + list( + query?: RuleListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list(options?: Core.RequestOptions): Core.PagePromise; + list( + query: RuleListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list({}, query); + } + return this._client.getAPIList('/employer/pay-statement-item/rule', RuleListResponsesPage, { + query, + ...options, + }); } /** @@ -89,8 +113,25 @@ export class Rules extends APIResource { * ); * ``` */ - delete(ruleId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.delete(`/employer/pay-statement-item/rule/${ruleId}`, options); + delete( + ruleId: string, + params?: RuleDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + delete(ruleId: string, options?: Core.RequestOptions): Core.APIPromise; + delete( + ruleId: string, + params: RuleDeleteParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(params)) { + return this.delete(ruleId, {}, params); + } + const { entity_ids } = params; + return this._client.delete(`/employer/pay-statement-item/rule/${ruleId}`, { + query: { entity_ids }, + ...options, + }); } } @@ -399,24 +440,33 @@ export namespace RuleDeleteResponse { export interface RuleCreateParams { /** - * Specifies the fields to be applied when the condition is met. + * Query param: The entity IDs to create the rule for. + */ + entity_ids?: Array; + + /** + * Body param: Specifies the fields to be applied when the condition is met. */ attributes?: RuleCreateParams.Attributes; + /** + * Body param: + */ conditions?: Array; /** - * Specifies when the rules should stop applying rules based on the date. + * Body param: Specifies when the rules should stop applying rules based on the + * date. */ effective_end_date?: string | null; /** - * Specifies when the rule should begin applying based on the date. + * Body param: Specifies when the rule should begin applying based on the date. */ effective_start_date?: string | null; /** - * The entity type to which the rule is applied. + * Body param: The entity type to which the rule is applied. */ entity_type?: 'pay_statement_item'; } @@ -452,9 +502,31 @@ export namespace RuleCreateParams { } export interface RuleUpdateParams { + /** + * Query param: The entity IDs to update the rule for. + */ + entity_ids?: Array; + + /** + * Body param: + */ optionalProperty?: unknown; } +export interface RuleListParams { + /** + * The entity IDs to retrieve rules for. + */ + entity_ids?: Array; +} + +export interface RuleDeleteParams { + /** + * The entity IDs to delete the rule for. + */ + entity_ids?: Array; +} + Rules.RuleListResponsesPage = RuleListResponsesPage; export declare namespace Rules { @@ -466,5 +538,7 @@ export declare namespace Rules { RuleListResponsesPage as RuleListResponsesPage, type RuleCreateParams as RuleCreateParams, type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, }; } diff --git a/src/resources/hris/directory.ts b/src/resources/hris/directory.ts index 006acc784..237ed3d68 100644 --- a/src/resources/hris/directory.ts +++ b/src/resources/hris/directory.ts @@ -97,9 +97,19 @@ export namespace IndividualInDirectory { } } -export interface DirectoryListParams extends IndividualsPageParams {} +export interface DirectoryListParams extends IndividualsPageParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; +} -export interface DirectoryListIndividualsParams extends IndividualsPageParams {} +export interface DirectoryListIndividualsParams extends IndividualsPageParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; +} export declare namespace Directory { export { diff --git a/src/resources/hris/documents.ts b/src/resources/hris/documents.ts index b9b3396f7..4251336ae 100644 --- a/src/resources/hris/documents.ts +++ b/src/resources/hris/documents.ts @@ -38,8 +38,21 @@ export class Documents extends APIResource { * ); * ``` */ - retreive(documentId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/employer/documents/${documentId}`, options); + retreive( + documentId: string, + query?: DocumentRetreiveParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + retreive(documentId: string, options?: Core.RequestOptions): Core.APIPromise; + retreive( + documentId: string, + query: DocumentRetreiveParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.retreive(documentId, {}, query); + } + return this._client.get(`/employer/documents/${documentId}`, { query, ...options }); } } @@ -47,29 +60,29 @@ export interface DocumentResponse { /** * A stable Finch id for the document. */ - id?: string; + id: string; /** * The ID of the individual associated with the document. This will be null for * employer-level documents. */ - individual_id?: string | null; + individual_id: string | null; /** * The type of document. */ - type?: 'w4_2020' | 'w4_2005'; + type: 'w4_2020' | 'w4_2005'; /** * A URL to access the document. Format: * `https://api.tryfinch.com/employer/documents/:document_id`. */ - url?: string; + url: string; /** * The year the document applies to, if available. */ - year?: number | null; + year: number; } /** @@ -80,17 +93,17 @@ export interface W42005 { /** * Detailed information specific to the 2005 W4 form. */ - data?: W42005.Data; + data: W42005.Data; /** * Specifies the form type, indicating that this document is a 2005 W4 form. */ - type?: 'w4_2005'; + type: 'w4_2005'; /** * The tax year this W4 document applies to. */ - year?: number | null; + year: number; } export namespace W42005 { @@ -101,27 +114,27 @@ export namespace W42005 { /** * Additional withholding amount (in cents). */ - additional_withholding?: number | null; + additional_withholding: number; /** * Indicates exemption status from federal tax withholding. */ - exemption?: 'exempt' | 'non_exempt'; + exemption: 'exempt' | 'non_exempt' | null; /** * The individual's filing status for tax purposes. */ - filing_status?: 'married' | 'married_but_withhold_at_higher_single_rate' | 'single' | null; + filing_status: 'married' | 'married_but_withhold_at_higher_single_rate' | 'single' | null; /** * The unique identifier for the individual associated with this 2005 W4 form. */ - individual_id?: string; + individual_id: string; /** * Total number of allowances claimed (in cents). */ - total_number_of_allowances?: number | null; + total_number_of_allowances: number; } } @@ -133,17 +146,17 @@ export interface W42020 { /** * Detailed information specific to the 2020 W4 form. */ - data?: W42020.Data; + data: W42020.Data; /** * Specifies the form type, indicating that this document is a 2020 W4 form. */ - type?: 'w4_2020'; + type: 'w4_2020'; /** * The tax year this W4 document applies to. */ - year?: number | null; + year: number; } export namespace W42020 { @@ -155,27 +168,27 @@ export namespace W42020 { * Amount claimed for dependents other than qualifying children under 17 (in * cents). */ - amount_for_other_dependents?: number | null; + amount_for_other_dependents: number; /** * Amount claimed for dependents under 17 years old (in cents). */ - amount_for_qualifying_children_under_17?: number | null; + amount_for_qualifying_children_under_17: number; /** * Deductible expenses (in cents). */ - deductions?: number | null; + deductions: number; /** * Additional withholding amount (in cents). */ - extra_withholding?: number | null; + extra_withholding: number; /** * The individual's filing status for tax purposes. */ - filing_status?: + filing_status: | 'head_of_household' | 'married_filing_jointly_or_qualifying_surviving_spouse' | 'single_or_married_filing_separately' @@ -184,17 +197,17 @@ export namespace W42020 { /** * The unique identifier for the individual associated with this document. */ - individual_id?: string; + individual_id: string; /** * Additional income from sources outside of primary employment (in cents). */ - other_income?: number | null; + other_income: number; /** * Total amount claimed for dependents and other credits (in cents). */ - total_claim_dependent_and_other_credits?: number | null; + total_claim_dependent_and_other_credits: number; } } @@ -211,6 +224,11 @@ export interface DocumentListResponse { export type DocumentRetreiveResponse = W42020 | W42005; export interface DocumentListParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; + /** * Comma-delimited list of stable Finch uuids for each individual. If empty, * defaults to all individuals @@ -234,6 +252,13 @@ export interface DocumentListParams { types?: Array<'w4_2020' | 'w4_2005'>; } +export interface DocumentRetreiveParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; +} + export declare namespace Documents { export { type DocumentResponse as DocumentResponse, @@ -242,5 +267,6 @@ export declare namespace Documents { type DocumentListResponse as DocumentListResponse, type DocumentRetreiveResponse as DocumentRetreiveResponse, type DocumentListParams as DocumentListParams, + type DocumentRetreiveParams as DocumentRetreiveParams, }; } diff --git a/src/resources/hris/employments.ts b/src/resources/hris/employments.ts index 0956aa565..420b1ff1e 100644 --- a/src/resources/hris/employments.ts +++ b/src/resources/hris/employments.ts @@ -20,10 +20,12 @@ export class Employments extends APIResource { * ``` */ retrieveMany( - body: EmploymentRetrieveManyParams, + params: EmploymentRetrieveManyParams, options?: Core.RequestOptions, ): Core.PagePromise { + const { entity_ids, ...body } = params; return this._client.getAPIList('/employer/employment', EmploymentDataResponsesPage, { + query: { entity_ids }, body, method: 'post', ...options, @@ -207,9 +209,14 @@ export interface EmploymentDataResponse { export interface EmploymentRetrieveManyParams { /** - * The array of batch requests. + * Body param: The array of batch requests. */ requests: Array; + + /** + * Query param: The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; } export namespace EmploymentRetrieveManyParams { diff --git a/src/resources/hris/hris.ts b/src/resources/hris/hris.ts index 18f734871..ea5ab6ca7 100644 --- a/src/resources/hris/hris.ts +++ b/src/resources/hris/hris.ts @@ -13,6 +13,7 @@ import { DocumentListParams, DocumentListResponse, DocumentResponse, + DocumentRetreiveParams, DocumentRetreiveResponse, Documents, W42005, @@ -52,6 +53,9 @@ import { BenefitCreateParams, BenefitFeaturesAndOperations, BenefitFrequency, + BenefitListParams, + BenefitListSupportedBenefitsParams, + BenefitRetrieveParams, BenefitType, BenefitUpdateParams, Benefits, @@ -66,7 +70,7 @@ import { UpdateCompanyBenefitResponse, } from './benefits/benefits'; import * as CompanyAPI from './company/company'; -import { Company, CompanyResource } from './company/company'; +import { Company, CompanyResource, CompanyRetrieveParams } from './company/company'; export class HRIS extends APIResource { company: CompanyAPI.CompanyResource = new CompanyAPI.CompanyResource(this._client); @@ -180,7 +184,11 @@ HRIS.SupportedBenefitsSinglePage = SupportedBenefitsSinglePage; export declare namespace HRIS { export { type Income as Income, type Location as Location, type Money as Money }; - export { CompanyResource as CompanyResource, type Company as Company }; + export { + CompanyResource as CompanyResource, + type Company as Company, + type CompanyRetrieveParams as CompanyRetrieveParams, + }; export { Directory as Directory, @@ -230,6 +238,7 @@ export declare namespace HRIS { type DocumentListResponse as DocumentListResponse, type DocumentRetreiveResponse as DocumentRetreiveResponse, type DocumentListParams as DocumentListParams, + type DocumentRetreiveParams as DocumentRetreiveParams, }; export { @@ -248,6 +257,9 @@ export declare namespace HRIS { CompanyBenefitsSinglePage as CompanyBenefitsSinglePage, SupportedBenefitsSinglePage as SupportedBenefitsSinglePage, type BenefitCreateParams as BenefitCreateParams, + type BenefitRetrieveParams as BenefitRetrieveParams, type BenefitUpdateParams as BenefitUpdateParams, + type BenefitListParams as BenefitListParams, + type BenefitListSupportedBenefitsParams as BenefitListSupportedBenefitsParams, }; } diff --git a/src/resources/hris/index.ts b/src/resources/hris/index.ts index 702fcbaf3..5fddd3d6e 100644 --- a/src/resources/hris/index.ts +++ b/src/resources/hris/index.ts @@ -16,9 +16,12 @@ export { type UpdateCompanyBenefitResponse, type BenfitContribution, type BenefitCreateParams, + type BenefitRetrieveParams, type BenefitUpdateParams, + type BenefitListParams, + type BenefitListSupportedBenefitsParams, } from './benefits/index'; -export { CompanyResource, type Company } from './company/index'; +export { CompanyResource, type Company, type CompanyRetrieveParams } from './company/index'; export { Directory, type IndividualInDirectory, @@ -33,6 +36,7 @@ export { type DocumentListResponse, type DocumentRetreiveResponse, type DocumentListParams, + type DocumentRetreiveParams, } from './documents'; export { EmploymentDataResponsesPage, diff --git a/src/resources/hris/individuals.ts b/src/resources/hris/individuals.ts index 21c3ad826..664af0b85 100644 --- a/src/resources/hris/individuals.ts +++ b/src/resources/hris/individuals.ts @@ -19,18 +19,20 @@ export class Individuals extends APIResource { * ``` */ retrieveMany( - body?: IndividualRetrieveManyParams, + params?: IndividualRetrieveManyParams, options?: Core.RequestOptions, ): Core.PagePromise; retrieveMany(options?: Core.RequestOptions): Core.PagePromise; retrieveMany( - body: IndividualRetrieveManyParams | Core.RequestOptions = {}, + params: IndividualRetrieveManyParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.PagePromise { - if (isRequestOptions(body)) { - return this.retrieveMany({}, body); + if (isRequestOptions(params)) { + return this.retrieveMany({}, params); } + const { entity_ids, ...body } = params; return this._client.getAPIList('/employer/individual', IndividualResponsesPage, { + query: { entity_ids }, body, method: 'post', ...options, @@ -146,8 +148,19 @@ export interface IndividualResponse { } export interface IndividualRetrieveManyParams { + /** + * Query param: The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; + + /** + * Body param: + */ options?: IndividualRetrieveManyParams.Options | null; + /** + * Body param: + */ requests?: Array; } diff --git a/src/resources/hris/pay-statements.ts b/src/resources/hris/pay-statements.ts index 2a7af53ed..b5be191be 100644 --- a/src/resources/hris/pay-statements.ts +++ b/src/resources/hris/pay-statements.ts @@ -30,10 +30,12 @@ export class PayStatements extends APIResource { * ``` */ retrieveMany( - body: PayStatementRetrieveManyParams, + params: PayStatementRetrieveManyParams, options?: Core.RequestOptions, ): Core.PagePromise { + const { entity_ids, ...body } = params; return this._client.getAPIList('/employer/pay-statement', PayStatementResponsesPage, { + query: { entity_ids }, body, method: 'post', ...options, @@ -52,9 +54,9 @@ export interface PayStatement { /** * The array of deductions objects associated with this pay statement. */ - employee_deductions: Array | null; + employee_deductions: Array | null; - employer_contributions: Array | null; + employer_contributions: Array | null; gross_pay: HRISAPI.Money | null; @@ -73,7 +75,7 @@ export interface PayStatement { /** * The array of taxes objects associated with this pay statement. */ - taxes: Array | null; + taxes: Array | null; /** * The number of hours worked for this pay period @@ -133,18 +135,12 @@ export namespace PayStatement { export namespace Earning { export interface Attributes { - metadata: Attributes.Metadata; - } - - export namespace Attributes { - export interface Metadata { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - metadata: { [key: string]: unknown }; - } + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + metadata: { [key: string]: unknown }; } } @@ -179,18 +175,12 @@ export namespace PayStatement { export namespace EmployeeDeduction { export interface Attributes { - metadata: Attributes.Metadata; - } - - export namespace Attributes { - export interface Metadata { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - metadata: { [key: string]: unknown }; - } + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + metadata: { [key: string]: unknown }; } } @@ -220,18 +210,12 @@ export namespace PayStatement { export namespace EmployerContribution { export interface Attributes { - metadata: Attributes.Metadata; - } - - export namespace Attributes { - export interface Metadata { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - metadata: { [key: string]: unknown }; - } + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + metadata: { [key: string]: unknown }; } } @@ -266,18 +250,12 @@ export namespace PayStatement { export namespace Tax { export interface Attributes { - metadata: Attributes.Metadata; - } - - export namespace Attributes { - export interface Metadata { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - metadata: { [key: string]: unknown }; - } + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + metadata: { [key: string]: unknown }; } } } @@ -334,9 +312,14 @@ export namespace PayStatementResponseBody { export interface PayStatementRetrieveManyParams { /** - * The array of batch requests. + * Body param: The array of batch requests. */ requests: Array; + + /** + * Query param: The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; } export namespace PayStatementRetrieveManyParams { diff --git a/src/resources/hris/payments.ts b/src/resources/hris/payments.ts index af1d1d9de..b7e63d8d3 100644 --- a/src/resources/hris/payments.ts +++ b/src/resources/hris/payments.ts @@ -104,6 +104,11 @@ export interface PaymentListParams { * format. */ start_date: string; + + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; } Payments.PaymentsSinglePage = PaymentsSinglePage; diff --git a/src/resources/index.ts b/src/resources/index.ts index 4e468947e..85c4c42db 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -7,7 +7,12 @@ export { Connect } from './connect/connect'; export { HRIS, type Income, type Location, type Money } from './hris/hris'; export { Jobs } from './jobs/jobs'; export { Payroll } from './payroll/payroll'; -export { ProvidersSinglePage, Providers, type Provider } from './providers'; +export { + ProviderListResponsesSinglePage, + Providers, + type Provider, + type ProviderListResponse, +} from './providers'; export { RequestForwarding, type RequestForwardingForwardResponse, diff --git a/src/resources/jobs/automated.ts b/src/resources/jobs/automated.ts index 4319848d5..9e7a3a0f4 100644 --- a/src/resources/jobs/automated.ts +++ b/src/resources/jobs/automated.ts @@ -31,21 +31,8 @@ export class Automated extends APIResource { /** * Get an automated job by `job_id`. */ - retrieve( - jobId: string, - query?: AutomatedRetrieveParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - retrieve(jobId: string, options?: Core.RequestOptions): Core.APIPromise; - retrieve( - jobId: string, - query: AutomatedRetrieveParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.retrieve(jobId, {}, query); - } - return this._client.get(`/jobs/automated/${jobId}`, { query, ...options }); + retrieve(jobId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.get(`/jobs/automated/${jobId}`, options); } /** @@ -222,23 +209,7 @@ export declare namespace AutomatedCreateParams { } } -export interface AutomatedRetrieveParams { - /** - * The entity ID to use when authenticating with a multi-account token. Required - * when using a multi-account token to specify which entity's data to access. - * Example: `123e4567-e89b-12d3-a456-426614174000` - */ - entity_id?: string; -} - export interface AutomatedListParams { - /** - * The entity ID to use when authenticating with a multi-account token. Required - * when using a multi-account token to specify which entity's data to access. - * Example: `123e4567-e89b-12d3-a456-426614174000` - */ - entity_id?: string; - /** * Number of items to return */ @@ -256,7 +227,6 @@ export declare namespace Automated { type AutomatedCreateResponse as AutomatedCreateResponse, type AutomatedListResponse as AutomatedListResponse, type AutomatedCreateParams as AutomatedCreateParams, - type AutomatedRetrieveParams as AutomatedRetrieveParams, type AutomatedListParams as AutomatedListParams, }; } diff --git a/src/resources/jobs/index.ts b/src/resources/jobs/index.ts index 748740813..fc96a5e7a 100644 --- a/src/resources/jobs/index.ts +++ b/src/resources/jobs/index.ts @@ -6,8 +6,7 @@ export { type AutomatedCreateResponse, type AutomatedListResponse, type AutomatedCreateParams, - type AutomatedRetrieveParams, type AutomatedListParams, } from './automated'; export { Jobs } from './jobs'; -export { Manual, type ManualAsyncJob, type ManualRetrieveParams } from './manual'; +export { Manual, type ManualAsyncJob } from './manual'; diff --git a/src/resources/jobs/jobs.ts b/src/resources/jobs/jobs.ts index 9fa138383..7cc64d285 100644 --- a/src/resources/jobs/jobs.ts +++ b/src/resources/jobs/jobs.ts @@ -9,10 +9,9 @@ import { AutomatedCreateResponse, AutomatedListParams, AutomatedListResponse, - AutomatedRetrieveParams, } from './automated'; import * as ManualAPI from './manual'; -import { Manual, ManualAsyncJob, ManualRetrieveParams } from './manual'; +import { Manual, ManualAsyncJob } from './manual'; export class Jobs extends APIResource { automated: AutomatedAPI.Automated = new AutomatedAPI.Automated(this._client); @@ -29,13 +28,8 @@ export declare namespace Jobs { type AutomatedCreateResponse as AutomatedCreateResponse, type AutomatedListResponse as AutomatedListResponse, type AutomatedCreateParams as AutomatedCreateParams, - type AutomatedRetrieveParams as AutomatedRetrieveParams, type AutomatedListParams as AutomatedListParams, }; - export { - Manual as Manual, - type ManualAsyncJob as ManualAsyncJob, - type ManualRetrieveParams as ManualRetrieveParams, - }; + export { Manual as Manual, type ManualAsyncJob as ManualAsyncJob }; } diff --git a/src/resources/jobs/manual.ts b/src/resources/jobs/manual.ts index c755ccae4..07f4b6d5c 100644 --- a/src/resources/jobs/manual.ts +++ b/src/resources/jobs/manual.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; import * as Core from '../../core'; export class Manual extends APIResource { @@ -9,21 +8,8 @@ export class Manual extends APIResource { * Get a manual job by `job_id`. Manual jobs are completed by a human and include * Assisted Benefits jobs. */ - retrieve( - jobId: string, - query?: ManualRetrieveParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - retrieve(jobId: string, options?: Core.RequestOptions): Core.APIPromise; - retrieve( - jobId: string, - query: ManualRetrieveParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.retrieve(jobId, {}, query); - } - return this._client.get(`/jobs/manual/${jobId}`, { query, ...options }); + retrieve(jobId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.get(`/jobs/manual/${jobId}`, options); } } @@ -38,15 +24,6 @@ export interface ManualAsyncJob { status: 'pending' | 'in_progress' | 'error' | 'complete'; } -export interface ManualRetrieveParams { - /** - * The entity ID to use when authenticating with a multi-account token. Required - * when using a multi-account token to specify which entity's data to access. - * Example: `123e4567-e89b-12d3-a456-426614174000` - */ - entity_id?: string; -} - export declare namespace Manual { - export { type ManualAsyncJob as ManualAsyncJob, type ManualRetrieveParams as ManualRetrieveParams }; + export { type ManualAsyncJob as ManualAsyncJob }; } diff --git a/src/resources/payroll/index.ts b/src/resources/payroll/index.ts index 84109074a..00580f179 100644 --- a/src/resources/payroll/index.ts +++ b/src/resources/payroll/index.ts @@ -5,6 +5,7 @@ export { PayGroups, type PayGroupRetrieveResponse, type PayGroupListResponse, + type PayGroupRetrieveParams, type PayGroupListParams, } from './pay-groups'; export { Payroll } from './payroll'; diff --git a/src/resources/payroll/pay-groups.ts b/src/resources/payroll/pay-groups.ts index 7d3213aba..c8704bf10 100644 --- a/src/resources/payroll/pay-groups.ts +++ b/src/resources/payroll/pay-groups.ts @@ -9,8 +9,21 @@ export class PayGroups extends APIResource { /** * Read information from a single pay group */ - retrieve(payGroupId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/employer/pay-groups/${payGroupId}`, options); + retrieve( + payGroupId: string, + query?: PayGroupRetrieveParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + retrieve(payGroupId: string, options?: Core.RequestOptions): Core.APIPromise; + retrieve( + payGroupId: string, + query: PayGroupRetrieveParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.retrieve(payGroupId, {}, query); + } + return this._client.get(`/employer/pay-groups/${payGroupId}`, { query, ...options }); } /** @@ -95,7 +108,19 @@ export interface PayGroupListResponse { >; } +export interface PayGroupRetrieveParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; +} + export interface PayGroupListParams { + /** + * The entity IDs to specify which entities' data to access. + */ + entity_ids?: Array; + individual_id?: string; pay_frequencies?: Array; @@ -108,6 +133,7 @@ export declare namespace PayGroups { type PayGroupRetrieveResponse as PayGroupRetrieveResponse, type PayGroupListResponse as PayGroupListResponse, PayGroupListResponsesSinglePage as PayGroupListResponsesSinglePage, + type PayGroupRetrieveParams as PayGroupRetrieveParams, type PayGroupListParams as PayGroupListParams, }; } diff --git a/src/resources/payroll/payroll.ts b/src/resources/payroll/payroll.ts index 8d2136563..fbb7c3e46 100644 --- a/src/resources/payroll/payroll.ts +++ b/src/resources/payroll/payroll.ts @@ -6,6 +6,7 @@ import { PayGroupListParams, PayGroupListResponse, PayGroupListResponsesSinglePage, + PayGroupRetrieveParams, PayGroupRetrieveResponse, PayGroups, } from './pay-groups'; @@ -23,6 +24,7 @@ export declare namespace Payroll { type PayGroupRetrieveResponse as PayGroupRetrieveResponse, type PayGroupListResponse as PayGroupListResponse, PayGroupListResponsesSinglePage as PayGroupListResponsesSinglePage, + type PayGroupRetrieveParams as PayGroupRetrieveParams, type PayGroupListParams as PayGroupListParams, }; } diff --git a/src/resources/providers.ts b/src/resources/providers.ts index 4a5157081..175f23aa5 100644 --- a/src/resources/providers.ts +++ b/src/resources/providers.ts @@ -2,40 +2,46 @@ import { APIResource } from '../resource'; import * as Core from '../core'; -import * as BenefitsAPI from './hris/benefits/benefits'; import { SinglePage } from '../pagination'; export class Providers extends APIResource { /** * Return details on all available payroll and HR systems. */ - list(options?: Core.RequestOptions): Core.PagePromise { - return this._client.getAPIList('/providers', ProvidersSinglePage, options); + list( + options?: Core.RequestOptions, + ): Core.PagePromise { + return this._client.getAPIList('/providers', ProviderListResponsesSinglePage, options); } } -export class ProvidersSinglePage extends SinglePage {} +export class ProviderListResponsesSinglePage extends SinglePage {} export interface Provider { /** * The id of the payroll provider used in Connect. */ - id?: string; + id: string; /** - * The list of authentication methods supported by the provider. + * The display name of the payroll provider. */ - authentication_methods?: Array; + display_name: string; /** - * `true` if the integration is in a beta state, `false` otherwise + * The list of Finch products supported on this payroll provider. */ - beta?: boolean; + products: Array; /** - * The display name of the payroll provider. + * The authentication methods supported by the provider. */ - display_name?: string; + authentication_methods?: Array; + + /** + * `true` if the integration is in a beta state, `false` otherwise + */ + beta?: boolean; /** * The url to the official icon of the payroll provider. @@ -48,9 +54,9 @@ export interface Provider { logo?: string; /** - * [DEPRECATED] Whether the Finch integration with this provider uses the Assisted - * Connect Flow by default. This field is now deprecated. Please check for a `type` - * of `assisted` in the `authentication_methods` field instead. + * @deprecated [DEPRECATED] Whether the Finch integration with this provider uses + * the Assisted Connect Flow by default. This field is now deprecated. Please check + * for a `type` of `assisted` in the `authentication_methods` field instead. */ manual?: boolean; @@ -63,414 +69,106 @@ export interface Provider { * The hex code for the primary color of the payroll provider. */ primary_color?: string; - - /** - * The list of Finch products supported on this payroll provider. - */ - products?: Array; } export namespace Provider { export interface AuthenticationMethod { /** - * Each benefit type and their supported features. If the benefit type is not - * supported, the property will be null + * The type of authentication method */ - benefits_support?: BenefitsAPI.BenefitsSupport | null; + type: 'assisted' | 'credential' | 'api_token' | 'api_credential' | 'oauth' | 'api'; /** - * The supported data fields returned by our HR and payroll endpoints + * The supported benefit types and their configurations */ - supported_fields?: AuthenticationMethod.SupportedFields | null; + benefits_support?: { [key: string]: unknown }; /** - * The type of authentication method. + * The supported fields for each Finch product */ - type?: 'assisted' | 'credential' | 'api_token' | 'api_credential' | 'oauth'; + supported_fields?: { [key: string]: unknown }; } +} - export namespace AuthenticationMethod { - /** - * The supported data fields returned by our HR and payroll endpoints - */ - export interface SupportedFields { - company?: SupportedFields.Company; - - directory?: SupportedFields.Directory; - - employment?: SupportedFields.Employment; - - individual?: SupportedFields.Individual; - - pay_group?: SupportedFields.PayGroup; - - pay_statement?: SupportedFields.PayStatement; - - payment?: SupportedFields.Payment; - } - - export namespace SupportedFields { - export interface Company { - id?: boolean; - - accounts?: Company.Accounts; - - departments?: Company.Departments; - - ein?: boolean; - - entity?: Company.Entity; - - legal_name?: boolean; - - locations?: Company.Locations; - - primary_email?: boolean; - - primary_phone_number?: boolean; - } - - export namespace Company { - export interface Accounts { - account_name?: boolean; - - account_number?: boolean; - - account_type?: boolean; - - institution_name?: boolean; - - routing_number?: boolean; - } - - export interface Departments { - name?: boolean; - - parent?: Departments.Parent; - } - - export namespace Departments { - export interface Parent { - name?: boolean; - } - } - - export interface Entity { - subtype?: boolean; - - type?: boolean; - } - - export interface Locations { - city?: boolean; - - country?: boolean; - - line1?: boolean; - - line2?: boolean; - - postal_code?: boolean; - - state?: boolean; - } - } - - export interface Directory { - individuals?: Directory.Individuals; - - paging?: Directory.Paging; - } - - export namespace Directory { - export interface Individuals { - id?: boolean; - - department?: boolean; - - first_name?: boolean; - - is_active?: boolean; - - last_name?: boolean; - - manager?: Individuals.Manager; - - middle_name?: boolean; - } - - export namespace Individuals { - export interface Manager { - id?: boolean; - } - } - - export interface Paging { - count?: boolean; - - offset?: boolean; - } - } - - export interface Employment { - id?: boolean; - - class_code?: boolean; - - custom_fields?: boolean; - - department?: Employment.Department; - - employment?: Employment.Employment; - - employment_status?: boolean; - - end_date?: boolean; - - first_name?: boolean; - - income?: Employment.Income; - - income_history?: boolean; - - is_active?: boolean; - - last_name?: boolean; - - location?: Employment.Location; - - manager?: Employment.Manager; - - middle_name?: boolean; - - start_date?: boolean; - - title?: boolean; - } - - export namespace Employment { - export interface Department { - name?: boolean; - } - - export interface Employment { - subtype?: boolean; - - type?: boolean; - } - - export interface Income { - amount?: boolean; - - currency?: boolean; - - unit?: boolean; - } - - export interface Location { - city?: boolean; - - country?: boolean; - - line1?: boolean; - - line2?: boolean; - - postal_code?: boolean; - - state?: boolean; - } - - export interface Manager { - id?: boolean; - } - } - - export interface Individual { - id?: boolean; - - dob?: boolean; - - emails?: Individual.Emails; - - encrypted_ssn?: boolean; - - ethnicity?: boolean; - - first_name?: boolean; - - gender?: boolean; - - last_name?: boolean; - - middle_name?: boolean; - - phone_numbers?: Individual.PhoneNumbers; - - preferred_name?: boolean; - - residence?: Individual.Residence; - - ssn?: boolean; - } - - export namespace Individual { - export interface Emails { - data?: boolean; - - type?: boolean; - } - - export interface PhoneNumbers { - data?: boolean; - - type?: boolean; - } - - export interface Residence { - city?: boolean; - - country?: boolean; - - line1?: boolean; - - line2?: boolean; - - postal_code?: boolean; - - state?: boolean; - } - } - - export interface PayGroup { - id?: boolean; - - individual_ids?: boolean; - - name?: boolean; - - pay_frequencies?: boolean; - } - - export interface PayStatement { - paging?: PayStatement.Paging; - - pay_statements?: PayStatement.PayStatements; - } - - export namespace PayStatement { - export interface Paging { - count: boolean; - - offset: boolean; - } - - export interface PayStatements { - earnings?: PayStatements.Earnings; - - employee_deductions?: PayStatements.EmployeeDeductions; - - employer_contributions?: PayStatements.EmployerContributions; - - gross_pay?: boolean; - - individual_id?: boolean; - - net_pay?: boolean; - - payment_method?: boolean; - - taxes?: PayStatements.Taxes; - - total_hours?: boolean; - - type?: boolean; - } - - export namespace PayStatements { - export interface Earnings { - amount?: boolean; - - currency?: boolean; - - name?: boolean; - - type?: boolean; - } - - export interface EmployeeDeductions { - amount?: boolean; - - currency?: boolean; - - name?: boolean; - - pre_tax?: boolean; - - type?: boolean; - } - - export interface EmployerContributions { - amount?: boolean; - - currency?: boolean; - - name?: boolean; - } - - export interface Taxes { - amount?: boolean; - - currency?: boolean; - - employer?: boolean; - - name?: boolean; - - type?: boolean; - } - } - } - - export interface Payment { - id?: boolean; - - company_debit?: boolean; +export interface ProviderListResponse { + /** + * The id of the payroll provider used in Connect. + */ + id: string; - debit_date?: boolean; + /** + * The display name of the payroll provider. + */ + display_name: string; - employee_taxes?: boolean; + /** + * The list of Finch products supported on this payroll provider. + */ + products: Array; - employer_taxes?: boolean; + /** + * The authentication methods supported by the provider. + */ + authentication_methods?: Array; - gross_pay?: boolean; + /** + * `true` if the integration is in a beta state, `false` otherwise + */ + beta?: boolean; - individual_ids?: boolean; + /** + * The url to the official icon of the payroll provider. + */ + icon?: string; - net_pay?: boolean; + /** + * The url to the official logo of the payroll provider. + */ + logo?: string; - pay_date?: boolean; + /** + * @deprecated [DEPRECATED] Whether the Finch integration with this provider uses + * the Assisted Connect Flow by default. This field is now deprecated. Please check + * for a `type` of `assisted` in the `authentication_methods` field instead. + */ + manual?: boolean; - pay_frequencies?: boolean; + /** + * whether MFA is required for the provider. + */ + mfa_required?: boolean; - pay_group_ids?: boolean; + /** + * The hex code for the primary color of the payroll provider. + */ + primary_color?: string; +} - pay_period?: Payment.PayPeriod; - } +export namespace ProviderListResponse { + export interface AuthenticationMethod { + /** + * The type of authentication method + */ + type: 'assisted' | 'credential' | 'api_token' | 'api_credential' | 'oauth' | 'api'; - export namespace Payment { - export interface PayPeriod { - end_date?: boolean; + /** + * The supported benefit types and their configurations + */ + benefits_support?: { [key: string]: unknown }; - start_date?: boolean; - } - } - } + /** + * The supported fields for each Finch product + */ + supported_fields?: { [key: string]: unknown }; } } -Providers.ProvidersSinglePage = ProvidersSinglePage; +Providers.ProviderListResponsesSinglePage = ProviderListResponsesSinglePage; export declare namespace Providers { - export { type Provider as Provider, ProvidersSinglePage as ProvidersSinglePage }; + export { + type Provider as Provider, + type ProviderListResponse as ProviderListResponse, + ProviderListResponsesSinglePage as ProviderListResponsesSinglePage, + }; } diff --git a/src/resources/request-forwarding.ts b/src/resources/request-forwarding.ts index 32dcb5a00..6bc5fcbf5 100644 --- a/src/resources/request-forwarding.ts +++ b/src/resources/request-forwarding.ts @@ -9,16 +9,6 @@ export class RequestForwarding extends APIResource { * Finch's unified API doesn't have a data model that cleanly fits your needs, then * Forward allows you to push or pull data models directly against an integration's * API. - * - * @example - * ```ts - * const response = await client.requestForwarding.forward({ - * method: 'POST', - * route: '/people/search', - * headers: { 'content-type': 'application/json' }, - * params: { showInactive: true, humanReadable: true }, - * }); - * ``` */ forward( body: RequestForwardingForwardParams, @@ -29,19 +19,6 @@ export class RequestForwarding extends APIResource { } export interface RequestForwardingForwardResponse { - /** - * A string representation of the HTTP response body of the forwarded request's - * response received from the underlying integration's API. This field may be null - * in the case where the upstream system's response is empty. - */ - data: string | null; - - /** - * The HTTP headers of the forwarded request's response, exactly as received from - * the underlying integration's API. - */ - headers: unknown | null; - /** * An object containing details of your original forwarded request, for your ease * of reference. @@ -53,6 +30,19 @@ export interface RequestForwardingForwardResponse { * the underlying integration's API. This value will be returned as an integer. */ statusCode: number; + + /** + * A string representation of the HTTP response body of the forwarded request's + * response received from the underlying integration's API. This field may be null + * in the case where the upstream system's response is empty. + */ + data?: string | null; + + /** + * The HTTP headers of the forwarded request's response, exactly as received from + * the underlying integration's API. + */ + headers?: { [key: string]: unknown } | null; } export namespace RequestForwardingForwardResponse { @@ -62,34 +52,30 @@ export namespace RequestForwardingForwardResponse { */ export interface Request { /** - * The body that was specified for the forwarded request. If a value was not - * specified in the original request, this value will be returned as null ; - * otherwise, this value will always be returned as a string. + * The HTTP method that was specified for the forwarded request. Valid values + * include: `GET` , `POST` , `PUT` , `DELETE` , and `PATCH`. */ - data: string | null; + method: string; /** - * The specified HTTP headers that were included in the forwarded request. If no - * headers were specified, this will be returned as `null`. + * The URL route path that was specified for the forwarded request. */ - headers: unknown | null; + route: string; /** - * The HTTP method that was specified for the forwarded request. Valid values - * include: `GET` , `POST` , `PUT` , `DELETE` , and `PATCH`. + * The body that was specified for the forwarded request. */ - method: string; + data?: string | { [key: string]: unknown } | null; /** - * The query parameters that were included in the forwarded request. If no query - * parameters were specified, this will be returned as `null`. + * The HTTP headers that were specified for the forwarded request. */ - params: unknown | null; + headers?: { [key: string]: unknown } | null; /** - * The URL route path that was specified for the forwarded request. + * The query parameters that were specified for the forwarded request. */ - route: string; + params?: { [key: string]: unknown } | null; } } @@ -118,13 +104,13 @@ export interface RequestForwardingForwardParams { * specified as an object of key-value pairs. Example: * `{"Content-Type": "application/xml", "X-API-Version": "v1" }` */ - headers?: unknown | null; + headers?: { [key: string]: unknown } | null; /** * The query parameters for the forwarded request. This value must be specified as * a valid JSON object rather than a query string. */ - params?: unknown | null; + params?: { [key: string]: unknown } | null; } export declare namespace RequestForwarding { diff --git a/src/version.ts b/src/version.ts index b381c68ff..1422fd54f 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '6.37.0'; // x-release-please-version +export const VERSION = '6.38.0'; // x-release-please-version diff --git a/tests/api-resources/access-tokens.test.ts b/tests/api-resources/access-tokens.test.ts index b268d5540..fe0433de7 100644 --- a/tests/api-resources/access-tokens.test.ts +++ b/tests/api-resources/access-tokens.test.ts @@ -12,11 +12,7 @@ const client = new Finch({ describe('resource accessTokens', () => { test('create: only required params', async () => { - const responsePromise = client.accessTokens.create({ - client_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - client_secret: 'client_secret', - code: 'code', - }); + const responsePromise = client.accessTokens.create({ code: 'code' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -28,9 +24,9 @@ describe('resource accessTokens', () => { test('create: required and optional params', async () => { const response = await client.accessTokens.create({ + code: 'code', client_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', client_secret: 'client_secret', - code: 'code', redirect_uri: 'redirect_uri', }); }); diff --git a/tests/api-resources/connect/sessions.test.ts b/tests/api-resources/connect/sessions.test.ts index 167db5d33..d66e242d2 100644 --- a/tests/api-resources/connect/sessions.test.ts +++ b/tests/api-resources/connect/sessions.test.ts @@ -12,9 +12,15 @@ describe('resource sessions', () => { // prism tests are broken test.skip('new: only required params', async () => { const responsePromise = client.connect.sessions.new({ + customer_email: 'dev@stainless.com', customer_id: 'x', customer_name: 'x', - products: ['company'], + integration: { auth_method: 'assisted', provider: 'provider' }, + manual: true, + minutes_to_expire: 1, + products: ['benefits'], + redirect_uri: 'redirect_uri', + sandbox: 'finch', }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -28,13 +34,13 @@ describe('resource sessions', () => { // prism tests are broken test.skip('new: required and optional params', async () => { const response = await client.connect.sessions.new({ + customer_email: 'dev@stainless.com', customer_id: 'x', customer_name: 'x', - products: ['company'], - customer_email: 'dev@stainless.com', integration: { auth_method: 'assisted', provider: 'provider' }, manual: true, minutes_to_expire: 1, + products: ['benefits'], redirect_uri: 'redirect_uri', sandbox: 'finch', }); @@ -42,7 +48,12 @@ describe('resource sessions', () => { // prism tests are broken test.skip('reauthenticate: only required params', async () => { - const responsePromise = client.connect.sessions.reauthenticate({ connection_id: 'connection_id' }); + const responsePromise = client.connect.sessions.reauthenticate({ + connection_id: 'connection_id', + minutes_to_expire: 0, + products: ['benefits'], + redirect_uri: 'https://example.com', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -57,7 +68,7 @@ describe('resource sessions', () => { const response = await client.connect.sessions.reauthenticate({ connection_id: 'connection_id', minutes_to_expire: 0, - products: ['company'], + products: ['benefits'], redirect_uri: 'https://example.com', }); }); diff --git a/tests/api-resources/hris/benefits/benefits.test.ts b/tests/api-resources/hris/benefits/benefits.test.ts index 1abae5b15..f58ceb111 100644 --- a/tests/api-resources/hris/benefits/benefits.test.ts +++ b/tests/api-resources/hris/benefits/benefits.test.ts @@ -32,6 +32,7 @@ describe('resource benefits', () => { await expect( client.hris.benefits.create( { + entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], company_contribution: { tiers: [{ match: 1, threshold: 1 }], type: 'match' }, description: 'description', frequency: 'every_paycheck', @@ -60,6 +61,17 @@ describe('resource benefits', () => { ).rejects.toThrow(Finch.NotFoundError); }); + test('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( + client.hris.benefits.retrieve( + 'benefit_id', + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Finch.NotFoundError); + }); + test('update', async () => { const responsePromise = client.hris.benefits.update('benefit_id'); const rawResponse = await responsePromise.asResponse(); @@ -83,7 +95,7 @@ describe('resource benefits', () => { await expect( client.hris.benefits.update( 'benefit_id', - { description: 'description' }, + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], description: 'description' }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Finch.NotFoundError); @@ -107,6 +119,16 @@ describe('resource benefits', () => { ); }); + test('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( + client.hris.benefits.list( + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Finch.NotFoundError); + }); + test('listSupportedBenefits', async () => { const responsePromise = client.hris.benefits.listSupportedBenefits(); const rawResponse = await responsePromise.asResponse(); @@ -124,4 +146,14 @@ describe('resource benefits', () => { client.hris.benefits.listSupportedBenefits({ path: '/_stainless_unknown_path' }), ).rejects.toThrow(Finch.NotFoundError); }); + + test('listSupportedBenefits: 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( + client.hris.benefits.listSupportedBenefits( + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Finch.NotFoundError); + }); }); diff --git a/tests/api-resources/hris/benefits/individuals.test.ts b/tests/api-resources/hris/benefits/individuals.test.ts index 1b201e27f..22c98808c 100644 --- a/tests/api-resources/hris/benefits/individuals.test.ts +++ b/tests/api-resources/hris/benefits/individuals.test.ts @@ -32,19 +32,22 @@ describe('resource individuals', () => { await expect( client.hris.benefits.individuals.enrollMany( 'benefit_id', - [ - { - configuration: { - annual_contribution_limit: 'individual', - annual_maximum: null, - catch_up: true, - company_contribution: { amount: 0, type: 'fixed' }, - effective_date: '2019-12-27', - employee_deduction: { amount: 10000, type: 'fixed' }, + { + entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], + individuals: [ + { + configuration: { + annual_contribution_limit: 'individual', + annual_maximum: null, + catch_up: true, + company_contribution: { amount: 0, tiers: [{ match: 0, threshold: 0 }], type: 'fixed' }, + effective_date: '2019-12-27', + employee_deduction: { amount: 10000, type: 'fixed' }, + }, + individual_id: 'd02a6346-1f08-4312-a064-49ff3cafaa7a', }, - individual_id: 'd02a6346-1f08-4312-a064-49ff3cafaa7a', - }, - ], + ], + }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Finch.NotFoundError); @@ -68,6 +71,17 @@ describe('resource individuals', () => { ).rejects.toThrow(Finch.NotFoundError); }); + test('enrolledIds: 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( + client.hris.benefits.individuals.enrolledIds( + 'benefit_id', + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Finch.NotFoundError); + }); + test('retrieveManyBenefits', async () => { const responsePromise = client.hris.benefits.individuals.retrieveManyBenefits('benefit_id'); const rawResponse = await responsePromise.asResponse(); @@ -93,7 +107,10 @@ describe('resource individuals', () => { await expect( client.hris.benefits.individuals.retrieveManyBenefits( 'benefit_id', - { individual_ids: 'd675d2b7-6d7b-41a8-b2d3-001eb3fb88f6,d02a6346-1f08-4312-a064-49ff3cafaa7a' }, + { + entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], + individual_ids: 'd675d2b7-6d7b-41a8-b2d3-001eb3fb88f6,d02a6346-1f08-4312-a064-49ff3cafaa7a', + }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Finch.NotFoundError); @@ -122,7 +139,7 @@ describe('resource individuals', () => { await expect( client.hris.benefits.individuals.unenrollMany( 'benefit_id', - { individual_ids: ['string'] }, + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], individual_ids: ['string'] }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Finch.NotFoundError); diff --git a/tests/api-resources/hris/company/company.test.ts b/tests/api-resources/hris/company/company.test.ts index 873c0d732..38e056de3 100644 --- a/tests/api-resources/hris/company/company.test.ts +++ b/tests/api-resources/hris/company/company.test.ts @@ -26,4 +26,14 @@ describe('resource company', () => { Finch.NotFoundError, ); }); + + test('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( + client.hris.company.retrieve( + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Finch.NotFoundError); + }); }); diff --git a/tests/api-resources/hris/company/pay-statement-item/pay-statement-item.test.ts b/tests/api-resources/hris/company/pay-statement-item/pay-statement-item.test.ts index cf15959a9..839efc54f 100644 --- a/tests/api-resources/hris/company/pay-statement-item/pay-statement-item.test.ts +++ b/tests/api-resources/hris/company/pay-statement-item/pay-statement-item.test.ts @@ -34,6 +34,7 @@ describe('resource payStatementItem', () => { { categories: ['earnings'], end_date: '2024-07-01', + entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], name: 'name', start_date: '2024-01-01', type: 'base_compensation', diff --git a/tests/api-resources/hris/company/pay-statement-item/rules.test.ts b/tests/api-resources/hris/company/pay-statement-item/rules.test.ts index 9caa3cbfb..1c171c20d 100644 --- a/tests/api-resources/hris/company/pay-statement-item/rules.test.ts +++ b/tests/api-resources/hris/company/pay-statement-item/rules.test.ts @@ -32,6 +32,7 @@ describe('resource rules', () => { await expect( client.hris.company.payStatementItem.rules.create( { + entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], attributes: { metadata: { foo: 'bar' } }, conditions: [{ field: 'field', operator: 'equals', value: 'value' }], effective_end_date: 'effective_end_date', @@ -66,7 +67,7 @@ describe('resource rules', () => { await expect( client.hris.company.payStatementItem.rules.update( 'rule_id', - { optionalProperty: {} }, + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], optionalProperty: {} }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Finch.NotFoundError); @@ -90,6 +91,16 @@ describe('resource rules', () => { ).rejects.toThrow(Finch.NotFoundError); }); + test('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( + client.hris.company.payStatementItem.rules.list( + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Finch.NotFoundError); + }); + test('delete', async () => { const responsePromise = client.hris.company.payStatementItem.rules.delete('rule_id'); const rawResponse = await responsePromise.asResponse(); @@ -107,4 +118,15 @@ describe('resource rules', () => { client.hris.company.payStatementItem.rules.delete('rule_id', { path: '/_stainless_unknown_path' }), ).rejects.toThrow(Finch.NotFoundError); }); + + test('delete: 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( + client.hris.company.payStatementItem.rules.delete( + 'rule_id', + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Finch.NotFoundError); + }); }); diff --git a/tests/api-resources/hris/directory.test.ts b/tests/api-resources/hris/directory.test.ts index 94a9bfe89..045deca15 100644 --- a/tests/api-resources/hris/directory.test.ts +++ b/tests/api-resources/hris/directory.test.ts @@ -30,7 +30,10 @@ describe('resource directory', () => { test('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( - client.hris.directory.list({ limit: 0, offset: 0 }, { path: '/_stainless_unknown_path' }), + client.hris.directory.list( + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], limit: 0, offset: 0 }, + { path: '/_stainless_unknown_path' }, + ), ).rejects.toThrow(Finch.NotFoundError); }); @@ -55,7 +58,10 @@ describe('resource directory', () => { test('listIndividuals: 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( - client.hris.directory.listIndividuals({ limit: 0, offset: 0 }, { path: '/_stainless_unknown_path' }), + client.hris.directory.listIndividuals( + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], limit: 0, offset: 0 }, + { path: '/_stainless_unknown_path' }, + ), ).rejects.toThrow(Finch.NotFoundError); }); }); diff --git a/tests/api-resources/hris/documents.test.ts b/tests/api-resources/hris/documents.test.ts index fb2db168f..b17cf3457 100644 --- a/tests/api-resources/hris/documents.test.ts +++ b/tests/api-resources/hris/documents.test.ts @@ -31,7 +31,13 @@ describe('resource documents', () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( client.hris.documents.list( - { individual_ids: ['string'], limit: 0, offset: 0, types: ['w4_2020'] }, + { + entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], + individual_ids: ['string'], + limit: 0, + offset: 0, + types: ['w4_2020'], + }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Finch.NotFoundError); @@ -54,4 +60,15 @@ describe('resource documents', () => { client.hris.documents.retreive('document_id', { path: '/_stainless_unknown_path' }), ).rejects.toThrow(Finch.NotFoundError); }); + + test('retreive: 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( + client.hris.documents.retreive( + 'document_id', + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Finch.NotFoundError); + }); }); diff --git a/tests/api-resources/hris/employments.test.ts b/tests/api-resources/hris/employments.test.ts index 30b517207..c264064ee 100644 --- a/tests/api-resources/hris/employments.test.ts +++ b/tests/api-resources/hris/employments.test.ts @@ -25,6 +25,7 @@ describe('resource employments', () => { test('retrieveMany: required and optional params', async () => { const response = await client.hris.employments.retrieveMany({ requests: [{ individual_id: 'individual_id' }], + entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], }); }); }); diff --git a/tests/api-resources/hris/individuals.test.ts b/tests/api-resources/hris/individuals.test.ts index 8adf1d9de..8aa5239bd 100644 --- a/tests/api-resources/hris/individuals.test.ts +++ b/tests/api-resources/hris/individuals.test.ts @@ -31,7 +31,11 @@ describe('resource individuals', () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( client.hris.individuals.retrieveMany( - { options: { include: ['string'] }, requests: [{ individual_id: 'individual_id' }] }, + { + entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], + options: { include: ['string'] }, + requests: [{ individual_id: 'individual_id' }], + }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Finch.NotFoundError); diff --git a/tests/api-resources/hris/pay-statements.test.ts b/tests/api-resources/hris/pay-statements.test.ts index 55daa48e8..03de31636 100644 --- a/tests/api-resources/hris/pay-statements.test.ts +++ b/tests/api-resources/hris/pay-statements.test.ts @@ -25,6 +25,7 @@ describe('resource payStatements', () => { test('retrieveMany: required and optional params', async () => { const response = await client.hris.payStatements.retrieveMany({ requests: [{ payment_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', limit: 50, offset: 0 }], + entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], }); }); }); diff --git a/tests/api-resources/hris/payments.test.ts b/tests/api-resources/hris/payments.test.ts index 7e0fea0b4..f083b49c7 100644 --- a/tests/api-resources/hris/payments.test.ts +++ b/tests/api-resources/hris/payments.test.ts @@ -21,6 +21,10 @@ describe('resource payments', () => { }); test('list: required and optional params', async () => { - const response = await client.hris.payments.list({ end_date: '2021-01-01', start_date: '2021-01-01' }); + const response = await client.hris.payments.list({ + end_date: '2021-01-01', + start_date: '2021-01-01', + entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], + }); }); }); diff --git a/tests/api-resources/jobs/automated.test.ts b/tests/api-resources/jobs/automated.test.ts index 2b844248e..a199923fd 100644 --- a/tests/api-resources/jobs/automated.test.ts +++ b/tests/api-resources/jobs/automated.test.ts @@ -42,17 +42,6 @@ describe('resource automated', () => { ).rejects.toThrow(Finch.NotFoundError); }); - test('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( - client.jobs.automated.retrieve( - 'job_id', - { entity_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Finch.NotFoundError); - }); - test('list', async () => { const responsePromise = client.jobs.automated.list(); const rawResponse = await responsePromise.asResponse(); @@ -74,10 +63,7 @@ describe('resource automated', () => { test('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( - client.jobs.automated.list( - { entity_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', limit: 0, offset: 0 }, - { path: '/_stainless_unknown_path' }, - ), + client.jobs.automated.list({ limit: 0, offset: 0 }, { path: '/_stainless_unknown_path' }), ).rejects.toThrow(Finch.NotFoundError); }); }); diff --git a/tests/api-resources/jobs/manual.test.ts b/tests/api-resources/jobs/manual.test.ts index 04ff1d5e3..c19129280 100644 --- a/tests/api-resources/jobs/manual.test.ts +++ b/tests/api-resources/jobs/manual.test.ts @@ -26,15 +26,4 @@ describe('resource manual', () => { Finch.NotFoundError, ); }); - - test('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( - client.jobs.manual.retrieve( - 'job_id', - { entity_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Finch.NotFoundError); - }); }); diff --git a/tests/api-resources/payroll/pay-groups.test.ts b/tests/api-resources/payroll/pay-groups.test.ts index a1788256e..b42df448b 100644 --- a/tests/api-resources/payroll/pay-groups.test.ts +++ b/tests/api-resources/payroll/pay-groups.test.ts @@ -27,6 +27,17 @@ describe('resource payGroups', () => { ).rejects.toThrow(Finch.NotFoundError); }); + test('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( + client.payroll.payGroups.retrieve( + 'pay_group_id', + { entity_ids: ['550e8400-e29b-41d4-a716-446655440000'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Finch.NotFoundError); + }); + test('list', async () => { const responsePromise = client.payroll.payGroups.list(); const rawResponse = await responsePromise.asResponse(); @@ -49,7 +60,11 @@ describe('resource payGroups', () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( client.payroll.payGroups.list( - { individual_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', pay_frequencies: ['string'] }, + { + entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], + individual_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + pay_frequencies: ['string'], + }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Finch.NotFoundError); diff --git a/tests/api-resources/request-forwarding.test.ts b/tests/api-resources/request-forwarding.test.ts index 69f7077f1..cdc8b7143 100644 --- a/tests/api-resources/request-forwarding.test.ts +++ b/tests/api-resources/request-forwarding.test.ts @@ -10,7 +10,7 @@ const client = new Finch({ describe('resource requestForwarding', () => { test('forward: only required params', async () => { - const responsePromise = client.requestForwarding.forward({ method: 'POST', route: '/people/search' }); + const responsePromise = client.requestForwarding.forward({ method: 'method', route: 'route' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -22,11 +22,11 @@ describe('resource requestForwarding', () => { test('forward: required and optional params', async () => { const response = await client.requestForwarding.forward({ - method: 'POST', - route: '/people/search', - data: null, - headers: { 'content-type': 'application/json' }, - params: { showInactive: true, humanReadable: true }, + method: 'method', + route: 'route', + data: 'data', + headers: { foo: 'bar' }, + params: { foo: 'bar' }, }); }); }); diff --git a/tsconfig.build.json b/tsconfig.build.json index 4549f6d24..b5b9724dc 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -5,8 +5,8 @@ "compilerOptions": { "rootDir": "./dist/src", "paths": { - "@tryfinch/finch-api/*": ["dist/src/*"], - "@tryfinch/finch-api": ["dist/src/index.ts"], + "@tryfinch/finch-api/*": ["./dist/src/*"], + "@tryfinch/finch-api": ["./dist/src/index.ts"] }, "noEmit": false, "declaration": true, diff --git a/tsconfig.json b/tsconfig.json index 147097804..6f28db23d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,11 +7,10 @@ "module": "commonjs", "moduleResolution": "node", "esModuleInterop": true, - "baseUrl": "./", "paths": { - "@tryfinch/finch-api/_shims/auto/*": ["src/_shims/auto/*-node"], - "@tryfinch/finch-api/*": ["src/*"], - "@tryfinch/finch-api": ["src/index.ts"] + "@tryfinch/finch-api/_shims/auto/*": ["./src/_shims/auto/*-node"], + "@tryfinch/finch-api/*": ["./src/*"], + "@tryfinch/finch-api": ["./src/index.ts"] }, "noEmit": true, @@ -32,7 +31,7 @@ "noUncheckedIndexedAccess": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, - "isolatedModules": false, + "isolatedModules": false, "skipLibCheck": true }