Skip to content

Add type-safe requestedSchema support for elicitation (MCP 2025-06-18 full compliance) #465

@bug-ops

Description

@bug-ops

The current elicitation implementation uses a generic JsonObject type for the requested_schema field in CreateElicitationRequestParam. This approach lacks type safety and does not enforce the structure defined in the MCP 2025-06-18 specification.

Current implementation:

pub struct CreateElicitationRequestParam {
    pub message: String,
    pub requested_schema: JsonObject,  // Too generic, no type safety
}

According to the MCP specification schema, requestedSchema should have a strict structure:

requestedSchema: {
  type: "object";
  properties: {
    [key: string]: PrimitiveSchemaDefinition;
  };
  required?: string[];
}

Where PrimitiveSchemaDefinition is a union of:

  • StringSchema (with minLength, maxLength, format: "email" | "uri" | "date" | "date-time")
  • NumberSchema (with minimum, maximum, type: "number" | "integer")
  • BooleanSchema (with default)
  • EnumSchema (with enum: string[], enumNames?: string[])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions