Skip to content

Anthropic LLM failed to generate agent: Tool 'json' not found in provided tools #14710

@atomicpages

Description

@atomicpages

Description

Tested with Sonnet 4.5 and Opus 4.5 + 4.6. I pulled the latest from dev on github and have the full error detailed below. I see the JSON tools id efined

{
  "name": "AI_APICallError",
  "url": "https://api.anthropic.com/v1/messages",
  "requestBodyValues": {
    "model": "claude-sonnet-4-5-20250929",
    "max_tokens": 64000,
    "temperature": 0.3,
    "system": [
      {
        "type": "text",
        "text": "You are Claude Code, Anthropic's official CLI for Claude."
      },
      {
        "type": "text",
        "text": "...."
      }
    ],
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "..."
          }
        ]
      }
    ],
    "tools": [
      {
        "name": "json",
        "description": "Respond with a JSON object.",
        "input_schema": {
          "$schema": "http://json-schema.org/draft-07/schema#",
          "type": "object",
          "properties": {
            "identifier": {
              "type": "string"
            },
            "whenToUse": {
              "type": "string"
            },
            "systemPrompt": {
              "type": "string"
            }
          },
          "required": ["identifier", "whenToUse", "systemPrompt"],
          "additionalProperties": false
        }
      }
    ],
    "tool_choice": {
      "type": "tool",
      "name": "json",
      "disable_parallel_tool_use": true
    }
  },
  "statusCode": 400,
  "responseBody": "{\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"Tool 'json' not found in provided tools\"},\"request_id\":\"****\"}",
  "isRetryable": false,
  "data": {
    "type": "error",
    "error": {
      "type": "invalid_request_error",
      "message": "Tool 'json' not found in provided tools"
    }
  }
}

I had Opus take a crack at fixing it and the problem seems to be resolved. Here's a copy of my session: session-ses_37bf.md I'm happy to make a PR with this fix if it's fine. LMK!

Plugins

None

OpenCode version

1.2.10

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions