Skip to main content
Glama

lean_local_search

Check the current Lean workspace for existing declarations by prefix, returning their kind and file to prevent API hallucination.

Instructions

Confirm declarations exist in the current workspace to prevent hallucinating APIs.

VERY USEFUL AND FAST!
Pass a short prefix (e.g. ``map_mul``); the metadata shows the declaration kind and file.
The index spans theorems, lemmas, defs, classes, instances, structures, inductives, abbrevs, and opaque decls.

Args:
    query (str): Declaration name or prefix.
    limit (int): Max matches to return (default 10).

Returns:
    List[Dict[str, str]] | str: Matches as ``{"name", "kind", "file"}`` or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes
project_rootNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

The description discloses the index scope (theorems, lemmas, defs, etc.), the return format (list of dicts with name/kind/file or error message), and the fact that it's fast. Since there are no annotations, this is valuable, though it does not address edge cases like no matches or whether the operation is read-only, which is implied.

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

Conciseness4/5

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

The description is well-structured with Args and Returns sections and is mostly concise. The exclamation 'VERY USEFUL AND FAST!' is redundant filler, and the sentence could be trimmed, but overall it is appropriately sized.

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

Completeness3/5

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

The description covers purpose, usage, and return values, and the output schema provides additional structure. However, the missing project_root explanation and lack of explicit distinction from global search tools make it slightly incomplete for a tool with 3 parameters.

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?

The description explains 'query' (declaration name or prefix) and 'limit' (max matches, default 10), which is helpful given no schema descriptions. However, it omits the 'project_root' parameter entirely, leaving a meaningful gap in parameter coverage.

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

Purpose5/5

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

The description states a specific purpose: 'Confirm declarations exist in the current workspace to prevent hallucinating APIs.' It clearly identifies the resource (workspace declarations) and the verb (confirm), and distinguishes itself from sibling tools by emphasizing 'current workspace' and the local search scope.

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

Usage Guidelines4/5

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

It provides clear context for when to use: to confirm declaration existence before use, and even gives a shortcut example ('Pass a short prefix'). However, it does not explicitly mention when not to use it or name alternatives like global search tools, so it lacks exclusions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/project-numina/lean-lsp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server