Skip to content

[Bug] Chat completions rejects custom tools with key 'function' not found #1080

Description

Describe the issue

The OpenAI-compatible /v1/chat/completions endpoint rejects a request containing a custom/freeform tool definition. The server assumes every tool contains a function property and returns HTTP 400 for a tool whose type is custom.

Observed response:

Invalid request: [json.exception.out_of_range.403] key 'function' not found

A control request containing only a standard function tool passes tool parsing. The expected behavior is either to accept the custom tool schema or return a clear unsupported-tool-type error rather than attempting to read a missing function property.

To reproduce

  1. Use Microsoft.AI.Foundry.Local version 2.0.1.
  2. Load qwen3.5-2b-text-cuda-gpu:1 and start the local web service.
  3. POST to /v1/chat/completions with one standard function tool and this additional tool:
{
  "type": "custom",
  "custom": {
    "name": "freeform_tool",
    "description": "Accepts freeform input.",
    "format": {
      "type": "grammar",
      "grammar": {
        "syntax": "lark",
        "definition": "start: /(?s).+/"
      }
    }
  }
}

The response is HTTP 400 with key 'function' not found. Sending the same request without the custom tool progresses past request parsing.

Urgency

This prevents clients using OpenAI-compatible custom/freeform tool schemas from sending those requests to Foundry Local.

System information

  • Platform and architecture: Windows X64
  • OS version: Windows 11
  • Installation type: Released package/binary
  • Foundry Local version: Microsoft.AI.Foundry.Local 2.0.1
  • API or surface area: REST API
  • Hardware acceleration/backend: WebGPU/CUDA
  • Backend/runtime version: ONNX Runtime 1.28.0; ONNX Runtime GenAI 0.15.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions