SearchCoordinator#
- class scikitplot.mcp.SearchCoordinator(retriever, *, max_concurrency=4, acquire_timeout_seconds=0.05)[source]#
Validated, concurrency-bounded search orchestration, free of wire models.
This is the Legacy Retrieval tier (Python 3.8+, no
pydantic, no MCP SDK) half of what used to live entirely insidescikitplot.mcp._server.SearchService.- Parameters:
- retrieverDocsRetriever
Any object implementing
search(query, k).- max_concurrencyint, optional
Maximum number of in-flight searches (1-128, default 4).
- acquire_timeout_secondsfloat, optional
How long to wait for a concurrency slot before reporting the service busy (default 0.05).
- Raises:
- TypeError
If
retrieverdoes not implementDocsRetriever, or if the bounds are not numbers.- ValueError
If the bounds are outside their permitted ranges.
- Parameters:
retriever (DocsRetriever)
max_concurrency (int)
acquire_timeout_seconds (float)
See also
scikitplot.mcp._server.SearchServiceWire adapter that returns pydantic models built from this coordinator’s output.
Notes
User-focused. Use this when you want scikit-plots’ documentation search without installing the
[mcp]extra — for example inside an agent framework adapter. It returns plain dictionaries.Developer-focused. Run M05 decided that the neutral orchestration (argument validation, bounded concurrency, retriever invocation and result shaping) belongs at Tier-L, and that
SearchServiceis a wire/model adapter over it. Keeping the two separate is what allowsintegrations/to depend on the public Tier-L surface without pullingpydanticinto a base install.- search(query, k=5)[source]#
Run one bounded, validated search and return the neutral result.
- Parameters:
- querystr
Query text.
- kint, optional
Maximum passages to return.
- Returns:
- dict
The full tool result, i.e.
{"content", "structuredContent", "isError"}as produced bybuild_search_docs_result.
- Raises:
- ValueError
If the arguments are invalid.
- RuntimeError
If no concurrency slot is available, or the retriever failed.
- Parameters:
- Return type:
- validate(query, k=5)[source]#
Validate and normalise tool arguments.
- Parameters:
- querystr
Raw query text.
- kint, optional
Requested number of passages.
- Returns:
- tuple of (str, int)
The stripped query and the validated limit.
- Raises:
- ValueError
If
queryis not a non-empty string withinMAX_QUERY_CHARS, orkis not an integer within1..MAX_RESULTS.
- Parameters:
- Return type: