[MODEL] Claude uses Grep instead of LSP findReferences when asked to find references to a symbol

Resolved 💬 1 comment Opened Mar 9, 2026 by mrpana Closed Mar 11, 2026

Type of Behavior Issue

Claude ignored my instructions or configuration

What You Asked Claude to Do

"find references to <symbol_name>"

What Claude Actually Did

  1. Ran Grep with the symbol name to do a text search
  2. Did not use the LSP findReferences tool at all
  3. This happens consistently across multiple repos and conversations, even after being corrected in the same session

Expected Behavior

Claude should use LSP(operation: findReferences) when asked to "find references" to a symbol, since an LSP plugin is installed, active, and has finished indexing.

Proof that LSP works when explicitly forced

In the same session where Claude repeatedly chose Grep over LSP, the LSP tool works correctly when called directly:

LSP(operation: findReferences, filePath: <file>, line: 36, character: 5)

Result: Found 1 reference (the definition itself — confirming the function is unused)

The tool is registered, the Pyright server has finished indexing, and it returns correct semantic results. Claude simply doesn't choose to use it on its own.

Permission Mode

Accept Edits was OFF (manual approval required)

Can You Reproduce This?

Yes, every time with the same prompt

Claude Model

Opus

Relevant Conversation

In one session, Claude was corrected for using Grep instead of LSP. On the very next "find references" request in the same conversation, Claude used Grep again.

Impact

Medium - Extra work to correct Claude each time

Claude Code Version

2.1.71 (Claude Code)

Platform

Anthropic API

Additional Context

  • Happens across multiple repositories with Pyright LSP plugin enabled and fully indexed
  • LSP tool is available and works correctly when Claude is forced to use it
  • Even after being corrected mid-conversation, Claude reverts to Grep on the next "find references" request
  • User memory/instructions explicitly stating to use LSP for find references does not prevent the behavior

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗