Skip to content

[Bug]: list tool lacks depth/size limits for recursive operations #310

@GladosDev

Description

@GladosDev

Bug Description

When using the list tool with recursive: true on a large directory (e.g., /opt), it recursively lists all files and subdirectories without any limit, causing the session context to explode/become overwhelmed with massive amounts of data.

Expected behavior: The tool should have safety limits (max depth, max entries) to prevent context overflow.

Steps to Reproduce

  1. Start a conversation with any bot
  2. Trigger a tool call like:
    {"type": "tool-call", "input": {"path": "/opt", "recursive": true}, "toolName": "list", "toolCallId": "tool_xxx"}
  3. Observe that the tool attempts to list ALL files recursively
  4. The session context becomes flooded with data, making further conversation impossible

Error Messages / Logs

N/A - The issue is that the tool returns too much data rather than throwing an error

Version

0.6.0

Model Used

kimi-coding/kimi-for-coding

Channel

Telegram

Additional Context

No response

Contributing

  • I would like to submit a pull request to fix this bug

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions