问题描述
yunxiao/list_sprints 接口在查询特定状态的迭代时返回类型错误,导致调用失败。
错误信息
MCP error -32603: Invalid input: [
{
"code": "invalid_type",
"expected": "string",
"received": "null",
"path": ["description"],
"message": "Expected string, received null"
}
]
复现步骤
- 调用
list_sprints 接口
- 参数设置:
status: ["DOING"]
- 接口返回错误
成功的情况
{
"organizationId": "628exxxxxxxxxxxxx2970",
"id": "c0d89xxxxxxxxxxxxxbf6d5",
"page": 1,
"perPage": 100,
"status": ["TODO"]
}
✅ 返回正常
{
"organizationId": "628exxxxxxxxxxxxx2970",
"id": "c0d89xxxxxxxxxxxxxbf6d5",
"page": 1,
"perPage": 100,
"status": ["ARCHIVED"]
}
✅ 返回正常
失败的情况
{
"organizationId": "628exxxxxxxxxxxxx2970",
"id": "c0d89xxxxxxxxxxxxxbf6d5",
"page": 1,
"perPage": 100,
"status": ["DOING"]
}
❌ 返回类型错误
问题分析
API 返回的数据中,description 字段在某些迭代中为 null,但接口定义期望的是 string 类型。这可能是由于:
- 数据库中
description 字段允许为 NULL
- 接口的响应 schema 没有正确处理
null 值
- 只有特定状态(如
DOING)的迭代存在 description 为 null 的情况
建议修复方案
- 方案一(推荐):修改接口响应 schema,允许
description 字段为 null 或 string
description: string | null
- 方案二:在返回数据前,将
null 值转换为空字符串
description: data.description ?? ""
问题描述
yunxiao/list_sprints接口在查询特定状态的迭代时返回类型错误,导致调用失败。错误信息
复现步骤
list_sprints接口status: ["DOING"]成功的情况
{ "organizationId": "628exxxxxxxxxxxxx2970", "id": "c0d89xxxxxxxxxxxxxbf6d5", "page": 1, "perPage": 100, "status": ["TODO"] }✅ 返回正常
{ "organizationId": "628exxxxxxxxxxxxx2970", "id": "c0d89xxxxxxxxxxxxxbf6d5", "page": 1, "perPage": 100, "status": ["ARCHIVED"] }✅ 返回正常
失败的情况
{ "organizationId": "628exxxxxxxxxxxxx2970", "id": "c0d89xxxxxxxxxxxxxbf6d5", "page": 1, "perPage": 100, "status": ["DOING"] }❌ 返回类型错误
问题分析
API 返回的数据中,
description字段在某些迭代中为null,但接口定义期望的是string类型。这可能是由于:description字段允许为 NULLnull值DOING)的迭代存在description为null的情况建议修复方案
description字段为null或stringnull值转换为空字符串