ai icon indicating copy to clipboard operation
ai copied to clipboard

docs: Missing Tool Results example uses obsolete tool-call and tool-result fields

Open VIOLETee0 opened this issue 1 week ago • 2 comments

Description

The first TypeScript example in Missing Tool Results Error still uses args on a tool-call and result on a tool-result.

Current ModelMessage parts require input and output, with text output represented as { type: 'text', value: 'Sunny, 25°C' }. Readers using the example as model-message history encounter TypeScript errors before resolving their original missing-result problem.

This was found during a Codex-assisted documentation/source review and checked locally. It was not discovered in production, and no live provider was called.

Reproduction

Type-check the page's first example with an explicit ModelMessage[] annotation:

import type { ModelMessage } from 'ai';

const messages: ModelMessage[] = [
  { role: 'user', content: 'What is the weather in NY?' },
  {
    role: 'assistant',
    content: [{
      type: 'tool-call',
      toolCallId: 'call_123',
      toolName: 'getWeather',
      args: { location: 'New York' },
    }],
  },
  {
    role: 'tool',
    content: [{
      type: 'tool-result',
      toolCallId: 'call_123',
      toolName: 'getWeather',
      result: 'Sunny, 25°C',
    }],
  },
  { role: 'user', content: 'And in London?' },
];

Observed: TS2353 for both args and result. A local compiler check using the actual ModelMessage source produced those two diagnostics; replacing the fields in memory with input and tagged output produced no diagnostics. The relevant content-part type source matches the current main revision above.

Expected: the documented history uses the current message types. Proposed scope: update only this first example; no SDK behavior/API/dependency changes.

AI SDK Version

Local checkout: [email protected] at b469f1ef651ef1835c00d617ff1cc8ad8591f7fc; Node.js 24.20.0, TypeScript 6.0.3. The stale example and relevant content-part definitions were rechecked on main at a8f0e9dc55d73f2237759abd263da6ae674de523.

Validation is limited to message-type compatibility; no live provider or full application end-to-end verification was performed.

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

VIOLETee0 avatar Nov 20 '26 09:11 VIOLETee0

Identify issue type

Identified as Documentation
Confidence: High

Rationale

This is a correction to an embedded documentation example, not a failure of SDK behavior or a request to change a runnable example project.

Evidence

  • The troubleshooting page's TypeScript snippet uses obsolete args and result fields instead of current input and tagged output fields.
  • The requested scope is explicitly limited to correcting the documentation example, with no SDK behavior or API changes.

ai-sdk-factory[bot] avatar Nov 20 '26 09:11 ai-sdk-factory[bot]

I'd like to take this.

Plan: update the Missing Tool Results troubleshooting example to current ModelMessage shapes (input on tool-call, structured output on tool-result), type-check the snippet against ModelMessage[], and open a focused docs PR.

Claiming #25306.

AbbasFullstack avatar Nov 20 '26 10:11 AbbasFullstack