continuedev/continue · error · Error

Unsupported tool type in Bedrock: ${tool.type}

Error message

Unsupported tool type in Bedrock: ${tool.type}

What it means

_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.

Source

Thrown at packages/openai-adapters/src/apis/Bedrock.ts:368

    const availableTools = new Set<string>();
    let toolConfig: ToolConfiguration | undefined = undefined;

    if (oaiBody.tools && oaiBody.tools.length > 0) {
      toolConfig = {
        tools: oaiBody.tools.map((tool) => {
          // Type guard for function tools
          if (tool.type === "function" && "function" in tool) {
            return {
              toolSpec: {
                name: tool.function.name,
                description: tool.function.description,
                inputSchema: {
                  json: tool.function.parameters,
                },
              },
            };
          } else {
            throw new Error(`Unsupported tool type in Bedrock: ${tool.type}`);
          }
        }),
      } as ToolConfiguration;

      // Add cache point if needed
      // if (this.config.cacheBehavior?.cacheSystemMessage) {
      //   toolConfig!.tools!.push({ cachePoint: { type: "default" } });
      // }

      oaiBody.tools.forEach((tool) => {
        if (tool.type === "function" && "function" in tool) {
          availableTools.add(tool.function.name);
        }
      });
    }

    // Convert messages
    const convertedMessages = this._convertMessages(

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Normalize all tool entries to { type: 'function', function: { name, description, parameters } } before sending to Bedrock
  2. Filter out non-function tools (e.g. web_search, code_interpreter) for Bedrock requests or run them client-side
  3. If a tool object lacks type, set it explicitly to 'function'

Example fix

// before
tools: [{ type: 'web_search_preview' }]

// after
tools: [{ type: 'function', function: { name: 'get_weather', description: 'Get weather', parameters: { type: 'object', properties: { city: { type: 'string' } }, required: ['city'] } } }]
Defensive patterns

Strategy: validation

Validate before calling

const ok = (body.tools ?? []).every(t => t.type === 'function');
if (!ok) throw new Error('Bedrock only supports function tools');
// or normalize: tools = tools.map(t => ({ ...t, type: 'function' })) when safe

Type guard

const isFunctionTool = (t: ChatCompletionTool): t is { type: 'function'; function: { name: string; parameters?: object } } =>
  t.type === 'function' && typeof (t as any).function?.name === 'string';

Try / catch

try { return await bedrock.chatCompletion(body, signal); }
catch (e) {
  if (e instanceof Error && e.message.startsWith('Unsupported tool type in Bedrock:')) {
    body.tools = body.tools!.filter(isFunctionTool);
    return await bedrock.chatCompletion(body, signal);
  }
  throw e;
}

Prevention

When it happens

Trigger: Passing tools: [{ type: 'custom' | 'retrieval' | ... , ... }] in the chat completion body to the Bedrock provider; any tool entry whose type is not exactly 'function'.

Common situations: 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.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/958a66d30b97697c. Report an issue: GitHub.