Skip to main content

Module coerce

Module coerce 

Source
Expand description

Type coercion and validation for MCP tool parameters.

This module provides flexible type coercion to help AI agents interact with MCP tools correctly, even when they pass parameters with slightly incorrect types (e.g., numbers instead of strings).

Structs§

CoercionError
Structured error type for coercion failures.

Constants§

VALID_INTERACTION_TYPES
Valid interaction type values

Functions§

coerce_and_validate
Coerce and validate a JSON value into the target type.
generate_recovery_suggestions
Generate recovery suggestions based on error message patterns.