Skip to main content
Glama
toaruR

mcp-server-bm25-code-search

by toaruR

BM25 Code Search

search

Find relevant code chunks in an indexed codebase using BM25 ranking, supporting Japanese, camelCase, and snake_case queries. Provides fallback suggestions when no matches occur.

Instructions

Search the indexed codebase with a SQLite FTS5 BM25 ranker. Returns the best-matching code chunks, ranked with the filepath column boosted 3.0x over the body. Works for Japanese (CJK) and camelCase/snake_case queries. When nothing matches, returns a structured zero-match fallback suggesting grep/glob.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNoHow query tokens are combined. 'OR' maximises recall; 'AND' requires every token to hit.OR
queryYesThe search query. Japanese, camelCase and snake_case are all tokenised the same way the index was built.
top_kNoMaximum number of results to return.
Behavior4/5

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

With no annotations, the description carries full responsibility for behavior disclosure. It transparently reveals the ranking boost (filepath 3.0x), the zero-match fallback structure, and special tokenization behaviors, which are non-obvious details. It could have explicitly stated read-only safety, but 'search' strongly implies it.

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?

The description is three sentences, each carrying distinct information: ranking mechanism, tokenization support, and fallback behavior. It is front-loaded with the verb and resource, with no filler or redundancy.

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

Completeness4/5

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

Given no output schema, the description explains what is returned (best-matching code chunks) and the fallback, but doesn't detail the chunk structure or exact return format. It covers the main behaviors thoroughly for a search tool, though a bit more output detail would improve completeness.

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 input schema already provides 100% coverage for all three parameters, including query tokenization and mode semantics. The description adds minor context about ranking (filepath boost) but doesn't meaningfully extend parameter understanding beyond the schema, warranting the baseline score.

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 clearly states the tool searches the indexed codebase using a SQLite FTS5 BM25 ranker, specifying the action, resource, and ranking method. It goes beyond a generic 'search' by noting the filepath boost and language tokenization, making the purpose unambiguous even without siblings.

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?

The description gives clear context on when to use the tool: codebase search with BM25 ranking, supporting CJK and camelCase/snake_case queries. It also mentions a fallback to grep/glob when no matches occur, implying alternative tools for exact/pattern search, though it doesn't explicitly state 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/toaruR/mcp-server-bm25-code-search'

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