Skip to main content
Glama

tune_weights

Adjust per-repo semantic weights based on telemetry-derived confidence, improving retrieval precision when the semantic channel adds value. Preview changes with dry-run; requires sufficient event history.

Instructions

Online weight tuning. Reads ranking_events from ~/.doc-index/telemetry.db (requires JDOCMUNCH_PERF_TELEMETRY=1) and proposes a per-repo semantic_weight step. dry_run=true skips the disk write. min_events gates against early overfitting. Learns from a recency window of the ledger (default 90 days) so stale events can't anchor the weights. Learning compares confidence WITH vs WITHOUT the semantic channel, so a workload that only ever runs one mode produces no signal at all — use set_weight there instead of waiting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoNoOptional — single repo to tune. Omit to scan all repos with events. Required with set_weight.
dry_runNo
min_eventsNo
set_weightNoPersist this semantic_weight for repo directly, skipping the ledger. For when you have measured the right value for a corpus rather than waiting for the tuner to walk there. Does not require telemetry. Clamped to the allowed bounds, and the response reports whether clamping occurred.
max_age_daysNoOnly learn from ledger events newer than this many days. Keeps stale events from anchoring weights to an outdated query distribution. 0 = lifetime ledger.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.130.0
    • changedInput schema / properties / repo / description
      Previous value: -"Optional — single repo to tune. Omit to scan all repos with events."New value: +"Optional — single repo to tune. Omit to scan all repos with events. Required with set_weight."
    • addedInput schema / properties / set_weight
      Added value: +{
      +  "description": "Persist this semantic_weight for repo directly, skipping the ledger. For when you have measured the right value for a corpus rather than waiting for the tuner to walk there. Does not require telemetry. Clamped to the allowed bounds, and the response reports whether clamping occurred.",
      +  "type": "number"
      +}
  2. Addedv1.120.0
  3. Removedv1.100.0
  4. Changed1 schema field changedv1.70.2
    • addedInput schema / properties / max_age_days
      Added value: +{
      +  "default": 90,
      +  "description": "Only learn from ledger events newer than this many days. Keeps stale events from anchoring weights to an outdated query distribution. 0 = lifetime ledger.",
      +  "type": "integer"
      +}
  5. First observedv1.66.3

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the readOnlyHint:false annotation, the description discloses the disk write behavior (dry_run skips it), the required environment variable (JDOCMUNCH_PERF_TELEMETRY=1), the recency window, and the comparison logic that yields no signal in single-mode workloads. This is rich behavioral context not found in annotations.

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 dense but each sentence carries unique value; however, the first sentence could be slightly more compact. It is well-structured with logical flow from data source to behavior to limitation.

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 the tool's complexity (telemetry dependency, write behavior, learning window, no output schema), the description covers inputs, behavioral traits, prerequisites, and alternatives thoroughly. It is fully self-contained for an agent to decide when and how to invoke it.

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?

The description adds meaning for dry_run and min_events, which lack schema descriptions, and reinforces max_age_days with the 'recency window' concept. It compensates for schema coverage gaps and clarifies parameter semantics.

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 uses a specific verb ('tuning') and resource ('per-repo semantic_weight'), and clearly states it reads ranking_events from a telemetry database. It distinguishes from siblings by focusing on weight tuning, a unique function among the listed tools.

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?

Explicitly explains when to use set_weight instead ('use set_weight there instead of waiting') and provides context for dry_run and min_events. It also indicates when the tool will not produce useful signal (single-mode workloads), guiding appropriate usage.

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