Skip to content

Commit ea9503f

Browse files
committed
Simplify browser curl params
1 parent a5909ff commit ea9503f

1 file changed

Lines changed: 5 additions & 17 deletions

File tree

src/lib/mcp/tools/browser-utilities.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,12 @@ export function registerBrowserUtilityTools(server: McpServer) {
4848
const client = createKernelClient(extra.authInfo.token);
4949

5050
try {
51-
validateCurlUrl(params.url);
51+
const { session_id, ...curlParams } = params satisfies {
52+
session_id: string;
53+
} & BrowserCurlParams;
54+
validateCurlUrl(curlParams.url);
5255

53-
const curlParams: BrowserCurlParams = {
54-
url: params.url,
55-
...(params.method !== undefined && { method: params.method }),
56-
...(params.headers !== undefined && { headers: params.headers }),
57-
...(params.body !== undefined && { body: params.body }),
58-
...(params.response_encoding !== undefined && {
59-
response_encoding: params.response_encoding,
60-
}),
61-
...(params.timeout_ms !== undefined && {
62-
timeout_ms: params.timeout_ms,
63-
}),
64-
};
65-
const response = await client.browsers.curl(
66-
params.session_id,
67-
curlParams,
68-
);
56+
const response = await client.browsers.curl(session_id, curlParams);
6957
return textResponse(JSON.stringify(response, null, 2));
7058
} catch (error) {
7159
return textResponse(

0 commit comments

Comments
 (0)