tool_calls and an empty answer?

Understand the tool step before treating empty content as a failed answer.

finish_reason: "tool_calls" with content: null can be a normal tool request. The assistant is asking your application to do a step before it has a final answer. Check message.tool_calls instead of trying to parse the empty content as JSON.

Inspect a tool-call example

The example opens in the existing browser-local inspector. It needs no account or key and makes no model request. All data below is handwritten; lookup_demo_status is a fictional function.

Read the tool request, not just content

Handwritten tool-call response
{
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": null,
        "tool_calls": [
          {
            "id": "call_demo_status",
            "type": "function",
            "function": {
              "name": "lookup_demo_status",
              "arguments": "{\"item_id\":\"DEMO-1\"}"
            }
          }
        ]
      },
      "finish_reason": "tool_calls"
    }
  ]
}

In this example, the call ID is call_demo_status. The function name and its JSON-encoded arguments belong to the tool request. They are not the final assistant answer. Null content by itself does not tell you whether a call succeeded.

OpenAI Chat Completions field definitions

Return a result with the matching tool_call_id

  1. Keep the assistant message containing the tool calls in your conversation. Preserve any additional fields required by your provider.
  2. In your application, check each requested function name and validate its arguments against the function's schema before calling your own permitted implementation. A JSON parse alone does not validate the parameters.
  3. Append a role: "tool" message for each call, using that call's exact ID in tool_call_id. Return the actual tool result, then continue through a model and endpoint that support this flow.
Handwritten follow-up messages
[
  {
    "role": "user",
    "content": "Check the status of demo item DEMO-1."
  },
  {
    "role": "assistant",
    "content": null,
    "tool_calls": [
      {
        "id": "call_demo_status",
        "type": "function",
        "function": {
          "name": "lookup_demo_status",
          "arguments": "{\"item_id\":\"DEMO-1\"}"
        }
      }
    ]
  },
  {
    "role": "tool",
    "tool_call_id": "call_demo_status",
    "content": "{\"status\":\"example-only\"}"
  }
]

This is a message-array illustration, not a complete API request or an executable tool. Its example-only result is invented. Your client must supply its real tool definitions, provider settings and credentials separately.

The next response may ask for more tools. Handle each round and each call ID; stop on errors or an application-defined step limit. Returning one result does not guarantee a final answer.

OpenAI function-calling sequence

Missing tool results or mismatched IDs

A missing, duplicate or mismatched tool result can cause the next request to be rejected. Check the conversation sequence and error body before changing the model or increasing output tokens. Error wording and HTTP status depend on the client and provider.

INVALID_TOOL_RESULTS in LangChainJS

LangChain documents this error for its JavaScript/TypeScript implementation. Check for exactly one matching tool result per requested call, including calls returned in parallel. Also check that each tool result follows the assistant message that requested it.

LangChainJS tool-result error reference

“tool_call_ids did not have response messages”

This phrase appears in a reported Chat Completions integration error. Compare the call IDs in the preceding assistant message with the tool results your client actually sent. If history was trimmed or a tool failed, restore a valid message sequence through your client's supported recovery flow; do not invent a successful tool result.

Reported missing-tool-result example. This is a report of request-history rejection, not a universal error contract or a current bug claim about your software.

When an empty answer needs a different diagnosis

What the response reportsWhat to check next
tool_calls and a tool requestContinue the tool round in your application. Empty assistant text is not a JSON syntax error.
length with a tool payloadArguments may be cut off. Do not execute or invent missing arguments. Use the supported output limit or reduce the task.
tool_calls but no call detailsInspect the complete body and provider documentation. A finish reason alone supplies no function name, arguments or call ID.
stop, empty content and no toolsThere is no assistant text for this inspector to validate. Read the provider's response rules and any error or refusal fields.
Non-successful HTTP status or an error objectResolve the request failure first. Increasing output tokens does not repair authentication or quota errors.

Compare a handwritten truncated-tool example. The inspector identifies the reported tool step or output limit; it does not validate tool schemas, execute functions or reconstruct streaming chunks.

Check your model and client before continuing

This guide covers non-streaming Chat Completions function calls. Responses API tool items use a different shape. Model, provider and reasoning-mode requirements can differ; some models require the Responses API rather than Chat Completions.

DeepSeek's tool guide also shows the application returning a matching call ID. Follow its current model-specific instructions rather than assuming every compatible provider accepts identical messages.

DeepSeek tool-call instructions

The ChinaGenAI site route does not run your tools or guarantee a named model. Its 256-token requested-output cap and six-message input limit can constrain multi-step work. Each model request counts separately; see current connection support and limits.

If the assistant returned JSON text that was cut off or omitted fields, follow the separate incomplete JSON response guide.

Official field definitions and tool flows checked 20 October 2026. These illustrations are not a live integration test, model benchmark or search-volume claim.

Free API access and limits

Check the site free API access and limits before trying to obtain a site key. Read the current status and request limits before using a site key. It is not a source of official provider keys.

ChinaGenAI is not affiliated with the providers named here. This release contains setup guidance and explicitly labeled fictional examples, not claimed live model benchmarks.