Skip to content

Commit 5adb9c4

Browse files
chore(internal): codegen related update
1 parent 0f7befe commit 5adb9c4

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

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

Lines changed: 7 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, readEnvOrError } from './server';
66
import { WorkerInput, WorkerOutput } from './code-tool-types';
7+
import { ImageKit } from '@imagekit/nodejs';
78

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

@@ -70,10 +71,11 @@ export function codeTool(): McpTool {
7071
...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
7172
'Content-Type': 'application/json',
7273
client_envs: JSON.stringify({
73-
IMAGEKIT_PRIVATE_KEY: readEnvOrError('IMAGEKIT_PRIVATE_KEY'),
74-
OPTIONAL_IMAGEKIT_IGNORES_THIS: readEnv('OPTIONAL_IMAGEKIT_IGNORES_THIS'),
75-
IMAGEKIT_WEBHOOK_SECRET: readEnv('IMAGEKIT_WEBHOOK_SECRET'),
76-
IMAGE_KIT_BASE_URL: readEnv('IMAGE_KIT_BASE_URL'),
74+
IMAGEKIT_PRIVATE_KEY: readEnvOrError('IMAGEKIT_PRIVATE_KEY') ?? client.privateKey ?? undefined,
75+
OPTIONAL_IMAGEKIT_IGNORES_THIS:
76+
readEnv('OPTIONAL_IMAGEKIT_IGNORES_THIS') ?? client.password ?? undefined,
77+
IMAGEKIT_WEBHOOK_SECRET: readEnv('IMAGEKIT_WEBHOOK_SECRET') ?? client.webhookSecret ?? undefined,
78+
IMAGE_KIT_BASE_URL: readEnv('IMAGE_KIT_BASE_URL') ?? client.baseURL ?? undefined,
7779
}),
7880
},
7981
body: JSON.stringify({

0 commit comments

Comments
 (0)