Skip to content

Add an optional ignore_case flag to the grep tool #36

Closed

Description

@vicgupta

Problem

The built-in grep tool searches case-sensitively by default. When a user asks the agent to find an error message or a term whose capitalization is unknown, the agent must know to add Go's inline (?i) regex flag or try several searches. That workaround already works, but case-insensitive search is not discoverable in the tool schema.

Proposed improvement

Add an optional boolean ignore_case argument to grep, described in the tool schema. Keep the existing behavior when the argument is omitted or false, including support for inline regex flags.

For example, given a file containing Error: connection failed, ERROR: timeout, and error: retrying, this call should return all three matching lines:

{"pattern":"error", "path":".", "include":"*.log", "ignore_case":true}

This is a small convenience feature for searches in logs, documentation, and unfamiliar repositories.

Acceptance criteria

  • The grep tool schema exposes ignore_case as an optional boolean and explains its default.
  • With ignore_case: true, a pattern such as error matches error, Error, and ERROR in both single-file and recursive searches.
  • Omitted, false, or null values preserve today's regex behavior, including explicit inline flags such as (?i); invalid non-boolean values produce an actionable tool error, consistent with replace_all.
  • Case folding applies to matching file contents only. The include glob, returned paths, line numbers, and original line text retain their current behavior.
  • Invalid regexes still report an error; existing binary/large-file exclusions and match limits remain intact.
  • Tests cover the default and enabled modes, interaction with include, argument validation through the executor, and the optional boolean schema property. go test ./... passes.
  • Add a brief README note with an example of case-insensitive search.

Implementation pointers

The change should fit within internal/tools/grep.go, the argument/schema/dispatch handling in internal/tools/tools.go, the existing grep tests in internal/tools/tools_test.go, and the README. Reuse the existing boolArg convention. No new dependency or CLI flag is needed.

Activity

  1. added
    enhancementNew feature or request
    amf:readyReady for amf to turn into a pull request
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    amf:readyReady for amf to turn into a pull requestenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions