ChatGPT Work Tool and Skill Reference

ChatGPT Work Tool and Skill Reference

ChatGPT 工作工具与技能参考

apply_patch

built-in The apply_patch tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.

内置工具 apply_patch 工具可用于编辑文件。这是一个自由格式(FREEFORM)工具,因此请勿将补丁内容包裹在 JSON 中。

Official description & argument declaration The apply_patch tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON. exec tool declaration:

declare const tools: { apply_patch(input: string): Promise<unknown>; };

官方描述与参数声明 apply_patch 工具可用于编辑文件。这是一个自由格式(FREEFORM)工具,因此请勿将补丁内容包裹在 JSON 中。 执行工具声明:

declare const tools: { apply_patch(input: string): Promise<unknown>; };

exec_command

built-in Runs a command in a PTY, returning output or a session ID for ongoing interaction.

内置工具 在 PTY(伪终端)中运行命令,返回输出结果或用于持续交互的会话 ID。

Official description & argument declaration Runs a command in a PTY, returning output or a session ID for ongoing interaction. exec tool declaration:

declare const tools: { exec_command(args: { cmd: string; justification?: string; login?: boolean; max_output_tokens?: number; prefix_rule?: Array<string>; sandbox_permissions?: "use_default" | "require_escalated"; shell?: string; tty?: boolean; workdir?: string; yield_time_ms?: number; }): Promise<{ chunk_id?: string; exit_code?: number; original_token_count?: number; output: string; session_id?: number; wall_time_seconds: number; }>; };

官方描述与参数声明 在 PTY 中运行命令,返回输出结果或用于持续交互的会话 ID。 执行工具声明:

declare const tools: { exec_command(args: { cmd: string; justification?: string; login?: boolean; max_output_tokens?: number; prefix_rule?: Array<string>; sandbox_permissions?: "use_default" | "require_escalated"; shell?: string; tty?: boolean; workdir?: string; yield_time_ms?: number; }): Promise<{ chunk_id?: string; exit_code?: number; original_token_count?: number; output: string; session_id?: number; wall_time_seconds: number; }>; };

functions.exec

direct control Run JavaScript code to orchestrate/compose tool calls - Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.

直接控制 运行 JavaScript 代码以编排/组合工具调用——在全新的 V8 隔离环境中将提供的 JavaScript 代码作为异步模块进行评估。

Official description & argument declaration Run JavaScript code to orchestrate/compose tool calls - Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.

  • All nested tools are available on the global tools object.
  • Nested tool methods take either a string or an object as their input argument.
  • Runs raw JavaScript — no Node, no file system, no network access, no console.
  • Accepts raw JavaScript source text, not JSON, quoted strings, or markdown code fences. exec tool declaration:
declare const functions: { exec(input: string): Promise<any>; };

官方描述与参数声明 运行 JavaScript 代码以编排/组合工具调用——在全新的 V8 隔离环境中将提供的 JavaScript 代码作为异步模块进行评估。

  • 所有嵌套工具均可在全局 tools 对象上使用。
  • 嵌套工具方法接受字符串或对象作为输入参数。
  • 运行原生 JavaScript —— 无 Node 环境、无文件系统、无网络访问、无控制台。
  • 接受原生 JavaScript 源代码文本,而非 JSON、带引号的字符串或 Markdown 代码块。 执行工具声明:
declare const functions: { exec(input: string): Promise<any>; };

functions.request_user_input

direct control Request user input for one to three short questions and wait for the response. This tool is only available in Default or Plan mode.

直接控制 请求用户输入一到三个简短问题并等待回复。此工具仅在“默认(Default)”或“计划(Plan)”模式下可用。

Official description & argument declaration Request user input for one to three short questions and wait for the response. This tool is only available in Default or Plan mode. exec tool declaration:

declare const functions: { request_user_input(args: { questions: Array<{ header: string; id: string; options: Array<{ description: string; label: string; }>; question: string; }>; }): Promise<any>; };

官方描述与参数声明 请求用户输入一到三个简短问题并等待回复。此工具仅在“默认”或“计划”模式下可用。 执行工具声明:

declare const functions: { request_user_input(args: { questions: Array<{ header: string; id: string; options: Array<{ description: string; label: string; }>; question: string; }>; }): Promise<any>; };

functions.wait

direct control Waits on a yielded exec cell and returns new output or completion.

直接控制 等待已让出的 exec 单元格,并返回新的输出或完成状态。

Official description & argument declaration Waits on a yielded exec cell and returns new output or completion.

  • Use wait only after exec returns Script running with cell ID ....
  • cell_id identifies the running exec cell to resume.
  • yield_time_ms controls how long to wait for more output before yielding again. Defaults to 10000 ms.
  • max_tokens limits how much new output this wait call returns. Defaults to 10000 tokens.
  • terminate: true stops the running cell; false or omitted waits for output.
  • wait returns only the new output since the last yield, or the final completion or termination result for that cell. exec tool declaration:
declare const functions: { wait(args: { cell_id: string; max_tokens?: number; terminate?: boolean; yield_time_ms?: number; }): Promise<any>; };

官方描述与参数声明 等待已让出的 exec 单元格,并返回新的输出或完成状态。

  • 仅在 exec 返回 Script running with cell ID ... 后使用 wait
  • cell_id 用于标识要恢复运行的 exec 单元格。
  • yield_time_ms 控制在再次让出前等待更多输出的时间,默认为 10000 毫秒。
  • max_tokens 限制此等待调用返回的新输出量,默认为 10000 token。
  • terminate: true 会停止正在运行的单元格;为 false 或省略则等待输出。
  • wait 仅返回自上次让出以来的新输出,或该单元格的最终完成/终止结果。 执行工具声明:
declare const functions: { wait(args: { cell_id: string; max_tokens?: number; terminate?: boolean; yield_time_ms?: number; }): Promise<any>; };

update_plan

built-in Updates the task plan. Provide an optional explanation and a list of plan items, each with a step and status. At most one step can be in_progress at a time.

内置工具 更新任务计划。提供可选的解释和计划项列表,每个项包含步骤和状态。同一时间最多只能有一个步骤处于 in_progress(进行中)状态。

Official description & argument declaration Updates the task plan. Provide an optional explanation and a list of plan items, each with a step and status. At most one step can be in_progress at a time. exec tool declaration:

declare const tools: { update_plan(args: { explanation?: string; plan: Array<{ status: "pending" | "in_progress" | "completed"; step: string; }>; }): Promise<unknown>; };

官方描述与参数声明 更新任务计划。提供可选的解释和计划项列表,每个项包含步骤和状态。同一时间最多只能有一个步骤处于进行中状态。 执行工具声明:

declare const tools: { update_plan(args: { explanation?: string; plan: Array<{ status: "pending" | "in_progress" | "completed"; step: string; }>; }): Promise<unknown>; };

view_image

built-in View a local image file from the filesystem when visual inspection is needed. Use this for images already available on disk.

内置工具 当需要视觉检查时,查看文件系统中的本地图像文件。此工具适用于磁盘上已有的图像。

Official description & argument declaration View a local image file from the filesystem when visual inspection is needed. Use this for images already available on disk. exec tool declaration:

declare const tools: { view_image(args: { detail?: "high" | "original"; path: string; }): Promise<{ detail: "high" | "original"; image_url: string; }>; };

官方描述与参数声明 当需要视觉检查时,查看文件系统中的本地图像文件。此工具适用于磁盘上已有的图像。 执行工具声明:

declare const tools: { view_image(args: { detail?: "high" | "original"; path: string; }): Promise<{ detail: "high" | "original"; image_url: string; }>; };