Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "6.38.2"
".": "6.39.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 46
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-0105d239fcaf84750c886dfa6c2cfbf2b2087f89a48f8827c4cbe28479ebfb13.yml
openapi_spec_hash: 34895c3d3c137fb9f5a019ac5370afbb
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-b817e7a30a6366c063a8c9a334d5be281eb8d93e21acc8c8219d3bdc95043deb.yml
openapi_spec_hash: d4cc4a5cba9f13986e38d148d330aa00
config_hash: 5c64f384746e7570c10f19fe241062a7
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 6.39.0 (2025-11-03)

Full Changelog: [v6.38.2...v6.39.0](https://github.com/Finch-API/finch-api-node/compare/v6.38.2...v6.39.0)

### Features

* **api:** api update ([b6892f5](https://github.com/Finch-API/finch-api-node/commit/b6892f5c579a0eeb8fa03863d9a72faa36adab9d))


### Chores

* **internal:** grammar fix (it's -> its) ([54ad7ca](https://github.com/Finch-API/finch-api-node/commit/54ad7ca2689051eccdb1de832e9041e3a6fe8d52))
* use structured error when code execution tool errors ([a85e9d8](https://github.com/Finch-API/finch-api-node/commit/a85e9d8431d5b22e82f34606a813821f5573d197))

## 6.38.2 (2025-10-31)

Full Changelog: [v6.38.1...v6.38.2](https://github.com/Finch-API/finch-api-node/compare/v6.38.1...v6.38.2)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tryfinch/finch-api",
"version": "6.38.2",
"version": "6.39.0",
"description": "The official TypeScript library for the Finch API",
"author": "Finch <founders@tryfinch.com>",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tryfinch/finch-api-mcp",
"version": "6.38.2",
"version": "6.39.0",
"description": "The official MCP Server for the Finch API",
"author": "Finch <founders@tryfinch.com>",
"types": "dist/index.d.ts",
Expand Down
27 changes: 14 additions & 13 deletions packages/mcp-server/src/code-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { dirname } from 'node:path';
import { pathToFileURL } from 'node:url';
import Finch, { ClientOptions } from '@tryfinch/finch-api';
import { Endpoint, ContentBlock, Metadata } from './tools/types';
import { ContentBlock, Endpoint, Metadata, ToolCallResult } from './tools/types';

import { Tool } from '@modelcontextprotocol/sdk/types.js';

Expand All @@ -12,7 +12,7 @@ import { WorkerInput, WorkerError, WorkerSuccess } from './code-tool-types';
/**
* A tool that runs code against a copy of the SDK.
*
* Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
* Instead of exposing every endpoint as its own tool, which uses up too many tokens for LLMs to use at once,
* we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
* a generic endpoint that can be used to invoke any endpoint with the provided arguments.
*
Expand All @@ -23,15 +23,15 @@ export async function codeTool(): Promise<Endpoint> {
const tool: Tool = {
name: 'execute',
description:
'Runs Typescript code to interact with the API.\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized client, and it will be run.\nDo not initialize a client, but instead use the client that you are given as a parameter.\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
'Runs TypeScript code to interact with the API.\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized client, and it will be run.\nDo not initialize a client, but instead use the client that you are given as a parameter.\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
};

// 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 handler = async (client: Finch, args: unknown): Promise<ToolCallResult> => {
const baseURLHostname = new URL(client.baseURL).hostname;
const { code } = args as { code: string };

Expand Down Expand Up @@ -100,7 +100,7 @@ export async function codeTool(): Promise<Endpoint> {
} satisfies WorkerInput);

req.write(body, (err) => {
if (err !== null && err !== undefined) {
if (err != null) {
reject(err);
}
});
Expand All @@ -111,12 +111,12 @@ export async function codeTool(): Promise<Endpoint> {
if (resp.status === 200) {
const { result, logLines, errLines } = (await resp.json()) as WorkerSuccess;
const returnOutput: ContentBlock | null =
result === null ? null
: result === undefined ? null
: {
result == null ? null : (
{
type: 'text',
text: typeof result === 'string' ? (result as string) : JSON.stringify(result),
};
text: typeof result === 'string' ? result : JSON.stringify(result),
}
);
const logOutput: ContentBlock | null =
logLines.length === 0 ?
null
Expand All @@ -136,10 +136,11 @@ export async function codeTool(): Promise<Endpoint> {
};
} else {
const { message } = (await resp.json()) as WorkerError;
throw new Error(message);
return {
content: message == null ? [] : [{ type: 'text', text: message }],
isError: true,
};
}
} catch (e) {
throw e;
} finally {
worker.terminate();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-server/src/dynamic-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function zodToInputSchema(schema: z.ZodSchema) {
/**
* A list of tools that expose all the endpoints in the API dynamically.
*
* Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
* Instead of exposing every endpoint as its own tool, which uses up too many tokens for LLMs to use at once,
* we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
* a generic endpoint that can be used to invoke any endpoint with the provided arguments.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const newMcpServer = () =>
new McpServer(
{
name: 'tryfinch_finch_api_api',
version: '6.38.2',
version: '6.39.0',
},
{ capabilities: { tools: {}, logging: {} } },
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export const tool: Tool = {
inputSchema: {
type: 'object',
properties: {
customer_email: {
type: 'string',
description: 'Email address of the customer',
},
customer_id: {
type: 'string',
description: 'Unique identifier for the customer',
Expand All @@ -34,31 +30,6 @@ export const tool: Tool = {
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',
Expand All @@ -79,6 +50,35 @@ export const tool: Tool = {
],
},
},
customer_email: {
type: 'string',
description: 'Email address of the customer',
},
integration: {
type: 'object',
description: 'Integration configuration for the connect session',
properties: {
provider: {
type: 'string',
description: 'The provider to integrate with',
},
auth_method: {
type: 'string',
description: 'The authentication method to use',
enum: ['assisted', 'credential', 'oauth', 'api_token'],
},
},
required: ['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)',
},
redirect_uri: {
type: 'string',
description: 'The URI to redirect to after the Connect flow is completed',
Expand All @@ -95,17 +95,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: [
'customer_email',
'customer_id',
'customer_name',
'integration',
'manual',
'minutes_to_expire',
'products',
'redirect_uri',
'sandbox',
],
required: ['customer_id', 'customer_name', 'products'],
},
annotations: {},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', 'minutes_to_expire', 'products', 'redirect_uri'],
required: ['connection_id'],
},
annotations: {},
};
Expand Down
60 changes: 30 additions & 30 deletions src/resources/connect/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ export interface SessionReauthenticateResponse {
}

export interface SessionNewParams {
/**
* Email address of the customer
*/
customer_email: string | null;

/**
* Unique identifier for the customer
*/
Expand All @@ -62,22 +57,6 @@ export interface SessionNewParams {
*/
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
*/
Expand All @@ -94,15 +73,36 @@ export interface SessionNewParams {
| 'ssn'
>;

/**
* Email address of the customer
*/
customer_email?: string | null;

/**
* 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 URI to redirect to after the Connect flow is completed
*/
redirect_uri: string | null;
redirect_uri?: string | null;

/**
* Sandbox mode for testing
*/
sandbox: 'finch' | 'provider' | null;
sandbox?: 'finch' | 'provider' | null;
}

export namespace SessionNewParams {
Expand All @@ -111,14 +111,14 @@ export namespace SessionNewParams {
*/
export interface Integration {
/**
* The authentication method to use
* The provider to integrate with
*/
auth_method: 'assisted' | 'credential' | 'oauth' | 'api_token' | null;
provider: string;

/**
* The provider to integrate with
* The authentication method to use
*/
provider: string | null;
auth_method?: 'assisted' | 'credential' | 'oauth' | 'api_token' | null;
}
}

Expand All @@ -132,12 +132,12 @@ export interface SessionReauthenticateParams {
* The number of minutes until the session expires (defaults to 43,200, which is 30
* days)
*/
minutes_to_expire: number;
minutes_to_expire?: number;

/**
* The products to request access to (optional for reauthentication)
*/
products: Array<
products?: Array<
| 'benefits'
| 'company'
| 'deduction'
Expand All @@ -153,7 +153,7 @@ export interface SessionReauthenticateParams {
/**
* The URI to redirect to after the Connect flow is completed
*/
redirect_uri: string | null;
redirect_uri?: string | null;
}

export declare namespace Sessions {
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '6.38.2'; // x-release-please-version
export const VERSION = '6.39.0'; // x-release-please-version
Loading