Skip to main content
Glama

Semantic code search

scratchbook_search

Describe a concept or behavior in natural language to find where it lives in the code. Returns matching code chunks with file:line locations and snippets.

Instructions

Semantic search across a codebase's indexed code. Returns the most relevant code chunks with file:line locations, enclosing symbol and a snippet — across the whole repo, not just one directory (unlike grep). Use it to locate where a concept or behaviour lives before reading files. Ask in natural language ('where are TTS chunks cached', 'auth token verification'). The project must be indexed first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kNoNumber of results (default 8).
langNoRestrict to a language, e.g. 'typescript', 'python'.
queryYesNatural-language description of the code/behaviour you're looking for.
projectNoAbsolute project root. Defaults to the server's cwd.
path_prefixNoRestrict to paths starting with this prefix, e.g. 'lib/tts'.
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses the output format ('file:line locations, enclosing symbol and a snippet'), the scope ('across the whole repo'), and a state precondition ('must be indexed first'). This goes beyond generic 'search' descriptions, though it doesn't address error behavior or side effects, which are minimal for a read-only search.

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 tight sentences that front-load the core purpose first, then usage guidance, then query mode and prerequisite. Every sentence adds new information without padding.

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?

The description covers what the tool returns, its scope, and a prerequisite, which is substantial for a search tool. With no output schema, it compensates by naming the return components. It could be even more complete by describing behavior when the project isn't indexed or when no results match, but overall it is well-rounded.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3. The description adds value by clarifying the 'query' parameter with natural-language examples ('where are TTS chunks cached') and by implying that 'path_prefix' is an optional restrictor via the 'not just one directory' contrast. It also connects the 'project' parameter to the indexing prerequisite.

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 a specific verb and resource: 'Semantic search across a codebase's indexed code.' It distinguishes itself from grep by noting it operates 'across the whole repo, not just one directory.' The title 'Semantic code search' aligns, and the first sentence fully defines the tool's purpose.

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 gives explicit context for when to use: 'Use it to locate where a concept or behaviour lives before reading files.' It also provides a prerequisite ('The project must be indexed first') and demonstrates the natural-language query format with examples. However, it does not explicitly mention when to use alternative scratchbook sibling tools or when not to use this tool beyond the 'unlike grep' comparison.

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/jinyaolin/scratchbook'

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