agentscope-ai / agentscope-ai/agentscope-java

[Feature]:工具调用参数检查校验及自动修复增强

Open
#847 0 comments 0 reactions 0 assignees View on GitHub
area/core/tool enhancement
Dominant language
Java
Stars
5.6k
Forks
1.3k
Avg merge
4d 12h
Merged PRs (30d)
77

Description

When working with LLM tool calls, we frequently encounter malformed JSON in tool call arguments. Common issues include:

- Markdown code blocks: Arguments wrapped in \json ... `
- JSON comments: // or /* */ comments that aren't valid JSON
- Single quotes: Using ' instead of " for strings/keys
- Missing braces: Incomplete JSON objects
- Trailing commas: Commas after last element (not valid in strict JSON)

These issues cause the current ChatMessageConverter to fail when parsing tool arguments, requiring manual intervention or rejecting otherwise valid tool calls.

Example problematic inputs:
```
```json
{"query": "test"} // Simple search

{'query': 'test',}

{"query": "test",}

{"query": "test", “condition”: {"id": "123"}
```

Implement a **robust multi-stage tool argument parser** that progressively cleans up malformed JSON before parsing.

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.