Skip to main content
Glama

semantic_search

Search project code with natural language to locate relevant snippets and their file paths, optionally restricted to specific directories.

Instructions

[ARTIFACT TOOLS] Semantic search over artifact chunks, optionally scoped to one or more directories; returns each hit's location plus file content. Read-only.

Parameters: project : project name. query : natural-language search text. limit : max hits. With scopes, applies to the combined OR result, not per scope. scopes : project-relative directory paths, max 20, OR semantics. Omit (or None/[]) for unscoped -- unchanged from before this param existed. Directories only; a file path simply matches nothing.

Returns: on a normal or unscoped call, a list of hits (path, section, start_line, end_line, distance, content, warning -- as before). If scopes matched zero chunks, returns a single object instead of a list: {"message": str} explaining why -- check for a "message" key, not list length, to tell the two shapes apart. Raises: 404 unknown project. Validation error for a bad scope (absolute, '..', outside project root) or >20 scopes -- names the scope, never a host path. Per-hit read failures set warning (partial success), not an exception.

Do NOT use to read a known file -- call read_project_artifacts instead. Do NOT pass a file path as a scope -- scopes are directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax results
queryYesSearch text
scopesNoDirectory paths to restrict hits to (OR'd, max 20). Omit for unscoped (default). Files won't match -- use read_project_artifacts for a known file.
projectYesProject name

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.1.5-rc1
    • addedInput schema / properties / scopes
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Directory paths to restrict hits to (OR'd, max 20). Omit for unscoped (default). Files won't match -- use read_project_artifacts for a known file.",
      +  "title": "Scopes"
      +}
  2. First observedv1.1.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden and does so thoroughly: read-only, return shape variability based on whether scopes matched, error types (404, validation), and partial-success behavior via `warning`. This is well beyond what any annotation could have supplied.

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 longer than average but densely informative, organized into Parameters, Returns, and Raises sections. Every section earns its place; only the minor backward-compatibility phrase 'unchanged from before this param existed' is somewhat extraneous.

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?

Given there is no output schema, the description fully covers return values, the ambiguous case of zero matches, error handling, and partial success. An agent has everything needed to call the tool and interpret its result correctly.

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

Parameters5/5

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

Even though schema coverage is 100%, the description adds meaningful semantics beyond the schema: `limit` applies to the combined OR result, `scopes` are OR'd directories with a max of 20, and omitting or passing None/[] means unscoped. It also warns that file paths simply match nothing, which the schema alone does not convey.

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 verb and resource: semantic search over artifact chunks, optionally scoped to directories, returning hit locations plus file content. It also explicitly distinguishes itself from reading a known file via read_project_artifacts, making it easy to separate from sibling tools.

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?

Includes explicit do-not-use guidance: do not use for reading a known file, call read_project_artifacts instead; and do not pass file paths as scopes. It clearly explains when scopes apply and OR semantics, though it does not explicitly contrast with other search-style siblings like search_project_artifacts or search_code_skeletons.

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