continuedev/continue · error · Error

Unsupported tool type: ${tool.type}

Error message

Unsupported tool type: ${tool.type}

What it means

convertTools only handles OpenAI tools of type 'function' when translating to AskSage's tool format. Any other tool type falls through to a throw naming the unsupported type. AskSage's function-calling API only accepts plain function tools.

Source

Thrown at packages/openai-adapters/src/apis/AskSage.ts:220

  private convertTools(
    tools?: ChatCompletionCreateParamsNonStreaming["tools"],
  ): AskSageTool[] | undefined {
    if (!tools || tools.length === 0) {
      return undefined;
    }

    return tools.map((tool) => {
      if (tool.type === "function" && "function" in tool) {
        return {
          type: tool.type,
          function: {
            name: tool.function.name,
            description: tool.function.description,
            parameters: tool.function.parameters as Record<string, unknown>,
          },
        };
      }
      throw new Error(`Unsupported tool type: ${tool.type}`);
    });
  }

  /**
   * Convert OpenAI tool_choice to AskSage format
   */
  private convertToolChoice(
    toolChoice?: ChatCompletionCreateParamsNonStreaming["tool_choice"],
  ): AskSageToolChoice | undefined {
    if (!toolChoice) {
      return undefined;
    }
    if (toolChoice === "auto" || toolChoice === "none") {
      return toolChoice;
    }
    if (typeof toolChoice === "object" && "function" in toolChoice) {
      return {
        type: "function",

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Set type:'function' on every tool with a valid function object
  2. Filter tools to type==='function' before calling the adapter
  3. Validate tool schemas against the function-tool shape before sending

Example fix

// before
const tools = [{ function: { name: 'search', parameters: {} } }]; // missing type

// after
const tools = [{ type: 'function', function: { name: 'search', parameters: {} } }];
Defensive patterns

Strategy: validation

Validate before calling

const safeTools = tools.filter(t => t.type === 'function' && t.function?.name);

Type guard

function isFunctionTool(t: any): t is { type: 'function'; function: { name: string } } {
  return t?.type === 'function' && typeof t.function?.name === 'string';
}

Try / catch

try { return await api.chatCompletionNonStream({ ...body, tools: safeTools }, signal); }
catch (e) { if (/Unsupported tool type/.test(String(e))) { return await api.chatCompletionNonStream({ ...body, tools: safeTools }, signal); } throw e; }

Prevention

When it happens

Trigger: Passing a tools array containing an entry whose type is not 'function' (or is undefined) to AskSage chatCompletion*; e.g. leftover OpenAI-specific tool types.

Common situations: Sharing tool definitions between providers where some include non-function types; forgetting the type field so it becomes undefined; newer OpenAI tool types unsupported by AskSage.

Related errors


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