{"record":{"id":"958a66d30b97697c","repo":"continuedev/continue","slug":"unsupported-tool-type-in-bedrock-tool-type","errorCode":null,"errorMessage":"Unsupported tool type in Bedrock: ${tool.type}","messagePattern":"Unsupported tool type in Bedrock: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/openai-adapters/src/apis/Bedrock.ts","lineNumber":368,"sourceCode":"    const availableTools = new Set<string>();\n    let toolConfig: ToolConfiguration | undefined = undefined;\n\n    if (oaiBody.tools && oaiBody.tools.length > 0) {\n      toolConfig = {\n        tools: oaiBody.tools.map((tool) => {\n          // Type guard for function tools\n          if (tool.type === \"function\" && \"function\" in tool) {\n            return {\n              toolSpec: {\n                name: tool.function.name,\n                description: tool.function.description,\n                inputSchema: {\n                  json: tool.function.parameters,\n                },\n              },\n            };\n          } else {\n            throw new Error(`Unsupported tool type in Bedrock: ${tool.type}`);\n          }\n        }),\n      } as ToolConfiguration;\n\n      // Add cache point if needed\n      // if (this.config.cacheBehavior?.cacheSystemMessage) {\n      //   toolConfig!.tools!.push({ cachePoint: { type: \"default\" } });\n      // }\n\n      oaiBody.tools.forEach((tool) => {\n        if (tool.type === \"function\" && \"function\" in tool) {\n          availableTools.add(tool.function.name);\n        }\n      });\n    }\n\n    // Convert messages\n    const convertedMessages = this._convertMessages(","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/openai-adapters/src/apis/Bedrock.ts#L350-L386","documentation":"_convertBody converts OpenAI-style tool definitions into Bedrock's ToolConfiguration, which only supports function tools ('type: \"function\"'). If a tool has any other type value, the adapter throws with the offending type so the request never reaches Bedrock with a payload it would reject or misinterpret.","triggerScenarios":"Passing tools: [{ type: 'custom' | 'retrieval' | ... , ... }] in the chat completion body to the Bedrock provider; any tool entry whose type is not exactly 'function'.","commonSituations":"Forwarding tool lists authored for another provider (e.g. Anthropic server tools, OpenAI hosted tools like web_search) to Bedrock; dynamically generated tool definitions that set type from user input or default to undefined.","solutions":["Normalize all tool entries to { type: 'function', function: { name, description, parameters } } before sending to Bedrock","Filter out non-function tools (e.g. web_search, code_interpreter) for Bedrock requests or run them client-side","If a tool object lacks type, set it explicitly to 'function'"],"exampleFix":"// before\ntools: [{ type: 'web_search_preview' }]\n\n// after\ntools: [{ type: 'function', function: { name: 'get_weather', description: 'Get weather', parameters: { type: 'object', properties: { city: { type: 'string' } }, required: ['city'] } } }]","handlingStrategy":"validation","validationCode":"const ok = (body.tools ?? []).every(t => t.type === 'function');\nif (!ok) throw new Error('Bedrock only supports function tools');\n// or normalize: tools = tools.map(t => ({ ...t, type: 'function' })) when safe","typeGuard":"const isFunctionTool = (t: ChatCompletionTool): t is { type: 'function'; function: { name: string; parameters?: object } } =>\n  t.type === 'function' && typeof (t as any).function?.name === 'string';","tryCatchPattern":"try { return await bedrock.chatCompletion(body, signal); }\ncatch (e) {\n  if (e instanceof Error && e.message.startsWith('Unsupported tool type in Bedrock:')) {\n    body.tools = body.tools!.filter(isFunctionTool);\n    return await bedrock.chatCompletion(body, signal);\n  }\n  throw e;\n}","preventionTips":["Author tool definitions in the portable function format only; avoid provider-specific hosted tools in shared configs","Validate tools against the target provider before sending; strip or emulate non-function tools"],"tags":["bedrock","tools","function-calling","validation"],"backgroundTag":"unsupported-tool-type","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}