{"record":{"id":"f6f4c283d4e3c9cd","repo":"vercel/ai","slug":"deepseek-strict-mode-requires-every-function-tool","errorCode":null,"errorMessage":"DeepSeek strict mode requires every function tool in the request to set `strict: true`.","messagePattern":"DeepSeek strict mode requires every function tool in the request to set `strict: true`\\.","errorType":"exception","errorClass":"UnsupportedFunctionalityError","httpStatus":null,"severity":"error","filePath":"packages/deepseek/src/chat/deepseek-prepare-tools.ts","lineNumber":49,"sourceCode":"  }\n\n  const functionTools = tools.filter(tool => tool.type === 'function');\n  const hasStrictTool = functionTools.some(tool => tool.strict === true);\n\n  if (hasStrictTool && supportsStrictToolCalls === false) {\n    throw new UnsupportedFunctionalityError({\n      functionality: 'DeepSeek strict tool calls',\n      message:\n        'DeepSeek strict tool calls require a beta base URL ending in `/beta`.',\n    });\n  }\n\n  if (\n    hasStrictTool &&\n    supportsStrictToolCalls === true &&\n    functionTools.some(tool => tool.strict !== true)\n  ) {\n    throw new UnsupportedFunctionalityError({\n      functionality: 'mixed DeepSeek strict and non-strict tool calls',\n      message:\n        'DeepSeek strict mode requires every function tool in the request to set `strict: true`.',\n    });\n  }\n\n  const deepseekTools: Array<DeepSeekFunctionTool> = [];\n\n  for (const tool of tools) {\n    if (tool.type === 'provider') {\n      toolWarnings.push({\n        type: 'unsupported',\n        feature: `provider-defined tool ${tool.id}`,\n      });\n    } else {\n      deepseekTools.push({\n        type: 'function',\n        function: {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/deepseek/src/chat/deepseek-prepare-tools.ts#L31-L67","documentation":"DeepSeek strict mode is all-or-nothing: when strict tool calls are supported and any function tool sets strict: true, every function tool in the request must also set strict: true. prepareTools throws UnsupportedFunctionalityError ('mixed DeepSeek strict and non-strict tool calls') otherwise.","triggerScenarios":"Sending a tools object where at least one tool has strict: true and another has strict: false, strict undefined, or is a non-function tool mixed path — with a /beta base URL.","commonSituations":"Adding a new tool without strict: true to an existing strict-mode setup; third-party tool sets that don't set strict; conditionally including a legacy tool alongside strict ones.","solutions":["Set strict: true on every function tool passed in the request","Or remove strict: true from all tools (mixed mode is not allowed)","Audit the assembled tools object to ensure all function tools carry strict: true"],"exampleFix":"// before\nconst tools = {\n  a: tool({ ..., strict: true }),\n  b: tool({ ... }) // no strict\n};\n// after\nconst tools = {\n  a: tool({ ..., strict: true }),\n  b: tool({ ..., strict: true })\n};","handlingStrategy":"validation","validationCode":"function assertUniformStrict(tools) {\n  const fns = Object.values(tools).filter(t => t?.type === 'function' ?? true);\n  const strictFlags = fns.map(t => t.strict === true);\n  if (strictFlags.some(Boolean) && !strictFlags.every(Boolean)) {\n    throw new Error('DeepSeek strict mode requires strict: true on every function tool');\n  }\n}","typeGuard":"function isStrictTool(t): t is typeof t & { strict: true } {\n  return (t as any).strict === true;\n}","tryCatchPattern":"try { ... } catch (e) { if (UnsupportedFunctionalityError.isInstance(e) && /strict and non-strict/.test(e.message)) { /* set strict on all tools and retry */ } throw e; }","preventionTips":["Set strict: true in a shared tool() wrapper so all tools inherit it","Audit dynamically assembled tool sets for missing strict flags","When adding new tools to a strict-mode app, always pass strict: true"],"tags":["deepseek","tools","strict","consistency"],"backgroundTag":"mixed-strict-tool-mode","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}