backstage / backstage/community-plugins

๐Ÿ› mcp-chat: incorrect "tools used" being displayed report when reloading conversation from history

Open
#8,817 2 comments 0 reactions 1 assignee Claimed by @Lucifergene View on GitHub
bug workspace/mcp-chat
Dominant language
TypeScript
Stars
422
Forks
697
Avg merge
2d 6h
Merged PRs (30d)
286

Description

### Workspace

mcp-chat

### ๐Ÿ“œ Description

When reloading an old conversation from history, the "Tools used" section of **any** message from agent shows the tool that was used during the last query from user, along with its results.

Moreover, when inspecting the tool response, an error message is displayed:

> "No tools used or no tool responses available"

### ๐Ÿ‘ Expected behavior

I would expect the chat reloaded from history the behave like a fresh new chat, displaying correct tool usage and outputs:

Image

### ๐Ÿ‘Ž Actual Behavior with Screenshots

The tool used for the last message in history is used for **any** assistant message (also for those that didn't required tool execution in the original conversation).

The tool response is also not available:

Image

### ๐Ÿ‘Ÿ Reproduction steps

1. Start a new conversation in which you ask the agent to perform some tool calls
2. Create a new conversation
3. Reload the first conversation from history and inspect agent messages

### ๐Ÿ“ƒ Provide the context for the Bug.

Every time a new message is sent to the backend from an authenticated user, the backend stores (or update) the conversation. In doing this, [only the tools used during the last request](https://github.com/backstage/community-plugins/blob/main/workspaces/mcp-chat/plugins/mcp-chat-backend/src/routes/chatRoutes.ts#L84-L117) are passed to `ChatConversationStore`. This likely leads to overriding the tools used previously in the conversation.

In addition, when persisting tools used, no association to the agent message is created. The backend simply returns the tools that where used during the last request to the frontend, which applies them to any assistant message.

### ๐Ÿ‘€ Have you spent some time to check if this bug has been raised before?

- [x] I checked and didn't find similar issue

### ๐Ÿข Have you read the Code of Conduct?

- [x] I have read the [Code of Conduct](https://github.com/backstage/community-plugins/blob/main/CODE_OF_CONDUCT.md)

### Are you willing to submit PR?

Yes I am willing to submit a PR!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.