Skip to content

Fix MCP tool result utilization for Ollama provider#651

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-chatgpt-mcp-integration
Draft

Fix MCP tool result utilization for Ollama provider#651
Copilot wants to merge 4 commits intomainfrom
copilot/fix-chatgpt-mcp-integration

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 26, 2025

When using Ollama with MCP tools, tool calls execute correctly but the model gives unrelated responses instead of utilizing the tool results. This occurs because many Ollama models don't properly support native multi-step tool calling.

Changes

  • Auto-enable prompt-based tools for Ollama (chatgpt-view-provider.ts): When Ollama provider is used with MCP tools, automatically switch to prompt-based tool implementation which explicitly adds tool results to conversation history and re-invokes the model
const shouldUsePromptBasedTools =
  promptBasedToolsEnabled ||
  (this.provider === "Ollama" &&
    this.toolSet &&
    Object.keys(this.toolSet.tools).length > 0);
  • Add tool utilization diagnostics (openai.ts, deepclaude.ts): Track hasToolCalls, hasToolResults, textAfterToolResult state to detect when models fail to use tool results, with warning logged when this occurs

  • Add step event handling: Handle start-step and finish-step events for better visibility into multi-step flow transitions

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • googlechromelabs.github.io
    • Triggering command: /usr/local/bin/node /usr/local/bin/node install.mjs (dns block)
  • https://storage.googleapis.com/chrome-for-testing-public/143.0.7499.42/linux64/chrome-linux64.zip
    • Triggering command: /usr/local/bin/node /usr/local/bin/node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>chatgpt answer not utilizing the mcp answer</issue_title>
<issue_description>### Describe the Bug

reprod. steps

  1. open a repo, example: cuda samples
  2. config local ollama
  3. config mcp filesystem with repo root
  4. ask chatgpt to list all txt files

observed answer:
MCP runs correctly, returning the list of txt files
chatgpt seem to give an answer unrelated to the question

expected answer:
MCP runs correctly, returning the list of txt files
chatgpt picks up the list from mcp and shows it

Absolutely—let’s tackle this step by step. Below are some focused questions that will help pinpoint the root of the build failures on Windows.

  1. What is your current CUDA installation?
    ...

Version: 1.105.17075
Commit: 14bd1561ce547502e6ff1968090dc18c49160aab
Date: 2025-10-21T20:24:03.344Z
Electron: 37.6.0
ElectronBuildId: undefined
Chromium: 138.0.7204.251
Node.js: 22.19.0
V8: 13.8.258.32-electron.0
OS: Linux x64 6.8.0-88-generic snap

Please tell us if you have customized any of the extension settings or whether you are using the defaults.

Ollama
http://localhost:11434/api
gpt-oss:20b

Additional context

-</issue_description>

<agent_instructions>could you check why this issue happen?</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 26, 2025 13:51
Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com>
Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com>
Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ChatGPT answer not utilizing MCP answers Fix MCP tool result utilization for Ollama provider Dec 26, 2025
Copilot AI requested a review from feiskyer December 26, 2025 14:04
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.

chatgpt answer not utilizing the mcp answer

2 participants