Skip to main content
Glama

lean_local_search

Read-onlyIdempotent

Search local Lean declarations by name or prefix to verify they exist before referencing a lemma.

Instructions

Fast local search to verify declarations exist. Use BEFORE trying a lemma name.

Input Schema

NameRequiredDescriptionDefault
limitNoMax matches
queryYesDeclaration name or prefix
project_rootNoProject root (inferred if omitted)

Output Schema

NameRequiredDescriptionDefault
indexNoWhether the language server's symbol index contributed. Only 'consulted' makes an empty result mean the declaration does not exist. Declarations generated by attributes such as @[to_additive] exist only in the index, never in source text.unavailable
itemsNoList of local search results
sources_searchedNoSearch sources that returned results or were searched successfully. Source text is always searched; the symbol index is listed when workspace/symbol returned, including while its index is warming.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.33.0
    • addedOutput schema / properties / sources_searched
      Added value: +{
      +  "default": [
      +    "source_text"
      +  ],
      +  "description": "Search sources that returned results or were searched successfully. Source text is always searched; the symbol index is listed when workspace/symbol returned, including while its index is warming.",
      +  "items": {
      +    "enum": [
      +      "source_text",
      +      "symbol_index"
      +    ],
      +    "type": "string"
      +  },
      +  "title": "Sources Searched",
      +  "type": "array"
      +}
  2. Changed2 schema fields changedv0.31.0
    • addedOutput schema / $defs / IndexStatus
      Added value: +{
      +  "description": "Whether a local search could consult the language server's symbol index.\n\nOnly ``consulted`` makes an empty result mean the declaration is absent.",
      +  "enum": [
      +    "consulted",
      +    "warming",
      +    "unavailable",
      +    "error"
      +  ],
      +  "title": "IndexStatus",
      +  "type": "string"
      +}
    • addedOutput schema / properties / index
      Added value: +{
      +  "$ref": "#/$defs/IndexStatus",
      +  "default": "unavailable",
      +  "description": "Whether the language server's symbol index contributed. Only 'consulted' makes an empty result mean the declaration does not exist. Declarations generated by attributes such as @[to_additive] exist only in the index, never in source text."
      +}
  3. Addedv0.10.0
  4. Removedv0.23.1
  5. First observed

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, and openWorldHint=false, so the safety profile is covered. The description adds "Fast" as a performance trait, but says nothing about search semantics (exact vs. prefix matching, whether it covers dependencies), which is the information annotations cannot supply.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences with zero filler, and the timing instruction is placed after the purpose so the agent reads what the tool is before when to call it. Nothing could be cut without losing content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a three-parameter, read-only search tool with an output schema and full annotation coverage, the description carries everything the agent needs to decide to call it. Return values are handled by the output schema, so no description of results is required.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with all three parameters documented in the schema itself (query as name-or-prefix, limit, inferred project_root). The description adds no meaning beyond that — it does not clarify matching behavior or the effect of limit — so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

"Fast local search" gives a specific verb and a resource scope, and "to verify declarations exist" states the intent. The word "local" implicitly separates it from the external-search siblings (lean_leansearch, lean_loogle, lean_leanfinder), but none of those are named, so differentiation is left to inference.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

"Use BEFORE trying a lemma name" is a real sequencing hint that tells the agent when in a workflow to reach for this tool. However, it never says when NOT to use it, nor does it point to the sibling search tools that cover non-local/external lookup, which the agent must figure out from names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.