{"record":{"id":"6b608c7e360e4464","repo":"continuedev/continue","slug":"unsupported-tool-type-tool-type","errorCode":null,"errorMessage":"Unsupported tool type: ${tool.type}","messagePattern":"Unsupported tool type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/openai-adapters/src/apis/AskSage.ts","lineNumber":220,"sourceCode":"  private convertTools(\n    tools?: ChatCompletionCreateParamsNonStreaming[\"tools\"],\n  ): AskSageTool[] | undefined {\n    if (!tools || tools.length === 0) {\n      return undefined;\n    }\n\n    return tools.map((tool) => {\n      if (tool.type === \"function\" && \"function\" in tool) {\n        return {\n          type: tool.type,\n          function: {\n            name: tool.function.name,\n            description: tool.function.description,\n            parameters: tool.function.parameters as Record<string, unknown>,\n          },\n        };\n      }\n      throw new Error(`Unsupported tool type: ${tool.type}`);\n    });\n  }\n\n  /**\n   * Convert OpenAI tool_choice to AskSage format\n   */\n  private convertToolChoice(\n    toolChoice?: ChatCompletionCreateParamsNonStreaming[\"tool_choice\"],\n  ): AskSageToolChoice | undefined {\n    if (!toolChoice) {\n      return undefined;\n    }\n    if (toolChoice === \"auto\" || toolChoice === \"none\") {\n      return toolChoice;\n    }\n    if (typeof toolChoice === \"object\" && \"function\" in toolChoice) {\n      return {\n        type: \"function\",","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/openai-adapters/src/apis/AskSage.ts#L202-L238","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set type:'function' on every tool with a valid function object","Filter tools to type==='function' before calling the adapter","Validate tool schemas against the function-tool shape before sending"],"exampleFix":"// before\nconst tools = [{ function: { name: 'search', parameters: {} } }]; // missing type\n\n// after\nconst tools = [{ type: 'function', function: { name: 'search', parameters: {} } }];","handlingStrategy":"validation","validationCode":"const safeTools = tools.filter(t => t.type === 'function' && t.function?.name);","typeGuard":"function isFunctionTool(t: any): t is { type: 'function'; function: { name: string } } {\n  return t?.type === 'function' && typeof t.function?.name === 'string';\n}","tryCatchPattern":"try { return await api.chatCompletionNonStream({ ...body, tools: safeTools }, signal); }\ncatch (e) { if (/Unsupported tool type/.test(String(e))) { return await api.chatCompletionNonStream({ ...body, tools: safeTools }, signal); } throw e; }","preventionTips":["Always include explicit type:'function' on tool definitions","Share a validated tool registry across providers"],"tags":["asksage","tool-calls","schema-validation"],"backgroundTag":"unsupported-tool-type","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}