# AI SDK 7 Tools and Structured Output

`ai-sdk/tools-and-structured-output` · Skill · v1.0.0

Correct Vercel AI SDK 7 tool calling, multi-step loops, agents and structured output, with the v4-v6 habits that silently break and mock-model tests.

Teaches an agent the current Vercel AI SDK (the `ai` package, version 7) for tools, tool loops, ToolLoopAgent, conversation persistence and structured output. It centres on the old forms that no longer fail loudly in 7.x: `parameters` sends the model an empty schema, `maxSteps` and a missing `stopWhen` stop after one step, `maxTokens` is ignored, `experimental_context` is gone, system messages inside `messages` now throw, and `result.response.messages` holds only the final step. Each rule was checked by running it against ai@7.0.159. It also covers testing with `MockLanguageModelV4` from `ai/test`, so the agent proves the behaviour without a provider.

## Verdict

- level: **submitted** — In the catalog, not yet checked for this digest.
- uplift: **untested** — No runs exist for this digest.
- digest: `sha256:2190167c9b043b9f9fd7ddde040cb28ee133721226392137f0969d72fc89b7e5`

## Uplift runs

None for this digest. Untested is not the same as useless: nobody has measured it yet.

## Security

No checks recorded for this digest.

## Compatibility

| agent | targeted | compiled | evaluated |
| --- | --- | --- | --- |
| Claude Code | yes | no record | no record |
| Codex | yes | no record | no record |
| Cursor | yes | no record | no record |
| GitHub Copilot | yes | no record | no record |
| Gemini CLI | yes | no record | no record |
| OpenCode | yes | no record | no record |

## Permissions

- network: none
- shell: npx tsc, node --test, npm test, grep
- filesystem: write
- env: none

## Files

- `SKILL.md` 13863 B sha256:2aa02667dbc0a2f3f1d99818ceb6f00d863673d67df8eb981cfcf583b686aa34
- `references/agents-and-context.md` 6686 B sha256:d430abfb82a1820e0923cc5d004ff502f35758115ec397310a976b77c1f1300a
- `references/migration-v4-to-v7.md` 7433 B sha256:4db07e44d398079f31c6ff31f88db798b273d531e405afb539427e8796e8cbec
- `references/sources.md` 1913 B sha256:21412746599e7c4ffbcd626346b315b7d712b394624b2cdc2dc6b99ff08f488b
- `references/structured-output.md` 3803 B sha256:7edf18676208fc08c9f4df987e812bd8e928167fdfa57226e6e36771c40f2852
- `references/testing.md` 4678 B sha256:3a78d2ee824e6ca2339bfc8e064a3d6e37cc9feadab739f4329de95ce826410a

## Limitations

- Written for ai 7.x (checked against 7.0.159). Projects on AI SDK 5 or 6 should use the migration table to tell which names apply; v3 and older are not covered.
- Covers AI SDK Core (generateText, streamText, ToolLoopAgent, Output). AI SDK UI hooks (useChat), RSC, WorkflowAgent, MCP clients and provider-specific options are out of scope.
- Provider behaviour (which models support strict schemas, parallel tool calls or approvals) varies; the skill states SDK behaviour only, verified with the SDK mock model, not with live providers.
- The proof suite exercises Node with node:test and the SDK's mock model; it does not test streaming UIs or real network providers.

## Install

```sh
npx sigil add ai-sdk/tools-and-structured-output --agent claude-code,codex,cursor
```

Source: https://github.com/dgesteves/sigil/tree/5cb851d5b2f2f14446ddf631ef5e91bf9d3263dd/catalog/skills/ai-sdk/tools-and-structured-output