# Semantic context tools

Native read tools for deeper AI context without EDT-MCP.

## Prerequisites

- Indexed project: `discover_1c_context` or `bsl.index_project` + `form.index_project`
- Metadata loaded via export or OData for query validation

## Key tools

| Tool | Purpose |
|------|---------|
| `get_unified_context_for_task` | One-shot BSL + forms + metadata + extensions pack |
| `bsl_search` | Hybrid keyword + semantic index search |
| `bsl_go_to_definition` | Resolve symbol/module definition |
| `bsl_get_call_hierarchy` | Inbound/outbound callers with depth |
| `bsl_get_completion_hints` | Prefix hints from symbols/metadata/BSP |
| `bsl_validate_query` | Validate query tables/fields vs metadata |
| `form_get_layout_snapshot` | Nested form layout tree |

## Example prompt flow

1. `discover_1c_context` with export path
2. `get_unified_context_for_task` with user task text
3. `bsl_go_to_definition` for target symbol
4. `bsl_get_call_hierarchy` to trace callers
5. `form_get_layout_snapshot` when changing UI

## MCP resources

- `onec://{profileId}/semantic/summary` — semantic index stats
- `onec://platform/standards` — default project standards hints

## Index storage

After `discover_1c_context` or explicit re-index, documents are stored per profile in SQLite FTS5:

- Path: `{ONEC_MCP_DATA_DIR}/semantic-index/{profileId}.sqlite`
- Backend: `sqlite-fts5+tfidf` (FTS5 BM25 + TF-IDF cosine rerank; see `storageBackend` in semantic summary resource)
- Legacy JSON index files are removed on rebuild

`form_get_layout_snapshot` accepts `format: "json" | "yaml"` for compact layout trees.
