Skip to main content

validate_search_query

Function validate_search_query 

Source
pub fn validate_search_query(
    tool_name: &str,
    query: &str,
) -> Result<(), CallToolError>
Expand description

Validate a search query supplied by a tool caller.

Rejects empty/whitespace-only queries (which would otherwise trigger an unfiltered crates.io request returning arbitrary crates) and overly long queries that cannot represent a meaningful search.

ยงErrors

Returns a CallToolError describing the first problem found.