Skip to main content
Glama
chelslava

ContextTree MCP

by chelslava

semantic_search

Search code by meaning or keywords using hybrid, semantic, or keyword modes. Returns ranked fragments with exact file, class, method, and line numbers; optionally rerank with Cross-Encoder.

Instructions

Search code by meaning and keywords (hybrid BM25+vectors, semantic, or keyword). Returns ranked code fragments with exact file, class, method, start_line, end_line, and code snippets. Supports optional Cross-Encoder re-ranking (rerank=True).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNohybrid
limitNo
queryYes
rerankNo
directory_pathNo.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.4.0
    • addedInput schema / properties / mode
      Added value: +{
      +  "default": "hybrid",
      +  "enum": [
      +    "hybrid",
      +    "semantic",
      +    "keyword"
      +  ],
      +  "title": "Mode",
      +  "type": "string"
      +}
    • addedInput schema / properties / rerank
      Added value: +{
      +  "default": false,
      +  "title": "Rerank",
      +  "type": "boolean"
      +}
  2. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing the hybrid retrieval approach, the exact return fields, and optional Cross-Encoder re-ranking. It lacks explicit statements about read-only behavior, performance, or side effects, but for a search tool the disclosed behavior is substantial and useful.

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 two sentences with no filler. Key behavior ('ranked code fragments') and return fields are front-loaded, and the optional re-ranking detail is placed at the end without bloating the text.

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

Completeness3/5

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

The output schema exists and covers the return format, so the description does not need to repeat that. However, important invocation context is missing: what 'directory_path' refers to, whether indexing from index_workspace is required first, and how the repository scope is determined. These gaps make the definition adequate but not fully complete for correct invocation.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate, but it only enriches two parameters: 'mode' (hybrid BM25+vectors, semantic, keyword) and 'rerank' (Cross-Encoder re-ranking). The parameters 'query', 'limit', and 'directory_path' are not meaningfully explained beyond their schema titles and defaults, leaving significant gaps.

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 identifies a specific verb ('Search') and resource ('code') while explaining that results are ranked by meaning and keywords. It also distinguishes the tool from siblings like find_ast_usages and go_to_definition by emphasizing semantic/keyword search with ranked code fragments rather than AST or definition lookups.

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

Usage Guidelines3/5

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

The description implies when to use the tool: when the user wants to search code semantically or by keyword. However, it does not explicitly state when not to use it or contrast it with alternatives, leaving the agent to infer selection from the tool name and sibling context.

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