MCPcopy
hub / github.com/modelcontextprotocol/python-sdk / elicit_form

Method elicit_form

src/mcp/shared/peer.py:164–181  ·  view source on GitHub ↗

Send a form-mode `elicitation/create` request. Raises: MCPError: The peer responded with an error. NoBackChannelError: No back-channel for server-initiated requests. pydantic.ValidationError: The peer's result does not match the expected result type.

(
        self,
        message: str,
        requested_schema: ElicitRequestedSchema,
        *,
        meta: Meta | None = None,
        opts: CallOptions | None = None,
    )

Source from the content-addressed store, hash-verified

162 return CreateMessageResult.model_validate(result, by_name=False)
163
164 async def elicit_form(
165 self,
166 message: str,
167 requested_schema: ElicitRequestedSchema,
168 *,
169 meta: Meta | None = None,
170 opts: CallOptions | None = None,
171 ) -> ElicitResult:
172 """Send a form-mode `elicitation/create` request.
173
174 Raises:
175 MCPError: The peer responded with an error.
176 NoBackChannelError: No back-channel for server-initiated requests.
177 pydantic.ValidationError: The peer's result does not match the expected result type.
178 """
179 params = ElicitRequestFormParams(message=message, requested_schema=requested_schema)
180 result = await self.send_raw_request("elicitation/create", dump_params(params, meta), opts)
181 return ElicitResult.model_validate(result, by_name=False)
182
183 async def elicit_url(
184 self,

Calls 3

send_raw_requestMethod · 0.95
dump_paramsFunction · 0.85