Skip to content

Commit 6230c16

Browse files
committed
Change generic arg name so type rollup doesn't bug out
1 parent 0beabc7 commit 6230c16

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sdk/src/custom-tool.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from 'zod/v4'
22

3-
import type { ToolName as CodebuffToolName } from '../../common/src/tools/constants'
3+
import type { ToolName } from '../../common/src/tools/constants'
44
import type { ToolResultOutput } from '../../common/src/types/messages/content-part'
55
import type { JSONSchema } from 'zod/v4/core'
66

@@ -30,7 +30,7 @@ export type CustomToolDefinition<
3030
* @returns a {@linkcode CustomToolDefinition} object
3131
*/
3232
export function getCustomToolDefinition<
33-
ToolName extends string,
33+
TN extends string,
3434
Args extends any,
3535
Input extends any,
3636
>({
@@ -41,17 +41,17 @@ export function getCustomToolDefinition<
4141
exampleInputs = [],
4242
execute,
4343
}: {
44-
toolName: ToolName extends CodebuffToolName
45-
? ToolName & {
46-
error: `Use overrideTools instead of custom tool for name: ${ToolName}`
44+
toolName: TN extends ToolName
45+
? TN & {
46+
error: `Hi there. This is a message from the Codebuff team: You have used a custom tool where you needed to use overrideTools instead for name: ${TN}`
4747
}
48-
: ToolName
48+
: TN
4949
inputSchema: z.ZodType<Args, Input>
5050
description: string
5151
endsAgentStep?: boolean
5252
exampleInputs?: Input[]
5353
execute: (params: Args) => Promise<ToolResultOutput[]> | ToolResultOutput[]
54-
}): CustomToolDefinition<ToolName, Args, Input> {
54+
}): CustomToolDefinition<TN, Args, Input> {
5555
return {
5656
toolName,
5757
zodSchema: inputSchema,

0 commit comments

Comments
 (0)