-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expand file tree
/
Copy pathindex.ts
More file actions
77 lines (71 loc) · 2.3 KB
/
index.ts
File metadata and controls
77 lines (71 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import type OpenAI from "openai"
import accessMcpResource from "./access_mcp_resource"
import { apply_diff } from "./apply_diff"
import applyPatch from "./apply_patch"
import askFollowupQuestion from "./ask_followup_question"
import attemptCompletion from "./attempt_completion"
import codebaseSearch from "./codebase_search"
import editTool from "./edit"
import executeCommand from "./execute_command"
import generateImage from "./generate_image"
import listFiles from "./list_files"
import newTask from "./new_task"
import readLints from "./read_lints"
import readCommandOutput from "./read_command_output"
import { createReadFileTool, type ReadFileToolOptions } from "./read_file"
import runSlashCommand from "./run_slash_command"
import skill from "./skill"
import searchReplace from "./search_replace"
import edit_file from "./edit_file"
import searchFiles from "./search_files"
import switchMode from "./switch_mode"
import updateTodoList from "./update_todo_list"
import writeToFile from "./write_to_file"
export { getMcpServerTools } from "./mcp_server"
export { convertOpenAIToolToAnthropic, convertOpenAIToolsToAnthropic } from "./converters"
export type { ReadFileToolOptions } from "./read_file"
/**
* Options for customizing the native tools array.
*/
export interface NativeToolsOptions {
/** Whether the model supports image processing (default: false) */
supportsImages?: boolean
}
/**
* Get native tools array, optionally customizing based on settings.
*
* @param options - Configuration options for the tools
* @returns Array of native tool definitions
*/
export function getNativeTools(options: NativeToolsOptions = {}): OpenAI.Chat.ChatCompletionTool[] {
const { supportsImages = false } = options
const readFileOptions: ReadFileToolOptions = {
supportsImages,
}
return [
accessMcpResource,
apply_diff,
applyPatch,
askFollowupQuestion,
attemptCompletion,
codebaseSearch,
executeCommand,
generateImage,
listFiles,
newTask,
readLints,
readCommandOutput,
createReadFileTool(readFileOptions),
runSlashCommand,
skill,
searchReplace,
edit_file,
editTool,
searchFiles,
switchMode,
updateTodoList,
writeToFile,
] satisfies OpenAI.Chat.ChatCompletionTool[]
}
// Backward compatibility: export default tools with line ranges enabled
export const nativeTools = getNativeTools()