@@ -151,8 +151,8 @@ class JSONRPCResponse(BaseModel):
151151"""Error code indicating that a URL mode elicitation is required before the request can be processed."""
152152
153153# SDK error codes
154- CONNECTION_CLOSED = - 32001
155- # REQUEST_TIMEOUT = -32002 # the typescript sdk uses this
154+ CONNECTION_CLOSED = - 32000
155+ # REQUEST_TIMEOUT = -32001 # the typescript sdk uses this
156156
157157# Standard JSON-RPC error codes
158158PARSE_ERROR = - 32700
@@ -1462,22 +1462,6 @@ class ElicitCompleteNotification(
14621462 params : ElicitCompleteNotificationParams
14631463
14641464
1465- class ElicitTrackRequestParams (RequestParams ):
1466- """Parameters for elicitation tracking requests."""
1467-
1468- elicitationId : str
1469- """The unique identifier of the elicitation to track."""
1470-
1471- model_config = ConfigDict (extra = "allow" )
1472-
1473-
1474- class ElicitTrackRequest (Request [ElicitTrackRequestParams , Literal ["elicitation/track" ]]):
1475- """A request from the client to track progress of a URL mode elicitation."""
1476-
1477- method : Literal ["elicitation/track" ] = "elicitation/track"
1478- params : ElicitTrackRequestParams
1479-
1480-
14811465class ClientRequest (
14821466 RootModel [
14831467 PingRequest
@@ -1493,7 +1477,6 @@ class ClientRequest(
14931477 | UnsubscribeRequest
14941478 | CallToolRequest
14951479 | ListToolsRequest
1496- | ElicitTrackRequest
14971480 ]
14981481):
14991482 pass
@@ -1510,34 +1493,58 @@ class ClientNotification(
15101493"""Schema for elicitation requests."""
15111494
15121495
1513- class ElicitRequestParams (RequestParams ):
1514- """Parameters for elicitation requests.
1496+ class ElicitRequestFormParams (RequestParams ):
1497+ """Parameters for form mode elicitation requests.
15151498
1516- The mode field determines the type of elicitation:
1517- - "form": In-band structured data collection with optional schema validation
1518- - "url": Out-of-band interaction via URL navigation
1499+ Form mode collects non-sensitive information from the user via an in-band form
1500+ rendered by the client.
15191501 """
15201502
1521- mode : Literal ["form" , "url" ]
1522- """The mode of elicitation ( form or url )."""
1503+ mode : Literal ["form" ] = "form"
1504+ """The elicitation mode (always " form" for this type )."""
15231505
15241506 message : str
1525- """A human-readable message explaining why the interaction is needed."""
1507+ """The message to present to the user describing what information is being requested."""
1508+
1509+ requestedSchema : ElicitRequestedSchema
1510+ """
1511+ A restricted subset of JSON Schema defining the structure of expected response.
1512+ Only top-level properties are allowed, without nesting.
1513+ """
15261514
1527- # Form mode fields
1528- requestedSchema : ElicitRequestedSchema | None = None
1529- """JSON Schema defining the structure of expected response (form mode only)."""
1515+ model_config = ConfigDict (extra = "allow" )
1516+
1517+
1518+ class ElicitRequestURLParams (RequestParams ):
1519+ """Parameters for URL mode elicitation requests.
1520+
1521+ URL mode directs users to external URLs for sensitive out-of-band interactions
1522+ like OAuth flows, credential collection, or payment processing.
1523+ """
1524+
1525+ mode : Literal ["url" ] = "url"
1526+ """The elicitation mode (always "url" for this type)."""
1527+
1528+ message : str
1529+ """The message to present to the user explaining why the interaction is needed."""
15301530
1531- # URL mode fields
1532- url : str | None = None
1533- """The URL that the user should navigate to (url mode only)."""
1531+ url : str
1532+ """The URL that the user should navigate to."""
15341533
1535- elicitationId : str | None = None
1536- """A unique identifier for the elicitation (url mode only)."""
1534+ elicitationId : str
1535+ """
1536+ The ID of the elicitation, which must be unique within the context of the server.
1537+ The client MUST treat this ID as an opaque value.
1538+ """
15371539
15381540 model_config = ConfigDict (extra = "allow" )
15391541
15401542
1543+ # Union type for elicitation request parameters
1544+ ElicitRequestParams : TypeAlias = ElicitRequestURLParams | ElicitRequestFormParams
1545+ """Parameters for elicitation requests - either form or URL mode."""
1546+
1547+
15411548class ElicitRequest (Request [ElicitRequestParams , Literal ["elicitation/create" ]]):
15421549 """A request from the server to elicit information from the client."""
15431550
@@ -1556,59 +1563,29 @@ class ElicitResult(Result):
15561563 - "cancel": User dismissed without making an explicit choice
15571564 """
15581565
1559- content : dict [str , str | int | float | bool | None ] | None = None
1566+ content : dict [str , str | int | bool | list [ str ] ] | None = None
15601567 """
15611568 The submitted form data, only present when action is "accept" in form mode.
1562- Contains values matching the requested schema.
1569+ Contains values matching the requested schema. Values can be strings, integers,
1570+ booleans, or arrays of strings.
15631571 For URL mode, this field is omitted.
15641572 """
15651573
15661574
1567- class ElicitTrackResult (Result ):
1568- """The server's response to an elicitation tracking request."""
1569-
1570- status : Literal ["pending" , "complete" ]
1571- """
1572- The status of the elicitation.
1573- - "pending": The elicitation is still in progress
1574- - "complete": The elicitation has been completed
1575- """
1576-
1577- model_config = ConfigDict (extra = "allow" )
1578-
1579-
1580- class UrlElicitationInfo (BaseModel ):
1581- """Information about a URL mode elicitation embedded in an ElicitationRequired error."""
1582-
1583- mode : Literal ["url" ] = "url"
1584- """The mode of elicitation (must be "url")."""
1585-
1586- elicitationId : str
1587- """A unique identifier for the elicitation."""
1588-
1589- url : str
1590- """The URL that the user should navigate to."""
1591-
1592- message : str
1593- """A human-readable message explaining why the interaction is needed."""
1594-
1595- model_config = ConfigDict (extra = "allow" )
1596-
1597-
15981575class ElicitationRequiredErrorData (BaseModel ):
1599- """Error data for ElicitationRequired errors .
1576+ """Error data for URLElicitationRequiredError .
16001577
16011578 Servers return this when a request cannot be processed until one or more
16021579 URL mode elicitations are completed.
16031580 """
16041581
1605- elicitations : list [UrlElicitationInfo ]
1582+ elicitations : list [ElicitRequestURLParams ]
16061583 """List of URL mode elicitations that must be completed."""
16071584
16081585 model_config = ConfigDict (extra = "allow" )
16091586
16101587
1611- class ClientResult (RootModel [EmptyResult | CreateMessageResult | ListRootsResult | ElicitResult | ElicitTrackResult ]):
1588+ class ClientResult (RootModel [EmptyResult | CreateMessageResult | ListRootsResult | ElicitResult ]):
16121589 pass
16131590
16141591
0 commit comments