Skip to main content
Glama
Terminal History MCP

Terminal History MCP

by HasanJahidul

reindex_embeddings

Idempotent

Builds the vector index needed for semantic and hybrid terminal-history search by embedding indexed command texts that lack vectors, processing batches until none remain.

Instructions

Builds the vector index behind search_history semantic/hybrid modes and ask_history. Embeds distinct indexed command texts (identical commands share one vector) that have no vector yet for the configured model, newest first, in batches of 64, via the OpenAI-compatible endpoint in TERMINAL_HISTORY_LLM_BASE_URL (default Ollama at http://localhost:11434/v1, model nomic-embed-text from TERMINAL_HISTORY_EMBED_MODEL). Non-localhost endpoints are refused unless TERMINAL_HISTORY_ALLOW_REMOTE_LLM=1. Sends only already-redacted text read from the local index. Changing the embedding model re-embeds everything for the new model. Run reindex first, then call until remaining is 0. Returns embedded / skipped / failed / remaining counts.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "reindex_embeddings"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum number of distinct command texts to embed in this call. Default 2000.

Output Schema

NameRequiredDescriptionDefault
errorNoFirst error seen, if any.
modelNoEmbedding model the vectors were built with.
failedNoTexts the endpoint rejected or failed on this call.
skippedNoDistinct texts already embedded for this model (or blank).
embeddedNoVectors written this call.
remainingNoDistinct texts still without a vector for this model.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.0

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the annotations by disclosing batching (64), ordering (newest first), deduplication of identical commands, network destination and default endpoint/model, the remote-endpoint refusal guard requiring TERMINAL_HISTORY_ALLOW_REMOTE_LLM=1, that only already-redacted local text is sent, and that changing the embedding model triggers full re-embedding. It also names the return counters, so cost, data-egress, and idempotency behavior are all visible.

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 and consumer tools, then operational constraints and return values; nearly every clause carries information (guard variables, dedup rule, model-change behavior). It is a dense block rather than a scannable list, and the endpoint/env-var detail is heavy for a single-parameter tool, but nothing is clearly expendable.

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 a mutating, network-touching, open-world indexing tool this covers preconditions (run `reindex` first), iteration rule, safety guards (non-localhost refusal, redacted-only input), cost/ordering, and result counts. With an output schema present, detailed return-value explanation is not required, so the remaining ground is covered.

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

Parameters3/5

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

Schema coverage is 100% with a single self-documented `limit` parameter, so the schema already carries the meaning and baseline 3 applies. The description adds adjacent context (batch size of 64, newest-first ordering) that helps an agent size calls, but it never maps those facts onto the `limit` parameter explicitly.

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?

States a specific verb ('Builds the vector index') plus the consuming features ('search_history' semantic/hybrid modes and 'ask_history'), and adds the distinguishing mechanism (distinct command texts, one vector per identical command). An agent can tell this apart from the sibling `reindex` and from the read-only search tools without opening the 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 sequencing relative to a sibling: 'Run `reindex` first, then call until `remaining` is 0', which tells the agent both the precondition and the loop-termination condition. It also implicitly excludes use when no new commands exist via 'that have no vector yet', leaving little to infer.

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