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 inside scikitplot.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 retriever does not implement DocsRetriever, or if the bounds are not numbers.

ValueError

If the bounds are outside their permitted ranges.

Parameters:

See also

scikitplot.mcp._server.SearchService

Wire 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 SearchService is a wire/model adapter over it. Keeping the two separate is what allows integrations/ to depend on the public Tier-L surface without pulling pydantic into 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 by build_search_docs_result.

Raises:
ValueError

If the arguments are invalid.

RuntimeError

If no concurrency slot is available, or the retriever failed.

Parameters:
Return type:

dict[str, Any]

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 query is not a non-empty string within MAX_QUERY_CHARS, or k is not an integer within 1..MAX_RESULTS.

Parameters:
Return type:

tuple[str, int]