fix(agent): improve ReAct parser and tool schemas for better LLM compatibility
- Fix ACTION_INPUT regex to properly capture multiline JSON responses - Changed from stopping at first newline to capturing all remaining text - Resolves parsing errors when LLM generates formatted JSON with line breaks - Enhance tool schemas with detailed descriptions and parameter specifications - Add comprehensive Message schema for generate_text tool - Clarify distinction between resources/get (file read) and resources/list (directory listing) - Include clear usage guidance in tool descriptions - Set default model to llama3.2:latest instead of invalid "ollama" - Add parse error debugging to help troubleshoot LLM response issues The agent infrastructure now correctly handles multiline tool arguments and provides better guidance to LLMs through improved tool schemas. Remaining errors are due to LLM quality (model making poor tool choices or generating malformed responses), not infrastructure bugs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -129,10 +129,12 @@ impl RemoteMcpClient {
|
||||
#[async_trait::async_trait]
|
||||
impl McpClient for RemoteMcpClient {
|
||||
async fn list_tools(&self) -> Result<Vec<McpToolDescriptor>> {
|
||||
// The file server does not expose tool descriptors; fall back to NotImplemented.
|
||||
Err(Error::NotImplemented(
|
||||
"Remote MCP client does not support list_tools".to_string(),
|
||||
))
|
||||
// Query the remote MCP server for its tool descriptors using the standard
|
||||
// `tools/list` RPC method. The server returns a JSON array of
|
||||
// `McpToolDescriptor` objects.
|
||||
let result = self.send_rpc(methods::TOOLS_LIST, json!(null)).await?;
|
||||
let descriptors: Vec<McpToolDescriptor> = serde_json::from_value(result)?;
|
||||
Ok(descriptors)
|
||||
}
|
||||
|
||||
async fn call_tool(&self, call: McpToolCall) -> Result<McpToolResponse> {
|
||||
|
||||
Reference in New Issue
Block a user