Skip to content

Deepseek and MCPs ($ref/$defs in MCP tool schemas causes AttributeError) #32829

Description

@meerestier

Description

Title: DeepSeek provider: $ref/$defs in MCP tool schemas causes AttributeError
Description:
Version: opencode 1.17.5
Provider: DeepSeek
Affected MCP servers: Asana (mcp.asana.com/v2/mcp), Notion (@notionhq/notion-mcp-server)

Error:
Error from provider: Error resolving schema reference '#/$defs/richTextRequest': AttributeError("'NoneType' object has no attribute 'lookup'")
Possible cause: MCP servers output valid JSON Schema 2020-12 with $ref → $defs references. DeepSeek's API (like Fireworks, Anthropic, Gemini) strictly validates schemas and rejects unresolved $ref pointers. The same error occurs with Notion MCP (#/properties/sections/items/properties/tasks/items/properties/assignee).
Expected fix: opencode should dereference/flatten $ref before sending to DeepSeek — similar to the Gemini sanitization done in #12292.
Workaround: Disable affected MCP servers or switch to a provider that handles $ref natively (e.g. OpenAI).
References:

Plugins

No response

OpenCode version

1.17.5

Steps to reproduce

{
"$schema": "https://opencode.ai/config.json",
"small_model": "google/gemini-3-flash-preview",
"mcp": {
"asana": {
"type": "remote",
"url": "https://mcp.asana.com/v2/mcp",
"oauth": {
"clientId": "{env:ASANA_MCP_CLIENT_ID}",
"clientSecret": "{env:ASANA_MCP_CLIENT_SECRET}"
}
},
"chrome-devtools": {
"type": "local",
"command": ["npx", "-y", "chrome-devtools-mcp@latest"]
},
"figma": {
"type": "local",
"command": ["npx", "-y", "figma-mcp"]
},
"notion-sys": {
"type": "local",
"command": ["npx", "-y", "@notionhq/notion-mcp-server"],
"environment": {
"NOTION_TOKEN": "xyz"
}
},
"notion-lv": {
"type": "local",
"command": ["npx", "-y", "@notionhq/notion-mcp-server"],
"environment": {
"NOTION_TOKEN": "xyz"
}
}
}
}

Screenshot and/or share link

No response

Operating System

macOS 26.4.1

Terminal

Nova, System bash

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions