|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -"""Phase 9 D10.d (#96) — vector_search split MCP tool (§B.1). |
| 15 | +"""Vector search MCP tool. |
16 | 16 |
|
17 | 17 | The discrete vector-similarity search primitive per |
18 | 18 | ``docs/modularization/d10-design-pack.md`` §B.1 (Lock #5 split). The |
|
27 | 27 | caller can navigate from a search hit straight into the read |
28 | 28 | primitives. |
29 | 29 |
|
30 | | -The ``cursor`` parameter is a placeholder per the same amendment |
31 | | -thread (Drift #4 resolution (c)): the signature is published now so |
32 | | -external MCP clients see the canonical shape, but the body explicitly |
33 | | -raises ``NotImplementedError("search pagination is not yet |
34 | | -implemented")`` on any **non-empty** value. The architect sign-off |
35 | | -(msg=ebfcdabe) plus Weston's blocker review (msg=177a1dd8) explicitly |
36 | | -forbid reusing the canonical ``CursorError("cursor_invalid", ...)`` |
37 | | -malformed-wire semantic for this "feature not implemented" case — |
38 | | -that would camouflage missing capability as a client-side cursor bug. |
39 | | -``cursor=None`` and ``cursor=""`` both keep the existing single-page |
40 | | -``top_k`` behavior (Weston msg=177a1dd8 lock); only truthy / |
41 | | -non-empty cursor values trigger the loud-fail. |
| 30 | +Search pagination is not part of the public MCP contract yet, so this |
| 31 | +tool intentionally exposes only single-page ``top_k`` retrieval. |
42 | 32 | """ |
43 | 33 |
|
44 | 34 | from __future__ import annotations |
@@ -72,7 +62,6 @@ async def vector_search( |
72 | 62 | top_k: int = 5, |
73 | 63 | similarity_threshold: float | None = None, |
74 | 64 | rerank: bool = True, |
75 | | - cursor: str | None = None, |
76 | 65 | ) -> Dict[str, Any]: |
77 | 66 | """Vector similarity search within a collection (§B.1). |
78 | 67 |
|
@@ -107,26 +96,11 @@ async def vector_search( |
107 | 96 | similarity_threshold: Minimum similarity score [0, 1]; ``None`` |
108 | 97 | uses the collection's default threshold. |
109 | 98 | rerank: Whether to apply reranker on returned candidates (default: True). |
110 | | - cursor: Pagination cursor placeholder (§B.1). ``None`` and |
111 | | - ``""`` both return the first page (current behavior); any |
112 | | - non-empty value raises ``NotImplementedError`` with a |
113 | | - ``"search pagination is not yet implemented"`` message per |
114 | | - the ``[D10 spec amendment]`` (msg=b9b7072a + sign-off |
115 | | - msg=ebfcdabe + Weston msg=177a1dd8). Real search |
116 | | - pagination requires a backend capability that is not yet |
117 | | - available and will land in a dedicated D11+ upgrade. |
118 | 99 |
|
119 | 100 | Returns: |
120 | 101 | Search results with ``items`` ranked by vector similarity. Each |
121 | 102 | item carries ``recall_type = "vector_search"``. |
122 | 103 | """ |
123 | | - if cursor: |
124 | | - # ``cursor`` is truthy iff non-None and non-empty (Weston |
125 | | - # msg=177a1dd8 lock: ``None`` and ``""`` both preserve |
126 | | - # single-page ``top_k`` behavior). |
127 | | - raise NotImplementedError( |
128 | | - "search pagination is not yet implemented (tool=vector_search, reason=search_not_paginated)" |
129 | | - ) |
130 | 104 | try: |
131 | 105 | api_key = get_api_key() |
132 | 106 |
|
|
0 commit comments