native_tool_call_adapter icon indicating copy to clipboard operation
native_tool_call_adapter copied to clipboard

Infinite Loop in MCP Section Parsing

Open R-omk opened this issue 1 year ago • 3 comments

Problem Description

The application was experiencing an infinite loop and high CPU usage when processing requests with a large system prompt. The issue was traced to the MCP section parsing logic in the parse_mcp_sections function in mcp_parser.py.

Root Cause

The infinite loop was caused by a while True loop in the parse_mcp_sections function that was searching for the "### Available Tools" section. The loop had no proper exit condition, causing it to run indefinitely when the section was not found or when there was an error in the parsing logic.

Additionally, the large system prompt (64,122 characters) exacerbated the issue, as the application was trying to parse this large text repeatedly in the loop.

R-omk avatar Aug 31 '25 11:08 R-omk

Thank you for your report. We have promptly fixed the infinite loop issue.

irreg avatar Aug 31 '25 12:08 irreg

For MCP servers containing resource templates or resources, I have identified that parsing may occur differently than expected and are taking corrective action.

irreg avatar Aug 31 '25 14:08 irreg

For MCP servers containing resource templates or resources, I have identified that parsing may occur differently than expected and are taking corrective action.

I have also made corrections to this.

irreg avatar Aug 31 '25 15:08 irreg