Add the mcp support and a simple agent loop#206
Add the mcp support and a simple agent loop#206WuJunkai2004 wants to merge 3 commits intomadox2:mainfrom
Conversation
Inject tools description into system messages and parse tool calls from assistant responses using ```tool```/```json``` blocks. Add MCPManager integration for external tools and a built-in tool_map for bash/read_file/write_file/edit_file. Execute tools iteratively, append results as user messages, limit loop iterations, and call MCPManager shutdown. Add tests covering write/read/edit/bash and safety checks.
|
Additionally, there are several parts I don't understand the re moduleThe A strange except caught# in py/chat.py :290
except Exception as e:
with self.lock:
self.lines.append("")
self.lines.append(f"<<< error getting response: {str(e)}")
self.lines.append("")
self.lines.append("```python")
self.lines.extend(traceback.format_exc().split("\n"))
self.lines.append("```")
try:
self.lines.append("")
self.lines.append(json.loads(e.read().decode())["error"]["message"])
except:
passthe >>> Exception("hello").read
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Exception' object has no attribute 'read' |
it does not work like in standard python modules, in vim it loads everything in an execution script. so
Yes, I think it is handling a specific kind of exception, but it is not documented which one. I would defensively does not touch it until it is not known |
|
@WuJunkai2004 like I explained in the original issue, I am really sorry to close this PR and I apreciate all your effort. If you decide to implement it in a custom provider, I will support you with anything missing in this plugin. Thanks! |
Add the mcp support and a simple agent loop.
Add 4 tools for running shell, reading, writing and editing.
Add a simple agent loop. and enabled default. This PR is just a demo, so needs future development.
Add a test script with write by Gemini AI.