Shared capability classifier used by harness/ (Phase 2) and the planned static analyzer (Phase 1). Spec: ../docs/capability-classifier.md.
Implemented — Layer 1 (lexical / heuristic):
classify_tool(tool: dict) -> ToolClassification — per-tool capability tags + parameter roles + confidence + evidenceclassify_server(tools: list) -> ServerClassification — aggregate + overbroad-combination detectionpython -m classifier <file.json> — CLI for ad-hoc classificationtests/Not yet implemented:
| File | Purpose |
|---|---|
classify.py |
classify_tool, classify_server, parameter classifier, scoring logic |
lexicons.py |
Hand-curated keyword and pattern tables; versioned with the spec |
types.py |
Dataclasses for output (ToolClassification, CapabilityFinding, ParameterRole, …) |
__main__.py |
CLI entry |
tests/ |
Smoke tests covering the obvious capability and role detection paths |
high (independent agreement)name_combo or desc_pattern) → mediumname_token, partial param-name match) → lowinferredConsumers pick their threshold. Today:
target_tool_capability filter: high + mediumhigh only# Classify a single tool definition over stdin:
echo '{"name":"read_file","description":"Reads a file","inputSchema":{"type":"object","properties":{"path":{"type":"string"}}}}' \
| python -m classifier
# Classify a server's tools/list output:
python -m classifier server_tools.json
pip install -e ".[dev]" # quote for zsh; bash also accepts unquoted
pytest classifier/tests/