Skip to content

Improve tool calling response handling#39

Open
MichaelAnders wants to merge 2 commits intoFast-Editor:mainfrom
MichaelAnders:feature/improve-tool-calling
Open

Improve tool calling response handling#39
MichaelAnders wants to merge 2 commits intoFast-Editor:mainfrom
MichaelAnders:feature/improve-tool-calling

Conversation

@MichaelAnders
Copy link
Contributor

Summary

  • Additional logging for tool call parsing and execution
  • Hard-coded shell commands for reliable tool execution
  • Deduplication of tool calls within a single response
  • Collect and return results from all called tools
  • Ollama uses specified Ollama model
  • Fix double-serialized JSON parameters from some providers

Files Changed

File Change
src/api/middleware/logging.js Enhanced request/response logging
src/api/middleware/request-logging.js Additional request logging
src/api/router.js Router updates for tool handling
src/config/index.js Ollama model configuration
src/orchestrator/index.js Tool call deduplication, result collection, direct result return
src/tools/index.js Deep-parse double-serialized JSON params, execution logging
src/tools/stubs.js AskUserQuestion handler improvements
src/tools/workspace.js Workspace tool updates

Test plan

  • Verify tool calls are deduplicated when model returns duplicates
  • Verify results from all called tools are collected and returned
  • Verify Ollama uses the configured model
  • Verify double-serialized JSON parameters (e.g. stringified arrays) are correctly parsed

- Add fallback parsing for Ollama models that return tool calls as JSON
  text in message content instead of using the structured tool_calls field
- Return tool results directly to CLI instead of making a follow-up LLM
  call, reducing latency and preventing hallucinated rewrites of output
- Add dedicated Glob tool returning plain text (one path per line) instead
  of JSON, with workspace_list accepting both 'pattern' and 'patterns'
- Clarify why Glob is not aliased to workspace_list (format mismatch)
- Additional logging for tool call parsing and execution
- Hard-coded shell commands for reliable tool execution
- Deduplication of tool calls within a single response
- Collect and return results from all called tools
- Ollama uses specified Ollama model
- Fix double-serialized JSON parameters from some providers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant