Skip to content

Commit d57cb1f

Browse files
committed
do not parse clientToolCallAction on custom tool
1 parent c80daf9 commit d57cb1f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sdk/src/client.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import {
1515
import { MAX_AGENT_STEPS_DEFAULT } from '../../common/src/constants/agents'
1616
import { API_KEY_ENV_VAR } from '../../common/src/old-constants'
1717
import { toolNames } from '../../common/src/tools/constants'
18+
import type { PublishedClientToolName } from '../../common/src/tools/list'
1819
import {
1920
clientToolCallSchema,
2021
type ClientToolCall,
2122
type ClientToolName,
2223
type CodebuffToolOutput,
23-
PublishedClientToolName,
2424
} from '../../common/src/tools/list'
2525

2626
import type { CustomToolDefinition } from './custom-tool'
@@ -309,12 +309,13 @@ export class CodebuffClient {
309309
private async handleToolCall(
310310
action: ServerAction<'tool-call-request'>,
311311
): ReturnType<WebSocketHandler['handleToolCall']> {
312-
clientToolCallSchema.parse(action)
313312
const toolName = action.toolName
314313
const input = action.input
315314

316315
let result: ToolResultOutput[]
317-
if (!toolNames.includes(toolName as ToolName)) {
316+
if (toolNames.includes(toolName as ToolName)) {
317+
clientToolCallSchema.parse(action)
318+
} else {
318319
const customToolHandler =
319320
this.promptIdToHandlers[action.userInputId].customToolHandler
320321
if (!customToolHandler) {

0 commit comments

Comments
 (0)