openai / openai/codex

Tool return declarations require a `result` wrapper absent from `structuredContent` (Gmail and GitHub)

Open
#43,132 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug mcp tool-calls
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

Problem

In Code Mode, the model-visible tool declarations describe CallToolResult<{ result: ... }>. Successful calls instead return the payload directly inside structuredContent.

This causes code following the declared return type to read undefined.

Reproduction

With the GitHub connector available, inspect the declaration for github_fetch_issue, then run this inside functions.exec:

const response = await tools.mcp__codex_apps__github_fetch_issue({
  repository_full_name: "openai/codex",
  issue_number: 35277
});
const data = response.structuredContent;

text({
  hasResult: Object.hasOwn(data, "result"),
  hasIssue: Object.hasOwn(data, "issue")
});

Observed:

{"hasResult": false, "hasIssue": true}

The declaration places issue under result. The same discrepancy reproduces with Gmail’s list_labels:

Tool Declared payload path Observed payload path
github_fetch_issue structuredContent.result.issue structuredContent.issue
gmail_list_labels structuredContent.result.labels structuredContent.labels

Both calls succeeded without a tool error.

Expected behavior

The model-visible return declaration should match the object delivered to JavaScript. Add regression coverage comparing the declared and delivered structures.

Environment and scope

Reproduced September 6, 2026 through functions.exec, on macOS 26.6.2. Locally installed CLI: 0.153.4; Gmail plugin manifest: 0.1.10.

The observations establish a declaration/runtime mismatch. They do not establish whether it originates in connector metadata, declaration generation, or result adaptation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Code Mode tool declaration and the functions.exec reproductions for github_fetch_issue and gmail_list_labels. Compare each declared payload path with the delivered structuredContent object, then add regression coverage that verifies the declarations match both tool results.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, javascript, rust
Domain
api, backend-api-design, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.