MoonshotAI / MoonshotAI/kimi-cli
Feature Request: 给 ToolReturnValue 添加 ErrorCode || Feature Request: Add ErrorCode to ToolReturnValue
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
What feature would you like to see?
我们基于 Kosong 框架自定义了 Tool。Tool 出错时,仅通过 message 信息难以快速归因和分类告警。希望能加上可枚举的 ErrorCode,帮助业务层对错误原因分类。这是一个可前向兼容的改动。
下面是代码示例:
class ToolReturnValue(BaseModel):
"""The return type of a callable tool."""
is_error: bool
"""Whether the tool call resulted in an error."""
error_code: int = 0
"""Machine-readable error code."""
...
error_code 举例:
NVALID_ARGUMNT = 1;
PERMISSION_DENIED = 2;
IME_OUT = 3;
Additional information
No response
What feature would you like to see?
We customized the Tool based on the Kosong framework. When a Tool error occurs, it is difficult to quickly attribute and classify the alarm using only message information. It is hoped that enumerable ErrorCode can be added to help the business layer classify error causes. This is a forward-compatible change.
Here is the code example:
class ToolReturnValue(BaseModel):
"""The return type of a callable tool."""
is_error: bool
"""Whether the tool call resulted in an error."""
error_code: int = 0
"""Machine-readable error code."""
...
error_code example:
NVALID_ARGUMNT = 1;
PERMISSION_DENIED = 2;
IME_OUT = 3;
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the ToolReturnValue model and the code paths that construct or consume tool errors, then inspect nearby tests for return-value behavior. Done means ToolReturnValue supports a machine-readable, forward-compatible error code with the existing message behavior preserved and coverage for the new field.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100