SemanticAnalyzer compares your tool descriptions against MCP tools in the semantic corpus and also performs a deeper semantic parameter pass within the server you are scanning. Today the corpus is built from Smithery data and shipped as an HNSW index plus metadata file. The analyzer runs locally against that index; it does not call Smithery during analyze().
Constructor
Config options
Minimum similarity score required before a match becomes a finding. Valid values are between
0 and 1. Raise the threshold to reduce borderline matches.Number of nearest neighbors to retrieve from the semantic index for each tool before threshold filtering is applied. Higher values increase recall at the cost of more comparison work.
Minimum similarity score required before the within-server semantic parameter matcher emits
SEMANTIC_PARAMETER_CONFLICT. When omitted, Watchtower uses the stricter of threshold and 0.88 to keep the deeper pass conservative by default.analyze()
SemanticReport.
Parameters
Human-readable label for the server being analyzed. Matches from the same
serverName are filtered out so the analyzer does not flag your own corpus entry as a cross-server overlap.Array of tool definitions to compare against the corpus. Tools with empty descriptions are skipped because they cannot be embedded meaningfully.
Return value
analyze() resolves to a SemanticReport.
The
serverName value you passed in.Number of tools in the input array.
Semantic findings that met the configured threshold.
ISO 8601 timestamp of when the scan completed.
How matching works
For each tool,SemanticAnalyzer:
- embeds the tool description
- builds a retrieval query from
tool.name + tool.description - searches the local HNSW index for the nearest neighbors
- recomputes similarity from descriptions when the tool names are identical
- performs a within-server semantic parameter pass using parameter and tool context
- filters corpus matches below
threshold, filters parameter matches belowparameterThreshold, and drops corpus matches from the same server - emits
ALREADY_IN_CORPUS,SEMANTIC_OVERLAP, and when applicableSEMANTIC_PARAMETER_CONFLICT
The analyzer loads index files from
~/.mcp-watchtower/index when a newer downloaded index is present. Otherwise it falls back to the bundled semantic.hnsw and semantic-meta.json files shipped with the package.Code examples
Related pages
Semantic workflow
How the Smithery-backed corpus is crawled, embedded, indexed, and refreshed.
Types reference
Field-by-field reference for
SemanticFinding and SemanticReport.