Skip to content
context-engine
Tools

grep_definition

Find semantic definitions by symbol name.

Use grep_definition when you know a symbol name but not its location. It searches semantic definitions in the workspace, rather than arbitrary text or references.

Use when

  • You need to discover an unknown symbol or file outline.
  • You want language- and kind-aware results before navigating further.

Do not use when

  • You have a visible source occurrence; use jump instead.
  • You need arbitrary text, comments, or usages; use text search or show_usage.

Request

{"requests":[{"queries":["UserService"],"language_id":"rust","kinds":["type"],"filter_params":{"include_paths":["src/**/*.rs"],"exclude_paths":[],"limit":20}}],"workspace_root":"/workspace/project"}

Parameters

FieldRequiredDefault / bounds
requestsyesOne or more query groups, with at most 32 queries across all groups.
requests[].queriesyesOne or more non-empty names; matching is case-insensitive and * enables glob matching.
requests[].language_idyesLSP language identifier.
requests[].kindsno[] (all); union of type, interface, function, module, member, event, constant.
requests[].filter_paramsnoInclude/exclude globs and optional limit; excludes win.
workspace_rootnoActive workspace routing.

kinds uses language-agnostic categories:

CategoryDefinitions included
typeClasses, structs, interfaces, and enums
interfaceInterfaces and objects
functionFunctions, methods, and constructors
moduleFiles, modules, namespaces, and packages
memberFields, properties, and enum members—not methods
eventEvents
constantConstants

What it returns

Definitions grouped by matching query, with paths, symbol kind, hierarchy, signatures, and handles when available. Multiple matches are valid; choose by path, parent hierarchy, and kind. A * query can return matching file outlines. Pass a relevant handle to extract for more detail.

Common mistakes

  • Grouping queries with different languages, kinds, or filters in one request group.
  • Assuming the first match is the intended definition.
  • Using grep_definition for a dependency occurrence that jump can resolve precisely.

jump, outline, extract, show_usage