Skip to content

Commit b3f5e09

Browse files
chore(internal): codegen related update
1 parent 753228c commit b3f5e09

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/mcp-server/src/code-tool.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { McpTool, Metadata, ToolCallResult, asErrorResult, asTextContentResult }
44
import { Tool } from '@modelcontextprotocol/sdk/types.js';
55
import { readEnv } from './server';
66
import { WorkerInput, WorkerOutput } from './code-tool-types';
7+
import { Finch } from '@tryfinch/finch-api';
78

89
const prompt = `Runs JavaScript code to interact with the Finch API.
910
@@ -55,7 +56,7 @@ export function codeTool(): McpTool {
5556
required: ['code'],
5657
},
5758
};
58-
const handler = async (_: unknown, args: any): Promise<ToolCallResult> => {
59+
const handler = async (client: Finch, args: any): Promise<ToolCallResult> => {
5960
const code = args.code as string;
6061
const intent = args.intent as string | undefined;
6162

@@ -71,10 +72,10 @@ export function codeTool(): McpTool {
7172
...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
7273
'Content-Type': 'application/json',
7374
client_envs: JSON.stringify({
74-
FINCH_CLIENT_ID: readEnv('FINCH_CLIENT_ID'),
75-
FINCH_CLIENT_SECRET: readEnv('FINCH_CLIENT_SECRET'),
76-
FINCH_WEBHOOK_SECRET: readEnv('FINCH_WEBHOOK_SECRET'),
77-
FINCH_BASE_URL: readEnv('FINCH_BASE_URL'),
75+
FINCH_CLIENT_ID: readEnv('FINCH_CLIENT_ID') ?? client.clientID ?? undefined,
76+
FINCH_CLIENT_SECRET: readEnv('FINCH_CLIENT_SECRET') ?? client.clientSecret ?? undefined,
77+
FINCH_WEBHOOK_SECRET: readEnv('FINCH_WEBHOOK_SECRET') ?? client.webhookSecret ?? undefined,
78+
FINCH_BASE_URL: readEnv('FINCH_BASE_URL') ?? client.baseURL ?? undefined,
7879
}),
7980
},
8081
body: JSON.stringify({

0 commit comments

Comments
 (0)