id in ToolCall missing
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.5k
- Forks
- 1.2k
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Description
The id field in the tool_call is missing. The raw response (hook) contains the id (see below, "id": "call_p7o2gz50").
But the ToolCall class doesn't have this field nor is it in model_extra.
{
"model": "...",
"created_at": "2026-05-18T...",
"message": {
"role": "assistant",
"content": " ",
"tool_calls": [
{
"id": "call_p7o2gz50",
"function": {
"index": 0,
"name": "test_function",
"arguments": {
"param1": "test1",
"param2": 123
}
}
}
]
},
"done": true,
"done_reason": "stop",
...
}
I have to use a hook to extract the id from the raw response and keep it in a list of the same size as the response.message.tool_calls list.
I suggest the following patch:
diff --git a/ollama/_types.py b/ollama/_types.py
index 96529d6..fdc00d2 100644
--- a/ollama/_types.py
+++ b/ollama/_types.py
@@ -334,6 +334,8 @@ class Message(SubscriptableBaseModel):
"""
Model tool calls.
"""
+ id: Optional[str] = None
+ 'ID of the tool call.'
class Function(SubscriptableBaseModel):
"""
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ollama/_types.py at the ToolCall model and compare its fields with the raw tool_calls response shown in the issue. Confirm that the id is represented on the parsed ToolCall and add or update coverage if the repository has a relevant model test; done means callers can access the response id without using a hook.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100