Form elicitation fails when a multi-select field has only one string option
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 72/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- python
- Domínio
- backend-api-design
Direção de pesquisa
Start in mcp.server.elicitation.render_elicitation_schema and trace how Pydantic turns list[Literal["email"]] into the elicitation items schema. Compare the generated schema with the multi-option case and inspect the validation against PrimitiveSchemaDefinition. Add a regression test for the single-option case; done means the schema has "enum": ["email"] and the form returns the selected value.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Initial Checks
- I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1)
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Release line
2.x (current stable)
Description
With list[Literal["email", "print"]], the SDK sends the form. With list[Literal["email"]], I reproduced a failure before the client received the form. Both [] and ["email"] are meaningful selections.
I expected the items schema to contain "enum": ["email"]. On 2.3.0 it contains "const": "email", and the SDK raises TypeError when validating the channels field against PrimitiveSchemaDefinition.
I ran the same in-memory client twice. On 2.3.0 the tool returned Error executing tool subscribe. With a local patch, the client received {"enum": ["email"], "type": "string"} and the tool returned email successfully.
Related issue #3883 covers $ref for Enum classes. This example uses typing.Literal.
Codex helped investigate, wrote the local patch and regression test, and drafted this report.
Example Code
from typing import Literal
from mcp.server.elicitation import render_elicitation_schema
from pydantic import BaseModel
class Delivery(BaseModel):
channels: list[Literal["email"]]
print(render_elicitation_schema(Delivery)["properties"]["channels"])
Python & MCP Python SDK
Python 3.14.4, mcp 2.3.0, Pydantic 2.12.5. Also reproduced on main at 77001c96.
- Linguagem predominante
- Python
- Estrelas
- 25k
- Forks
- 4.2k
- Merge médio
- 10min
- PRs com merge (30d)
- 1
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de modelcontextprotocol/python-sdk
-
v2
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 86/100
modelcontextprotocol/python-sdk#3978 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Client serves cached tools after its context exits with an exceptionTalvez já em andamento @jonxsong assumiu há 1 dia. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
modelcontextprotocol/python-sdk#3968 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
modelcontextprotocol/python-sdk#3957 ·
Mantenedores costumam responder em até 1 dia
-
v2
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 91/100
modelcontextprotocol/python-sdk#3934 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
bug v1
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 79/100
modelcontextprotocol/python-sdk#3929 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de modelcontextprotocol/python-sdk
Issues semelhantes
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwiseTalvez já em andamento @abdulwaarith0 assumiu hoje. Abertaneeds-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
MakazhanAlpamys/Soup#3690 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
bug data-types native-format
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
ClickHouse/clickhouse-connect#1320 ·
Mantenedores costumam responder em até 1 dia
-
Public benchmark import end-to-end test fails when the test stack's worker runs the parity jobAbertaaccepted
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
future-agi/future-agi#6392 ·
Mantenedores costumam responder em até 1 dia