Skip to main content
Glama

code_search

Read-onlyIdempotent

Find C#, Python, TypeScript and JavaScript types, members or attributes across workspaces by exact name, camel-case initials or descriptive keywords, with ranked code results.

Instructions

Global code search across workspace(s): finds types (classes, interfaces, records, structs, enums, delegates, type aliases), members (methods, constructors, properties, fields, events, functions, variables) and attributes (decorators) in C#, Python, TypeScript and JavaScript files. Two ways to ask. (1) By name: 'UserService', 'PSS' (camel-case initials find ProjectSkeletonService), 'Skeleton' (word start), 'search global' (several words in one name). An exact name always comes first. (2) By description: 'refresh token rotation', 'retry failed upload'. Besides names, the search reads the split words of names, doc comments, file paths and the words used inside member bodies (identifiers, comments, string words), so code is found even when its name says none of the query. Stemming applies (creating finds Create). Results are ranked best first (words covered, kind of symbol, how often a method is called, tests last); each hit of a multi-word query lists the words it matched. Query syntax: plain words all help and more matches rank higher; "two words" in quotes must be adjacent; +word must match; -word must not match. Pass terms with synonyms or other spellings you expect in the code (terms=['jwt','bearer']) to widen the search; they count half as much as query words. Narrow with memberType, pathGlob ('src/Billing/'), matchIn (Names = symbol names only, Docs, Code = body words) and includeTests=false. Workspace '' searches ALL enabled workspaces. Interface also finds the base-list entries of types ('IUserService' finds its implementers); Attribute finds attribute use ('HttpPost'). Examples: code_search('MyApi', 'Redis') | code_search('MyApi', 'refresh token rotate', terms=['jwt']) | code_search('', 'Authorize', memberType='Attribute') | code_search('MyApi', 'retry -test', pathGlob='src/'). Not for literal text that is not a name, such as config keys, routes, log messages or SQL: use code_grep. Next steps: read a hit with code_outline + code_method; who calls a member: code_callers; who implements a type: code_types. Results come from the syntax index (no symbol resolution). Body words are stored as single words in order of first use, never as lines of code, with secrets redacted first (values after names such as password, secret, token or apiKey are masked as well, but a secret written in another way can remain: keep credentials out of source). The match count shows '+' when the full-text index found more candidates than it ranks.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>",
      "workspace": "<workspace>"
    },
    "name": "code_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
pageNoOptional: page number, 1-based (default 1). Increment to retrieve subsequent pages.
guideNotrue: put the code guide first in the result. Use on your first code call, or when told it changed.
queryYesWhat to find: a type or member name, camel-case initials, or a description in a few words ('Redis', 'UserService', 'refresh token rotation'). Syntax: "phrase", +required, -excluded. At most 200 characters and 16 words (terms included); a query of only filler words (how, does, the) is rejected. Quoted phrases need adjacent words in a name, signature or doc; with matchIn=Code they mean 'all these words'.
termsNoOptional: extra words that widen the search - synonyms, other spellings, the vocabulary the code probably uses (['jwt','bearer']). Up to 16 words together with the query.
matchInNoOptional: where to look. All (default) = names, doc comments, paths and body words; Names = symbol names only; Docs = doc comments only; Code = the words used in member bodies onlyAll
pageSizeNoOptional: results per page (default 20, max 200). Use with 'page' to paginate large result sets.
pathGlobNoOptional: only files matching this glob, e.g. 'src/Billing/**', '**/*.py' or 'Program.cs' (a pattern without '/' matches the file name in any folder). Only '*', '**' and '?' are patterns; '[ ] { }' are rejected.
workspaceYesWorkspace name as shown in Waymark, or '*' for ALL enabled workspaces
memberTypeNoOptional: All (default), Class, Interface, Struct, Record, RecordStruct, Enum, Delegate, TypeAlias, Method, Constructor, Property, Field, Event, Indexer, Operator, EnumMember, Function, Variable, AttributeAll
includeTestsNoOptional: include hits in test folders (default true; false leaves them out and reports how many)
caseSensitiveNoOptional: case-sensitive name matching (default false). Doc and body words are always matched ignoring case.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.6/5.0
Behavior4/5

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

Well beyond the readOnlyHint/idempotentHint annotations: it discloses ranking factors, that results come from a syntax index with no symbol resolution, that body words are stored as single words rather than lines, secret redaction behavior and its residual risk, and the meaning of the '+' marker on match counts. The only gap is pagination/return-shape detail, which the pageSize and page schema entries mostly carry.

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?

Front-loaded with purpose, then query modes, then filters, then exclusions and next steps in a sensible order. It is long and some filter guidance (pathGlob, memberType) restates the schema, but nearly every sentence carries usable information for invocation.

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 an 11-parameter tool with no output schema, the description covers query syntax, filtering, ranking, results interpretation, limitations, and follow-up tools. An agent has everything needed to construct a correct first call and interpret the response.

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, but the description earns above baseline by adding semantics the schema doesn't: terms count half as much as query words, the 16-word combined cap, includeTests=false reports how many were excluded, workspace '*' searches all enabled workspaces, and matchIn=Code changes quoted phrases to 'all these words'. It leaves a few schema params (guide, pageSize, page, caseSensitive) undiscussed, relying on the schema.

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?

Opens with a specific verb and scope ('Global code search across workspace(s)') and enumerates exactly what kinds of symbols are found across which languages. It also draws a hard line against the sibling code_grep, so an agent can route between them without inspecting either schema.

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

Usage Guidelines5/5

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

Gives explicit when-to-use with two named query modes (by name vs. by description), worked examples for each, an explicit exclusion ('Not for literal text ... use code_grep'), and a next-steps chain to code_outline, code_method, code_callers and code_types. Alternatives and the conditions selecting them are both stated.

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