@tryfinch/finch-api-mcp 6.26.0 → 6.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -1
- package/compat.d.mts +52 -0
- package/compat.d.mts.map +1 -0
- package/compat.d.ts +52 -0
- package/compat.d.ts.map +1 -0
- package/compat.js +342 -0
- package/compat.js.map +1 -0
- package/compat.mjs +332 -0
- package/compat.mjs.map +1 -0
- package/compat.test.d.mts +2 -0
- package/compat.test.d.mts.map +1 -0
- package/compat.test.d.ts +2 -0
- package/compat.test.d.ts.map +1 -0
- package/compat.test.js +950 -0
- package/compat.test.js.map +1 -0
- package/compat.test.mjs +948 -0
- package/compat.test.mjs.map +1 -0
- package/index.js +37 -110
- package/index.js.map +1 -1
- package/index.mjs +37 -107
- package/index.mjs.map +1 -1
- package/options.d.mts +9 -0
- package/options.d.mts.map +1 -0
- package/options.d.ts +9 -0
- package/options.d.ts.map +1 -0
- package/options.js +320 -0
- package/options.js.map +1 -0
- package/options.mjs +314 -0
- package/options.mjs.map +1 -0
- package/options.test.d.mts +2 -0
- package/options.test.d.mts.map +1 -0
- package/options.test.d.ts +2 -0
- package/options.test.d.ts.map +1 -0
- package/options.test.js +154 -0
- package/options.test.js.map +1 -0
- package/options.test.mjs +152 -0
- package/options.test.mjs.map +1 -0
- package/package.json +2 -2
- package/server.d.mts +3 -1
- package/server.d.mts.map +1 -1
- package/server.d.ts +3 -1
- package/server.d.ts.map +1 -1
- package/server.js +15 -11
- package/server.js.map +1 -1
- package/server.mjs +12 -8
- package/server.mjs.map +1 -1
- package/src/compat.test.ts +1068 -0
- package/src/compat.ts +429 -0
- package/src/index.ts +38 -122
- package/src/options.test.ts +193 -0
- package/src/options.ts +339 -0
- package/src/server.ts +15 -10
- package/src/tools/access-tokens/create-access-tokens.ts +2 -2
- package/src/tools/account/disconnect-account.ts +1 -2
- package/src/tools/account/introspect-account.ts +1 -2
- package/src/tools/connect/sessions/new-connect-sessions.ts +2 -2
- package/src/tools/connect/sessions/reauthenticate-connect-sessions.ts +2 -2
- package/src/tools/hris/benefits/create-hris-benefits.ts +38 -3
- package/src/tools/hris/benefits/individuals/enroll-many-benefits-hris-individuals.ts +2 -2
- package/src/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.ts +2 -2
- package/src/tools/hris/benefits/individuals/retrieve-many-benefits-benefits-hris-individuals.ts +2 -2
- package/src/tools/hris/benefits/individuals/unenroll-many-benefits-hris-individuals.ts +2 -2
- package/src/tools/hris/benefits/list-hris-benefits.ts +1 -2
- package/src/tools/hris/benefits/list-supported-benefits-hris-benefits.ts +1 -2
- package/src/tools/hris/benefits/retrieve-hris-benefits.ts +2 -2
- package/src/tools/hris/benefits/update-hris-benefits.ts +2 -2
- package/src/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.ts +2 -2
- package/src/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.ts +2 -2
- package/src/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.ts +2 -2
- package/src/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.ts +1 -2
- package/src/tools/hris/company/pay-statement-item/rules/update-pay-statement-item-company-hris-rules.ts +2 -2
- package/src/tools/hris/company/retrieve-hris-company.ts +1 -2
- package/src/tools/hris/directory/list-hris-directory.ts +2 -2
- package/src/tools/hris/directory/list-individuals-hris-directory.ts +2 -2
- package/src/tools/hris/documents/list-hris-documents.ts +2 -2
- package/src/tools/hris/documents/retreive-hris-documents.ts +2 -2
- package/src/tools/hris/employments/retrieve-many-hris-employments.ts +2 -2
- package/src/tools/hris/individuals/retrieve-many-hris-individuals.ts +2 -2
- package/src/tools/hris/pay-statements/retrieve-many-hris-pay-statements.ts +2 -2
- package/src/tools/hris/payments/list-hris-payments.ts +2 -2
- package/src/tools/index.ts +16 -2
- package/src/tools/jobs/automated/create-jobs-automated.ts +2 -2
- package/src/tools/jobs/automated/list-jobs-automated.ts +2 -2
- package/src/tools/jobs/automated/retrieve-jobs-automated.ts +2 -2
- package/src/tools/jobs/manual/retrieve-jobs-manual.ts +2 -2
- package/src/tools/payroll/pay-groups/list-payroll-pay-groups.ts +2 -2
- package/src/tools/payroll/pay-groups/retrieve-payroll-pay-groups.ts +2 -2
- package/src/tools/providers/list-providers.ts +1 -2
- package/src/tools/request-forwarding/forward-request-forwarding.ts +2 -2
- package/src/tools/sandbox/company/update-sandbox-company.ts +42 -37
- package/src/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.ts +2 -2
- package/src/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.ts +7 -2
- package/src/tools/sandbox/connections/create-sandbox-connections.ts +2 -2
- package/src/tools/sandbox/directory/create-sandbox-directory.ts +82 -74
- package/src/tools/sandbox/employment/update-sandbox-employment.ts +62 -54
- package/src/tools/sandbox/individual/update-sandbox-individual.ts +19 -14
- package/src/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.ts +1 -2
- package/src/tools/sandbox/jobs/configuration/update-jobs-sandbox-configuration.ts +2 -2
- package/src/tools/sandbox/jobs/create-sandbox-jobs.ts +2 -2
- package/src/tools/sandbox/payment/create-sandbox-payment.ts +48 -40
- package/tools/access-tokens/create-access-tokens.d.mts +2 -2
- package/tools/access-tokens/create-access-tokens.d.mts.map +1 -1
- package/tools/access-tokens/create-access-tokens.d.ts +2 -2
- package/tools/access-tokens/create-access-tokens.d.ts.map +1 -1
- package/tools/access-tokens/create-access-tokens.js +1 -1
- package/tools/access-tokens/create-access-tokens.js.map +1 -1
- package/tools/access-tokens/create-access-tokens.mjs +1 -1
- package/tools/access-tokens/create-access-tokens.mjs.map +1 -1
- package/tools/account/disconnect-account.d.mts +2 -2
- package/tools/account/disconnect-account.d.mts.map +1 -1
- package/tools/account/disconnect-account.d.ts +2 -2
- package/tools/account/disconnect-account.d.ts.map +1 -1
- package/tools/account/disconnect-account.js +0 -1
- package/tools/account/disconnect-account.js.map +1 -1
- package/tools/account/disconnect-account.mjs +0 -1
- package/tools/account/disconnect-account.mjs.map +1 -1
- package/tools/account/introspect-account.d.mts +2 -2
- package/tools/account/introspect-account.d.mts.map +1 -1
- package/tools/account/introspect-account.d.ts +2 -2
- package/tools/account/introspect-account.d.ts.map +1 -1
- package/tools/account/introspect-account.js +0 -1
- package/tools/account/introspect-account.js.map +1 -1
- package/tools/account/introspect-account.mjs +0 -1
- package/tools/account/introspect-account.mjs.map +1 -1
- package/tools/connect/sessions/new-connect-sessions.d.mts +2 -2
- package/tools/connect/sessions/new-connect-sessions.d.mts.map +1 -1
- package/tools/connect/sessions/new-connect-sessions.d.ts +2 -2
- package/tools/connect/sessions/new-connect-sessions.d.ts.map +1 -1
- package/tools/connect/sessions/new-connect-sessions.js +1 -1
- package/tools/connect/sessions/new-connect-sessions.js.map +1 -1
- package/tools/connect/sessions/new-connect-sessions.mjs +1 -1
- package/tools/connect/sessions/new-connect-sessions.mjs.map +1 -1
- package/tools/connect/sessions/reauthenticate-connect-sessions.d.mts +2 -2
- package/tools/connect/sessions/reauthenticate-connect-sessions.d.mts.map +1 -1
- package/tools/connect/sessions/reauthenticate-connect-sessions.d.ts +2 -2
- package/tools/connect/sessions/reauthenticate-connect-sessions.d.ts.map +1 -1
- package/tools/connect/sessions/reauthenticate-connect-sessions.js +1 -1
- package/tools/connect/sessions/reauthenticate-connect-sessions.js.map +1 -1
- package/tools/connect/sessions/reauthenticate-connect-sessions.mjs +1 -1
- package/tools/connect/sessions/reauthenticate-connect-sessions.mjs.map +1 -1
- package/tools/hris/benefits/create-hris-benefits.d.mts +2 -2
- package/tools/hris/benefits/create-hris-benefits.d.mts.map +1 -1
- package/tools/hris/benefits/create-hris-benefits.d.ts +2 -2
- package/tools/hris/benefits/create-hris-benefits.d.ts.map +1 -1
- package/tools/hris/benefits/create-hris-benefits.js +37 -2
- package/tools/hris/benefits/create-hris-benefits.js.map +1 -1
- package/tools/hris/benefits/create-hris-benefits.mjs +37 -2
- package/tools/hris/benefits/create-hris-benefits.mjs.map +1 -1
- package/tools/hris/benefits/individuals/enroll-many-benefits-hris-individuals.d.mts +2 -2
- package/tools/hris/benefits/individuals/enroll-many-benefits-hris-individuals.d.mts.map +1 -1
- package/tools/hris/benefits/individuals/enroll-many-benefits-hris-individuals.d.ts +2 -2
- package/tools/hris/benefits/individuals/enroll-many-benefits-hris-individuals.d.ts.map +1 -1
- package/tools/hris/benefits/individuals/enroll-many-benefits-hris-individuals.js.map +1 -1
- package/tools/hris/benefits/individuals/enroll-many-benefits-hris-individuals.mjs.map +1 -1
- package/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.d.mts +2 -2
- package/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.d.mts.map +1 -1
- package/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.d.ts +2 -2
- package/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.d.ts.map +1 -1
- package/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.js +1 -1
- package/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.js.map +1 -1
- package/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.mjs +1 -1
- package/tools/hris/benefits/individuals/enrolled-ids-benefits-hris-individuals.mjs.map +1 -1
- package/tools/hris/benefits/individuals/retrieve-many-benefits-benefits-hris-individuals.d.mts +2 -2
- package/tools/hris/benefits/individuals/retrieve-many-benefits-benefits-hris-individuals.d.mts.map +1 -1
- package/tools/hris/benefits/individuals/retrieve-many-benefits-benefits-hris-individuals.d.ts +2 -2
- package/tools/hris/benefits/individuals/retrieve-many-benefits-benefits-hris-individuals.d.ts.map +1 -1
- package/tools/hris/benefits/individuals/retrieve-many-benefits-benefits-hris-individuals.js.map +1 -1
- package/tools/hris/benefits/individuals/retrieve-many-benefits-benefits-hris-individuals.mjs.map +1 -1
- package/tools/hris/benefits/individuals/unenroll-many-benefits-hris-individuals.d.mts +2 -2
- package/tools/hris/benefits/individuals/unenroll-many-benefits-hris-individuals.d.mts.map +1 -1
- package/tools/hris/benefits/individuals/unenroll-many-benefits-hris-individuals.d.ts +2 -2
- package/tools/hris/benefits/individuals/unenroll-many-benefits-hris-individuals.d.ts.map +1 -1
- package/tools/hris/benefits/individuals/unenroll-many-benefits-hris-individuals.js.map +1 -1
- package/tools/hris/benefits/individuals/unenroll-many-benefits-hris-individuals.mjs.map +1 -1
- package/tools/hris/benefits/list-hris-benefits.d.mts +2 -2
- package/tools/hris/benefits/list-hris-benefits.d.mts.map +1 -1
- package/tools/hris/benefits/list-hris-benefits.d.ts +2 -2
- package/tools/hris/benefits/list-hris-benefits.d.ts.map +1 -1
- package/tools/hris/benefits/list-hris-benefits.js +0 -1
- package/tools/hris/benefits/list-hris-benefits.js.map +1 -1
- package/tools/hris/benefits/list-hris-benefits.mjs +0 -1
- package/tools/hris/benefits/list-hris-benefits.mjs.map +1 -1
- package/tools/hris/benefits/list-supported-benefits-hris-benefits.d.mts +2 -2
- package/tools/hris/benefits/list-supported-benefits-hris-benefits.d.mts.map +1 -1
- package/tools/hris/benefits/list-supported-benefits-hris-benefits.d.ts +2 -2
- package/tools/hris/benefits/list-supported-benefits-hris-benefits.d.ts.map +1 -1
- package/tools/hris/benefits/list-supported-benefits-hris-benefits.js +0 -1
- package/tools/hris/benefits/list-supported-benefits-hris-benefits.js.map +1 -1
- package/tools/hris/benefits/list-supported-benefits-hris-benefits.mjs +0 -1
- package/tools/hris/benefits/list-supported-benefits-hris-benefits.mjs.map +1 -1
- package/tools/hris/benefits/retrieve-hris-benefits.d.mts +2 -2
- package/tools/hris/benefits/retrieve-hris-benefits.d.mts.map +1 -1
- package/tools/hris/benefits/retrieve-hris-benefits.d.ts +2 -2
- package/tools/hris/benefits/retrieve-hris-benefits.d.ts.map +1 -1
- package/tools/hris/benefits/retrieve-hris-benefits.js +1 -1
- package/tools/hris/benefits/retrieve-hris-benefits.js.map +1 -1
- package/tools/hris/benefits/retrieve-hris-benefits.mjs +1 -1
- package/tools/hris/benefits/retrieve-hris-benefits.mjs.map +1 -1
- package/tools/hris/benefits/update-hris-benefits.d.mts +2 -2
- package/tools/hris/benefits/update-hris-benefits.d.mts.map +1 -1
- package/tools/hris/benefits/update-hris-benefits.d.ts +2 -2
- package/tools/hris/benefits/update-hris-benefits.d.ts.map +1 -1
- package/tools/hris/benefits/update-hris-benefits.js.map +1 -1
- package/tools/hris/benefits/update-hris-benefits.mjs.map +1 -1
- package/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.d.mts +2 -2
- package/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.d.mts.map +1 -1
- package/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.d.ts +2 -2
- package/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.d.ts.map +1 -1
- package/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.js +1 -1
- package/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.js.map +1 -1
- package/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.mjs +1 -1
- package/tools/hris/company/pay-statement-item/list-company-hris-pay-statement-item.mjs.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.d.mts +2 -2
- package/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.d.mts.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.d.ts +2 -2
- package/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.d.ts.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.js +1 -1
- package/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.js.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.mjs +1 -1
- package/tools/hris/company/pay-statement-item/rules/create-pay-statement-item-company-hris-rules.mjs.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.d.mts +2 -2
- package/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.d.mts.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.d.ts +2 -2
- package/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.d.ts.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.js +1 -1
- package/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.js.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.mjs +1 -1
- package/tools/hris/company/pay-statement-item/rules/delete-pay-statement-item-company-hris-rules.mjs.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.d.mts +2 -2
- package/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.d.mts.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.d.ts +2 -2
- package/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.d.ts.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.js +0 -1
- package/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.js.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.mjs +0 -1
- package/tools/hris/company/pay-statement-item/rules/list-pay-statement-item-company-hris-rules.mjs.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/update-pay-statement-item-company-hris-rules.d.mts +2 -2
- package/tools/hris/company/pay-statement-item/rules/update-pay-statement-item-company-hris-rules.d.mts.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/update-pay-statement-item-company-hris-rules.d.ts +2 -2
- package/tools/hris/company/pay-statement-item/rules/update-pay-statement-item-company-hris-rules.d.ts.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/update-pay-statement-item-company-hris-rules.js.map +1 -1
- package/tools/hris/company/pay-statement-item/rules/update-pay-statement-item-company-hris-rules.mjs.map +1 -1
- package/tools/hris/company/retrieve-hris-company.d.mts +2 -2
- package/tools/hris/company/retrieve-hris-company.d.mts.map +1 -1
- package/tools/hris/company/retrieve-hris-company.d.ts +2 -2
- package/tools/hris/company/retrieve-hris-company.d.ts.map +1 -1
- package/tools/hris/company/retrieve-hris-company.js +0 -1
- package/tools/hris/company/retrieve-hris-company.js.map +1 -1
- package/tools/hris/company/retrieve-hris-company.mjs +0 -1
- package/tools/hris/company/retrieve-hris-company.mjs.map +1 -1
- package/tools/hris/directory/list-hris-directory.d.mts +2 -2
- package/tools/hris/directory/list-hris-directory.d.mts.map +1 -1
- package/tools/hris/directory/list-hris-directory.d.ts +2 -2
- package/tools/hris/directory/list-hris-directory.d.ts.map +1 -1
- package/tools/hris/directory/list-hris-directory.js +1 -1
- package/tools/hris/directory/list-hris-directory.js.map +1 -1
- package/tools/hris/directory/list-hris-directory.mjs +1 -1
- package/tools/hris/directory/list-hris-directory.mjs.map +1 -1
- package/tools/hris/directory/list-individuals-hris-directory.d.mts +2 -2
- package/tools/hris/directory/list-individuals-hris-directory.d.mts.map +1 -1
- package/tools/hris/directory/list-individuals-hris-directory.d.ts +2 -2
- package/tools/hris/directory/list-individuals-hris-directory.d.ts.map +1 -1
- package/tools/hris/directory/list-individuals-hris-directory.js +1 -1
- package/tools/hris/directory/list-individuals-hris-directory.js.map +1 -1
- package/tools/hris/directory/list-individuals-hris-directory.mjs +1 -1
- package/tools/hris/directory/list-individuals-hris-directory.mjs.map +1 -1
- package/tools/hris/documents/list-hris-documents.d.mts +2 -2
- package/tools/hris/documents/list-hris-documents.d.mts.map +1 -1
- package/tools/hris/documents/list-hris-documents.d.ts +2 -2
- package/tools/hris/documents/list-hris-documents.d.ts.map +1 -1
- package/tools/hris/documents/list-hris-documents.js +1 -1
- package/tools/hris/documents/list-hris-documents.js.map +1 -1
- package/tools/hris/documents/list-hris-documents.mjs +1 -1
- package/tools/hris/documents/list-hris-documents.mjs.map +1 -1
- package/tools/hris/documents/retreive-hris-documents.d.mts +2 -2
- package/tools/hris/documents/retreive-hris-documents.d.mts.map +1 -1
- package/tools/hris/documents/retreive-hris-documents.d.ts +2 -2
- package/tools/hris/documents/retreive-hris-documents.d.ts.map +1 -1
- package/tools/hris/documents/retreive-hris-documents.js +1 -1
- package/tools/hris/documents/retreive-hris-documents.js.map +1 -1
- package/tools/hris/documents/retreive-hris-documents.mjs +1 -1
- package/tools/hris/documents/retreive-hris-documents.mjs.map +1 -1
- package/tools/hris/employments/retrieve-many-hris-employments.d.mts +2 -2
- package/tools/hris/employments/retrieve-many-hris-employments.d.mts.map +1 -1
- package/tools/hris/employments/retrieve-many-hris-employments.d.ts +2 -2
- package/tools/hris/employments/retrieve-many-hris-employments.d.ts.map +1 -1
- package/tools/hris/employments/retrieve-many-hris-employments.js +1 -1
- package/tools/hris/employments/retrieve-many-hris-employments.js.map +1 -1
- package/tools/hris/employments/retrieve-many-hris-employments.mjs +1 -1
- package/tools/hris/employments/retrieve-many-hris-employments.mjs.map +1 -1
- package/tools/hris/individuals/retrieve-many-hris-individuals.d.mts +2 -2
- package/tools/hris/individuals/retrieve-many-hris-individuals.d.mts.map +1 -1
- package/tools/hris/individuals/retrieve-many-hris-individuals.d.ts +2 -2
- package/tools/hris/individuals/retrieve-many-hris-individuals.d.ts.map +1 -1
- package/tools/hris/individuals/retrieve-many-hris-individuals.js +1 -1
- package/tools/hris/individuals/retrieve-many-hris-individuals.js.map +1 -1
- package/tools/hris/individuals/retrieve-many-hris-individuals.mjs +1 -1
- package/tools/hris/individuals/retrieve-many-hris-individuals.mjs.map +1 -1
- package/tools/hris/pay-statements/retrieve-many-hris-pay-statements.d.mts +2 -2
- package/tools/hris/pay-statements/retrieve-many-hris-pay-statements.d.mts.map +1 -1
- package/tools/hris/pay-statements/retrieve-many-hris-pay-statements.d.ts +2 -2
- package/tools/hris/pay-statements/retrieve-many-hris-pay-statements.d.ts.map +1 -1
- package/tools/hris/pay-statements/retrieve-many-hris-pay-statements.js +1 -1
- package/tools/hris/pay-statements/retrieve-many-hris-pay-statements.js.map +1 -1
- package/tools/hris/pay-statements/retrieve-many-hris-pay-statements.mjs +1 -1
- package/tools/hris/pay-statements/retrieve-many-hris-pay-statements.mjs.map +1 -1
- package/tools/hris/payments/list-hris-payments.d.mts +2 -2
- package/tools/hris/payments/list-hris-payments.d.mts.map +1 -1
- package/tools/hris/payments/list-hris-payments.d.ts +2 -2
- package/tools/hris/payments/list-hris-payments.d.ts.map +1 -1
- package/tools/hris/payments/list-hris-payments.js +1 -1
- package/tools/hris/payments/list-hris-payments.js.map +1 -1
- package/tools/hris/payments/list-hris-payments.mjs +1 -1
- package/tools/hris/payments/list-hris-payments.mjs.map +1 -1
- package/tools/index.d.mts +1 -1
- package/tools/index.d.mts.map +1 -1
- package/tools/index.d.ts +1 -1
- package/tools/index.d.ts.map +1 -1
- package/tools/index.js +12 -3
- package/tools/index.js.map +1 -1
- package/tools/index.mjs +10 -1
- package/tools/index.mjs.map +1 -1
- package/tools/jobs/automated/create-jobs-automated.d.mts +2 -2
- package/tools/jobs/automated/create-jobs-automated.d.mts.map +1 -1
- package/tools/jobs/automated/create-jobs-automated.d.ts +2 -2
- package/tools/jobs/automated/create-jobs-automated.d.ts.map +1 -1
- package/tools/jobs/automated/create-jobs-automated.js +1 -1
- package/tools/jobs/automated/create-jobs-automated.js.map +1 -1
- package/tools/jobs/automated/create-jobs-automated.mjs +1 -1
- package/tools/jobs/automated/create-jobs-automated.mjs.map +1 -1
- package/tools/jobs/automated/list-jobs-automated.d.mts +2 -2
- package/tools/jobs/automated/list-jobs-automated.d.mts.map +1 -1
- package/tools/jobs/automated/list-jobs-automated.d.ts +2 -2
- package/tools/jobs/automated/list-jobs-automated.d.ts.map +1 -1
- package/tools/jobs/automated/list-jobs-automated.js +1 -1
- package/tools/jobs/automated/list-jobs-automated.js.map +1 -1
- package/tools/jobs/automated/list-jobs-automated.mjs +1 -1
- package/tools/jobs/automated/list-jobs-automated.mjs.map +1 -1
- package/tools/jobs/automated/retrieve-jobs-automated.d.mts +2 -2
- package/tools/jobs/automated/retrieve-jobs-automated.d.mts.map +1 -1
- package/tools/jobs/automated/retrieve-jobs-automated.d.ts +2 -2
- package/tools/jobs/automated/retrieve-jobs-automated.d.ts.map +1 -1
- package/tools/jobs/automated/retrieve-jobs-automated.js +1 -1
- package/tools/jobs/automated/retrieve-jobs-automated.js.map +1 -1
- package/tools/jobs/automated/retrieve-jobs-automated.mjs +1 -1
- package/tools/jobs/automated/retrieve-jobs-automated.mjs.map +1 -1
- package/tools/jobs/manual/retrieve-jobs-manual.d.mts +2 -2
- package/tools/jobs/manual/retrieve-jobs-manual.d.mts.map +1 -1
- package/tools/jobs/manual/retrieve-jobs-manual.d.ts +2 -2
- package/tools/jobs/manual/retrieve-jobs-manual.d.ts.map +1 -1
- package/tools/jobs/manual/retrieve-jobs-manual.js +1 -1
- package/tools/jobs/manual/retrieve-jobs-manual.js.map +1 -1
- package/tools/jobs/manual/retrieve-jobs-manual.mjs +1 -1
- package/tools/jobs/manual/retrieve-jobs-manual.mjs.map +1 -1
- package/tools/payroll/pay-groups/list-payroll-pay-groups.d.mts +2 -2
- package/tools/payroll/pay-groups/list-payroll-pay-groups.d.mts.map +1 -1
- package/tools/payroll/pay-groups/list-payroll-pay-groups.d.ts +2 -2
- package/tools/payroll/pay-groups/list-payroll-pay-groups.d.ts.map +1 -1
- package/tools/payroll/pay-groups/list-payroll-pay-groups.js +1 -1
- package/tools/payroll/pay-groups/list-payroll-pay-groups.js.map +1 -1
- package/tools/payroll/pay-groups/list-payroll-pay-groups.mjs +1 -1
- package/tools/payroll/pay-groups/list-payroll-pay-groups.mjs.map +1 -1
- package/tools/payroll/pay-groups/retrieve-payroll-pay-groups.d.mts +2 -2
- package/tools/payroll/pay-groups/retrieve-payroll-pay-groups.d.mts.map +1 -1
- package/tools/payroll/pay-groups/retrieve-payroll-pay-groups.d.ts +2 -2
- package/tools/payroll/pay-groups/retrieve-payroll-pay-groups.d.ts.map +1 -1
- package/tools/payroll/pay-groups/retrieve-payroll-pay-groups.js +1 -1
- package/tools/payroll/pay-groups/retrieve-payroll-pay-groups.js.map +1 -1
- package/tools/payroll/pay-groups/retrieve-payroll-pay-groups.mjs +1 -1
- package/tools/payroll/pay-groups/retrieve-payroll-pay-groups.mjs.map +1 -1
- package/tools/providers/list-providers.d.mts +2 -2
- package/tools/providers/list-providers.d.mts.map +1 -1
- package/tools/providers/list-providers.d.ts +2 -2
- package/tools/providers/list-providers.d.ts.map +1 -1
- package/tools/providers/list-providers.js +0 -1
- package/tools/providers/list-providers.js.map +1 -1
- package/tools/providers/list-providers.mjs +0 -1
- package/tools/providers/list-providers.mjs.map +1 -1
- package/tools/request-forwarding/forward-request-forwarding.d.mts +2 -2
- package/tools/request-forwarding/forward-request-forwarding.d.mts.map +1 -1
- package/tools/request-forwarding/forward-request-forwarding.d.ts +2 -2
- package/tools/request-forwarding/forward-request-forwarding.d.ts.map +1 -1
- package/tools/request-forwarding/forward-request-forwarding.js +1 -1
- package/tools/request-forwarding/forward-request-forwarding.js.map +1 -1
- package/tools/request-forwarding/forward-request-forwarding.mjs +1 -1
- package/tools/request-forwarding/forward-request-forwarding.mjs.map +1 -1
- package/tools/sandbox/company/update-sandbox-company.d.mts +2 -2
- package/tools/sandbox/company/update-sandbox-company.d.mts.map +1 -1
- package/tools/sandbox/company/update-sandbox-company.d.ts +2 -2
- package/tools/sandbox/company/update-sandbox-company.d.ts.map +1 -1
- package/tools/sandbox/company/update-sandbox-company.js +41 -36
- package/tools/sandbox/company/update-sandbox-company.js.map +1 -1
- package/tools/sandbox/company/update-sandbox-company.mjs +41 -36
- package/tools/sandbox/company/update-sandbox-company.mjs.map +1 -1
- package/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.d.mts +2 -2
- package/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.d.mts.map +1 -1
- package/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.d.ts +2 -2
- package/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.d.ts.map +1 -1
- package/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.js +1 -1
- package/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.js.map +1 -1
- package/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.mjs +1 -1
- package/tools/sandbox/connections/accounts/create-connections-sandbox-accounts.mjs.map +1 -1
- package/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.d.mts +2 -2
- package/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.d.mts.map +1 -1
- package/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.d.ts +2 -2
- package/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.d.ts.map +1 -1
- package/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.js +6 -1
- package/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.js.map +1 -1
- package/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.mjs +6 -1
- package/tools/sandbox/connections/accounts/update-connections-sandbox-accounts.mjs.map +1 -1
- package/tools/sandbox/connections/create-sandbox-connections.d.mts +2 -2
- package/tools/sandbox/connections/create-sandbox-connections.d.mts.map +1 -1
- package/tools/sandbox/connections/create-sandbox-connections.d.ts +2 -2
- package/tools/sandbox/connections/create-sandbox-connections.d.ts.map +1 -1
- package/tools/sandbox/connections/create-sandbox-connections.js +1 -1
- package/tools/sandbox/connections/create-sandbox-connections.js.map +1 -1
- package/tools/sandbox/connections/create-sandbox-connections.mjs +1 -1
- package/tools/sandbox/connections/create-sandbox-connections.mjs.map +1 -1
- package/tools/sandbox/directory/create-sandbox-directory.d.mts +2 -2
- package/tools/sandbox/directory/create-sandbox-directory.d.mts.map +1 -1
- package/tools/sandbox/directory/create-sandbox-directory.d.ts +2 -2
- package/tools/sandbox/directory/create-sandbox-directory.d.ts.map +1 -1
- package/tools/sandbox/directory/create-sandbox-directory.js +79 -71
- package/tools/sandbox/directory/create-sandbox-directory.js.map +1 -1
- package/tools/sandbox/directory/create-sandbox-directory.mjs +79 -71
- package/tools/sandbox/directory/create-sandbox-directory.mjs.map +1 -1
- package/tools/sandbox/employment/update-sandbox-employment.d.mts +2 -2
- package/tools/sandbox/employment/update-sandbox-employment.d.mts.map +1 -1
- package/tools/sandbox/employment/update-sandbox-employment.d.ts +2 -2
- package/tools/sandbox/employment/update-sandbox-employment.d.ts.map +1 -1
- package/tools/sandbox/employment/update-sandbox-employment.js +60 -52
- package/tools/sandbox/employment/update-sandbox-employment.js.map +1 -1
- package/tools/sandbox/employment/update-sandbox-employment.mjs +60 -52
- package/tools/sandbox/employment/update-sandbox-employment.mjs.map +1 -1
- package/tools/sandbox/individual/update-sandbox-individual.d.mts +2 -2
- package/tools/sandbox/individual/update-sandbox-individual.d.mts.map +1 -1
- package/tools/sandbox/individual/update-sandbox-individual.d.ts +2 -2
- package/tools/sandbox/individual/update-sandbox-individual.d.ts.map +1 -1
- package/tools/sandbox/individual/update-sandbox-individual.js +16 -11
- package/tools/sandbox/individual/update-sandbox-individual.js.map +1 -1
- package/tools/sandbox/individual/update-sandbox-individual.mjs +16 -11
- package/tools/sandbox/individual/update-sandbox-individual.mjs.map +1 -1
- package/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.d.mts +2 -2
- package/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.d.mts.map +1 -1
- package/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.d.ts +2 -2
- package/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.d.ts.map +1 -1
- package/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.js +0 -1
- package/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.js.map +1 -1
- package/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.mjs +0 -1
- package/tools/sandbox/jobs/configuration/retrieve-jobs-sandbox-configuration.mjs.map +1 -1
- package/tools/sandbox/jobs/configuration/update-jobs-sandbox-configuration.d.mts +2 -2
- package/tools/sandbox/jobs/configuration/update-jobs-sandbox-configuration.d.mts.map +1 -1
- package/tools/sandbox/jobs/configuration/update-jobs-sandbox-configuration.d.ts +2 -2
- package/tools/sandbox/jobs/configuration/update-jobs-sandbox-configuration.d.ts.map +1 -1
- package/tools/sandbox/jobs/configuration/update-jobs-sandbox-configuration.js +1 -1
- package/tools/sandbox/jobs/configuration/update-jobs-sandbox-configuration.js.map +1 -1
- package/tools/sandbox/jobs/configuration/update-jobs-sandbox-configuration.mjs +1 -1
- package/tools/sandbox/jobs/configuration/update-jobs-sandbox-configuration.mjs.map +1 -1
- package/tools/sandbox/jobs/create-sandbox-jobs.d.mts +2 -2
- package/tools/sandbox/jobs/create-sandbox-jobs.d.mts.map +1 -1
- package/tools/sandbox/jobs/create-sandbox-jobs.d.ts +2 -2
- package/tools/sandbox/jobs/create-sandbox-jobs.d.ts.map +1 -1
- package/tools/sandbox/jobs/create-sandbox-jobs.js +1 -1
- package/tools/sandbox/jobs/create-sandbox-jobs.js.map +1 -1
- package/tools/sandbox/jobs/create-sandbox-jobs.mjs +1 -1
- package/tools/sandbox/jobs/create-sandbox-jobs.mjs.map +1 -1
- package/tools/sandbox/payment/create-sandbox-payment.d.mts +2 -2
- package/tools/sandbox/payment/create-sandbox-payment.d.mts.map +1 -1
- package/tools/sandbox/payment/create-sandbox-payment.d.ts +2 -2
- package/tools/sandbox/payment/create-sandbox-payment.d.ts.map +1 -1
- package/tools/sandbox/payment/create-sandbox-payment.js +47 -39
- package/tools/sandbox/payment/create-sandbox-payment.js.map +1 -1
- package/tools/sandbox/payment/create-sandbox-payment.mjs +47 -39
- package/tools/sandbox/payment/create-sandbox-payment.mjs.map +1 -1
package/src/compat.ts
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { Endpoint } from './tools';
|
|
3
|
+
|
|
4
|
+
export interface ClientCapabilities {
|
|
5
|
+
topLevelUnions: boolean;
|
|
6
|
+
validJson: boolean;
|
|
7
|
+
refs: boolean;
|
|
8
|
+
unions: boolean;
|
|
9
|
+
formats: boolean;
|
|
10
|
+
toolNameLength: number | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const defaultClientCapabilities: ClientCapabilities = {
|
|
14
|
+
topLevelUnions: true,
|
|
15
|
+
validJson: true,
|
|
16
|
+
refs: true,
|
|
17
|
+
unions: true,
|
|
18
|
+
formats: true,
|
|
19
|
+
toolNameLength: undefined,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Attempts to parse strings into JSON objects
|
|
24
|
+
*/
|
|
25
|
+
export function parseEmbeddedJSON(args: Record<string, unknown>, schema: Record<string, unknown>) {
|
|
26
|
+
let updated = false;
|
|
27
|
+
const newArgs: Record<string, unknown> = Object.assign({}, args);
|
|
28
|
+
|
|
29
|
+
for (const [key, value] of Object.entries(newArgs)) {
|
|
30
|
+
if (typeof value === 'string') {
|
|
31
|
+
try {
|
|
32
|
+
const parsed = JSON.parse(value);
|
|
33
|
+
newArgs[key] = parsed;
|
|
34
|
+
updated = true;
|
|
35
|
+
} catch (e) {
|
|
36
|
+
// Not valid JSON, leave as is
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (updated) {
|
|
42
|
+
return newArgs;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return args;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type JSONSchema = {
|
|
49
|
+
type?: string;
|
|
50
|
+
properties?: Record<string, JSONSchema>;
|
|
51
|
+
required?: string[];
|
|
52
|
+
anyOf?: JSONSchema[];
|
|
53
|
+
$ref?: string;
|
|
54
|
+
$defs?: Record<string, JSONSchema>;
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Truncates tool names to the specified length while ensuring uniqueness.
|
|
60
|
+
* If truncation would cause duplicate names, appends a number to make them unique.
|
|
61
|
+
*/
|
|
62
|
+
export function truncateToolNames(names: string[], maxLength: number): Map<string, string> {
|
|
63
|
+
if (maxLength <= 0) {
|
|
64
|
+
return new Map();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const renameMap = new Map<string, string>();
|
|
68
|
+
const usedNames = new Set<string>();
|
|
69
|
+
|
|
70
|
+
const toTruncate = names.filter((name) => name.length > maxLength);
|
|
71
|
+
|
|
72
|
+
if (toTruncate.length === 0) {
|
|
73
|
+
return renameMap;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const willCollide =
|
|
77
|
+
new Set(toTruncate.map((name) => name.slice(0, maxLength - 1))).size < toTruncate.length;
|
|
78
|
+
|
|
79
|
+
if (!willCollide) {
|
|
80
|
+
for (const name of toTruncate) {
|
|
81
|
+
const truncatedName = name.slice(0, maxLength);
|
|
82
|
+
renameMap.set(name, truncatedName);
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
const baseLength = maxLength - 1;
|
|
86
|
+
|
|
87
|
+
for (const name of toTruncate) {
|
|
88
|
+
const baseName = name.slice(0, baseLength);
|
|
89
|
+
let counter = 1;
|
|
90
|
+
|
|
91
|
+
while (usedNames.has(baseName + counter)) {
|
|
92
|
+
counter++;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const finalName = baseName + counter;
|
|
96
|
+
renameMap.set(name, finalName);
|
|
97
|
+
usedNames.add(finalName);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return renameMap;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Removes top-level unions from a tool by splitting it into multiple tools,
|
|
106
|
+
* one for each variant in the union.
|
|
107
|
+
*/
|
|
108
|
+
export function removeTopLevelUnions(tool: Tool): Tool[] {
|
|
109
|
+
const inputSchema = tool.inputSchema as JSONSchema;
|
|
110
|
+
const variants = inputSchema.anyOf;
|
|
111
|
+
|
|
112
|
+
if (!variants || !Array.isArray(variants) || variants.length === 0) {
|
|
113
|
+
return [tool];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const defs = inputSchema.$defs || {};
|
|
117
|
+
|
|
118
|
+
return variants.map((variant, index) => {
|
|
119
|
+
const variantSchema: JSONSchema = {
|
|
120
|
+
...inputSchema,
|
|
121
|
+
...variant,
|
|
122
|
+
type: 'object',
|
|
123
|
+
properties: {
|
|
124
|
+
...(inputSchema.properties || {}),
|
|
125
|
+
...(variant.properties || {}),
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
delete variantSchema.anyOf;
|
|
130
|
+
|
|
131
|
+
if (!variantSchema['description']) {
|
|
132
|
+
variantSchema['description'] = tool.description;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const usedDefs = findUsedDefs(variant, defs);
|
|
136
|
+
if (Object.keys(usedDefs).length > 0) {
|
|
137
|
+
variantSchema.$defs = usedDefs;
|
|
138
|
+
} else {
|
|
139
|
+
delete variantSchema.$defs;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
...tool,
|
|
144
|
+
name: `${tool.name}_${toSnakeCase(variant['title'] || `variant${index + 1}`)}`,
|
|
145
|
+
description: variant['description'] || tool.description,
|
|
146
|
+
inputSchema: variantSchema,
|
|
147
|
+
} as Tool;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function findUsedDefs(schema: JSONSchema, defs: Record<string, JSONSchema>): Record<string, JSONSchema> {
|
|
152
|
+
const usedDefs: Record<string, JSONSchema> = {};
|
|
153
|
+
|
|
154
|
+
if (typeof schema !== 'object' || schema === null) {
|
|
155
|
+
return usedDefs;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (schema.$ref) {
|
|
159
|
+
const refParts = schema.$ref.split('/');
|
|
160
|
+
if (refParts[0] === '#' && refParts[1] === '$defs' && refParts[2]) {
|
|
161
|
+
const defName = refParts[2];
|
|
162
|
+
const def = defs[defName];
|
|
163
|
+
if (def) {
|
|
164
|
+
usedDefs[defName] = def;
|
|
165
|
+
Object.assign(usedDefs, findUsedDefs(def, defs));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return usedDefs;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
for (const key in schema) {
|
|
172
|
+
if (key !== '$defs' && typeof schema[key] === 'object' && schema[key] !== null) {
|
|
173
|
+
Object.assign(usedDefs, findUsedDefs(schema[key] as JSONSchema, defs));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return usedDefs;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Inlines all $refs in a schema, eliminating $defs.
|
|
182
|
+
* If a circular reference is detected, the circular property is removed.
|
|
183
|
+
*/
|
|
184
|
+
export function inlineRefs(schema: JSONSchema): JSONSchema {
|
|
185
|
+
if (!schema || typeof schema !== 'object') {
|
|
186
|
+
return schema;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const clonedSchema = { ...schema };
|
|
190
|
+
const defs: Record<string, JSONSchema> = schema.$defs || {};
|
|
191
|
+
|
|
192
|
+
delete clonedSchema.$defs;
|
|
193
|
+
|
|
194
|
+
const result = inlineRefsRecursive(clonedSchema, defs, new Set<string>());
|
|
195
|
+
// The top level can never be null
|
|
196
|
+
return result === null ? {} : result;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function inlineRefsRecursive(
|
|
200
|
+
schema: JSONSchema,
|
|
201
|
+
defs: Record<string, JSONSchema>,
|
|
202
|
+
refPath: Set<string>,
|
|
203
|
+
): JSONSchema | null {
|
|
204
|
+
if (!schema || typeof schema !== 'object') {
|
|
205
|
+
return schema;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (Array.isArray(schema)) {
|
|
209
|
+
return schema.map((item) => {
|
|
210
|
+
const processed = inlineRefsRecursive(item, defs, refPath);
|
|
211
|
+
return processed === null ? {} : processed;
|
|
212
|
+
}) as JSONSchema;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const result = { ...schema };
|
|
216
|
+
|
|
217
|
+
if ('$ref' in result && typeof result.$ref === 'string') {
|
|
218
|
+
if (result.$ref.startsWith('#/$defs/')) {
|
|
219
|
+
const refName = result.$ref.split('/').pop() as string;
|
|
220
|
+
const def = defs[refName];
|
|
221
|
+
|
|
222
|
+
// If we've already seen this ref in our path, we have a circular reference
|
|
223
|
+
if (refPath.has(result.$ref)) {
|
|
224
|
+
// For circular references, we completely remove the property
|
|
225
|
+
// by returning null. The parent will remove it.
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (def) {
|
|
230
|
+
const newRefPath = new Set(refPath);
|
|
231
|
+
newRefPath.add(result.$ref);
|
|
232
|
+
|
|
233
|
+
const inlinedDef = inlineRefsRecursive({ ...def }, defs, newRefPath);
|
|
234
|
+
|
|
235
|
+
if (inlinedDef === null) {
|
|
236
|
+
return { ...result };
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Merge the inlined definition with the original schema's properties
|
|
240
|
+
// but preserve things like description, etc.
|
|
241
|
+
const { $ref, ...rest } = result;
|
|
242
|
+
return { ...inlinedDef, ...rest };
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Keep external refs as-is
|
|
247
|
+
return result;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
for (const key in result) {
|
|
251
|
+
if (result[key] && typeof result[key] === 'object') {
|
|
252
|
+
const processed = inlineRefsRecursive(result[key] as JSONSchema, defs, refPath);
|
|
253
|
+
if (processed === null) {
|
|
254
|
+
// Remove properties that would cause circular references
|
|
255
|
+
delete result[key];
|
|
256
|
+
} else {
|
|
257
|
+
result[key] = processed;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return result;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Removes anyOf fields from a schema, using only the first variant.
|
|
267
|
+
*/
|
|
268
|
+
export function removeAnyOf(schema: JSONSchema): JSONSchema {
|
|
269
|
+
if (!schema || typeof schema !== 'object') {
|
|
270
|
+
return schema;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (Array.isArray(schema)) {
|
|
274
|
+
return schema.map((item) => removeAnyOf(item)) as JSONSchema;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const result = { ...schema };
|
|
278
|
+
|
|
279
|
+
if ('anyOf' in result && Array.isArray(result.anyOf) && result.anyOf.length > 0) {
|
|
280
|
+
const firstVariant = result.anyOf[0];
|
|
281
|
+
|
|
282
|
+
if (firstVariant && typeof firstVariant === 'object') {
|
|
283
|
+
// Special handling for properties to ensure deep merge
|
|
284
|
+
if (firstVariant.properties && result.properties) {
|
|
285
|
+
result.properties = {
|
|
286
|
+
...result.properties,
|
|
287
|
+
...(firstVariant.properties as Record<string, JSONSchema>),
|
|
288
|
+
};
|
|
289
|
+
} else if (firstVariant.properties) {
|
|
290
|
+
result.properties = { ...firstVariant.properties };
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
for (const key in firstVariant) {
|
|
294
|
+
if (key !== 'properties') {
|
|
295
|
+
result[key] = firstVariant[key];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
delete result.anyOf;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
for (const key in result) {
|
|
304
|
+
if (result[key] && typeof result[key] === 'object') {
|
|
305
|
+
result[key] = removeAnyOf(result[key] as JSONSchema);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return result;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Removes format fields from a schema and appends them to the description.
|
|
314
|
+
*/
|
|
315
|
+
export function removeFormats(schema: JSONSchema, formatsCapability: boolean): JSONSchema {
|
|
316
|
+
if (formatsCapability) {
|
|
317
|
+
return schema;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (!schema || typeof schema !== 'object') {
|
|
321
|
+
return schema;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (Array.isArray(schema)) {
|
|
325
|
+
return schema.map((item) => removeFormats(item, formatsCapability)) as JSONSchema;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const result = { ...schema };
|
|
329
|
+
|
|
330
|
+
if ('format' in result && typeof result['format'] === 'string') {
|
|
331
|
+
const formatStr = `(format: "${result['format']}")`;
|
|
332
|
+
|
|
333
|
+
if ('description' in result && typeof result['description'] === 'string') {
|
|
334
|
+
result['description'] = `${result['description']} ${formatStr}`;
|
|
335
|
+
} else {
|
|
336
|
+
result['description'] = formatStr;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
delete result['format'];
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
for (const key in result) {
|
|
343
|
+
if (result[key] && typeof result[key] === 'object') {
|
|
344
|
+
result[key] = removeFormats(result[key] as JSONSchema, formatsCapability);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return result;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Applies all compatibility transformations to the endpoints based on the provided capabilities.
|
|
353
|
+
*/
|
|
354
|
+
export function applyCompatibilityTransformations(
|
|
355
|
+
endpoints: Endpoint[],
|
|
356
|
+
capabilities: ClientCapabilities,
|
|
357
|
+
): Endpoint[] {
|
|
358
|
+
let transformedEndpoints = [...endpoints];
|
|
359
|
+
|
|
360
|
+
// Handle top-level unions first as this changes tool names
|
|
361
|
+
if (!capabilities.topLevelUnions) {
|
|
362
|
+
const newEndpoints: Endpoint[] = [];
|
|
363
|
+
|
|
364
|
+
for (const endpoint of transformedEndpoints) {
|
|
365
|
+
const variantTools = removeTopLevelUnions(endpoint.tool);
|
|
366
|
+
|
|
367
|
+
if (variantTools.length === 1) {
|
|
368
|
+
newEndpoints.push(endpoint);
|
|
369
|
+
} else {
|
|
370
|
+
for (const variantTool of variantTools) {
|
|
371
|
+
newEndpoints.push({
|
|
372
|
+
...endpoint,
|
|
373
|
+
tool: variantTool,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
transformedEndpoints = newEndpoints;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
if (capabilities.toolNameLength) {
|
|
383
|
+
const toolNames = transformedEndpoints.map((endpoint) => endpoint.tool.name);
|
|
384
|
+
const renameMap = truncateToolNames(toolNames, capabilities.toolNameLength);
|
|
385
|
+
|
|
386
|
+
transformedEndpoints = transformedEndpoints.map((endpoint) => ({
|
|
387
|
+
...endpoint,
|
|
388
|
+
tool: {
|
|
389
|
+
...endpoint.tool,
|
|
390
|
+
name: renameMap.get(endpoint.tool.name) ?? endpoint.tool.name,
|
|
391
|
+
},
|
|
392
|
+
}));
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
if (!capabilities.refs || !capabilities.unions || !capabilities.formats) {
|
|
396
|
+
transformedEndpoints = transformedEndpoints.map((endpoint) => {
|
|
397
|
+
let schema = endpoint.tool.inputSchema as JSONSchema;
|
|
398
|
+
|
|
399
|
+
if (!capabilities.refs) {
|
|
400
|
+
schema = inlineRefs(schema);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (!capabilities.unions) {
|
|
404
|
+
schema = removeAnyOf(schema);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (!capabilities.formats) {
|
|
408
|
+
schema = removeFormats(schema, capabilities.formats);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return {
|
|
412
|
+
...endpoint,
|
|
413
|
+
tool: {
|
|
414
|
+
...endpoint.tool,
|
|
415
|
+
inputSchema: schema as typeof endpoint.tool.inputSchema,
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
return transformedEndpoints;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function toSnakeCase(str: string): string {
|
|
425
|
+
return str
|
|
426
|
+
.replace(/\s+/g, '_')
|
|
427
|
+
.replace(/([a-z])([A-Z])/g, '$1_$2')
|
|
428
|
+
.toLowerCase();
|
|
429
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,115 +1,28 @@
|
|
|
1
1
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
|
-
import yargs from 'yargs';
|
|
3
|
-
import { hideBin } from 'yargs/helpers';
|
|
4
2
|
import { init, server } from './server';
|
|
5
|
-
import { endpoints, Filter, query } from './tools';
|
|
3
|
+
import { Endpoint, endpoints, Filter, query } from './tools';
|
|
4
|
+
import { applyCompatibilityTransformations } from './compat';
|
|
5
|
+
import { parseOptions } from './options';
|
|
6
6
|
|
|
7
7
|
async function main() {
|
|
8
|
-
const
|
|
9
|
-
.option('tool', {
|
|
10
|
-
type: 'string',
|
|
11
|
-
array: true,
|
|
12
|
-
description: 'Include tools matching the specified names',
|
|
13
|
-
})
|
|
14
|
-
.option('resource', {
|
|
15
|
-
type: 'string',
|
|
16
|
-
array: true,
|
|
17
|
-
description: 'Include tools matching the specified resources',
|
|
18
|
-
})
|
|
19
|
-
.option('operation', {
|
|
20
|
-
type: 'string',
|
|
21
|
-
array: true,
|
|
22
|
-
choices: ['read', 'write'],
|
|
23
|
-
description: 'Include tools matching the specified operations',
|
|
24
|
-
})
|
|
25
|
-
.option('tag', {
|
|
26
|
-
type: 'string',
|
|
27
|
-
array: true,
|
|
28
|
-
description: 'Include tools with the specified tags',
|
|
29
|
-
})
|
|
30
|
-
.option('no-tool', {
|
|
31
|
-
type: 'string',
|
|
32
|
-
array: true,
|
|
33
|
-
description: 'Exclude tools matching the specified names',
|
|
34
|
-
})
|
|
35
|
-
.option('no-resource', {
|
|
36
|
-
type: 'string',
|
|
37
|
-
array: true,
|
|
38
|
-
description: 'Exclude tools matching the specified resources',
|
|
39
|
-
})
|
|
40
|
-
.option('no-operation', {
|
|
41
|
-
type: 'string',
|
|
42
|
-
array: true,
|
|
43
|
-
description: 'Exclude tools matching the specified operations',
|
|
44
|
-
})
|
|
45
|
-
.option('no-tag', {
|
|
46
|
-
type: 'string',
|
|
47
|
-
array: true,
|
|
48
|
-
description: 'Exclude tools with the specified tags',
|
|
49
|
-
})
|
|
50
|
-
.option('list', {
|
|
51
|
-
type: 'boolean',
|
|
52
|
-
description: 'List all tools and exit',
|
|
53
|
-
})
|
|
54
|
-
.help();
|
|
55
|
-
|
|
56
|
-
for (const [command, desc] of examples()) {
|
|
57
|
-
opts.example(command, desc);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const argv = opts.parseSync();
|
|
8
|
+
const { filters, capabilities, list } = parseOptionsOrError();
|
|
61
9
|
|
|
62
|
-
if (
|
|
10
|
+
if (list) {
|
|
63
11
|
listAllTools();
|
|
64
12
|
return;
|
|
65
13
|
}
|
|
66
|
-
const filters: Filter[] = [];
|
|
67
|
-
|
|
68
|
-
for (const tag of argv.tag || []) {
|
|
69
|
-
filters.push({ type: 'tag', op: 'include', value: tag });
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
for (const tag of argv.noTag || []) {
|
|
73
|
-
filters.push({ type: 'tag', op: 'exclude', value: tag });
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
for (const resource of argv.resource || []) {
|
|
77
|
-
filters.push({ type: 'resource', op: 'include', value: resource });
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
for (const resource of argv.noResource || []) {
|
|
81
|
-
filters.push({ type: 'resource', op: 'exclude', value: resource });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
for (const tool of argv.tool || []) {
|
|
85
|
-
filters.push({ type: 'tool', op: 'include', value: tool });
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
for (const tool of argv.noTool || []) {
|
|
89
|
-
filters.push({ type: 'tool', op: 'exclude', value: tool });
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
for (const operation of argv.operation || []) {
|
|
93
|
-
filters.push({ type: 'operation', op: 'include', value: operation });
|
|
94
|
-
}
|
|
95
14
|
|
|
96
|
-
|
|
97
|
-
filters.push({ type: 'operation', op: 'exclude', value: operation });
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const filteredEndpoints = query(filters, endpoints);
|
|
15
|
+
const filteredEndpoints = filterEndpointsOrError(filters, endpoints);
|
|
101
16
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
process.exit(1);
|
|
105
|
-
}
|
|
17
|
+
// Apply compatibility transformations
|
|
18
|
+
const transformedEndpoints = applyCompatibilityTransformations(filteredEndpoints, capabilities);
|
|
106
19
|
|
|
107
20
|
console.error(
|
|
108
|
-
`MCP Server starting with ${
|
|
109
|
-
|
|
21
|
+
`MCP Server starting with ${transformedEndpoints.length} tools:`,
|
|
22
|
+
transformedEndpoints.map((e) => e.tool.name),
|
|
110
23
|
);
|
|
111
24
|
|
|
112
|
-
init({ server, endpoints:
|
|
25
|
+
init({ server, endpoints: transformedEndpoints });
|
|
113
26
|
|
|
114
27
|
const transport = new StdioServerTransport();
|
|
115
28
|
await server.connect(transport);
|
|
@@ -123,6 +36,33 @@ if (require.main === module) {
|
|
|
123
36
|
});
|
|
124
37
|
}
|
|
125
38
|
|
|
39
|
+
function parseOptionsOrError() {
|
|
40
|
+
try {
|
|
41
|
+
return parseOptions();
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error('Error parsing options:', error);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function filterEndpointsOrError(filters: Filter[], endpoints: Endpoint[]) {
|
|
49
|
+
try {
|
|
50
|
+
const filteredEndpoints = query(filters, endpoints);
|
|
51
|
+
if (filteredEndpoints.length === 0) {
|
|
52
|
+
console.error('No tools match the provided filters.');
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
return filteredEndpoints;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
if (error instanceof Error) {
|
|
58
|
+
console.error('Error filtering tools:', error.message);
|
|
59
|
+
} else {
|
|
60
|
+
console.error('Error filtering tools:', error);
|
|
61
|
+
}
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
126
66
|
function listAllTools() {
|
|
127
67
|
if (endpoints.length === 0) {
|
|
128
68
|
console.error('No tools available.');
|
|
@@ -164,27 +104,3 @@ function listAllTools() {
|
|
|
164
104
|
console.error('');
|
|
165
105
|
}
|
|
166
106
|
}
|
|
167
|
-
|
|
168
|
-
function examples(): [string, string][] {
|
|
169
|
-
const firstEndpoint = endpoints[0]!;
|
|
170
|
-
const secondEndpoint =
|
|
171
|
-
endpoints.find((e) => e.metadata.resource !== firstEndpoint.metadata.resource) || endpoints[1];
|
|
172
|
-
const tag = endpoints.find((e) => e.metadata.tags.length > 0)?.metadata.tags[0];
|
|
173
|
-
const otherEndpoint = secondEndpoint || firstEndpoint;
|
|
174
|
-
|
|
175
|
-
return [
|
|
176
|
-
[
|
|
177
|
-
`--tool="${firstEndpoint.tool.name}" ${secondEndpoint ? `--tool="${secondEndpoint.tool.name}"` : ''}`,
|
|
178
|
-
'Include tools by name',
|
|
179
|
-
],
|
|
180
|
-
[
|
|
181
|
-
`--resource="${firstEndpoint.metadata.resource}" --operation="read"`,
|
|
182
|
-
'Filter by resource and operation',
|
|
183
|
-
],
|
|
184
|
-
[
|
|
185
|
-
`--resource="${otherEndpoint.metadata.resource}*" --no-tool="${otherEndpoint.tool.name}"`,
|
|
186
|
-
'Use resource wildcards and exclusions',
|
|
187
|
-
],
|
|
188
|
-
...(tag ? [[`--tag="${tag}"`, 'Filter based on tags'] as [string, string]] : []),
|
|
189
|
-
];
|
|
190
|
-
}
|