github / github/github-mcp-server

get_discussion and get_discussion_comments accept calls with missing required parameters instead of returning a validation error

未关闭 适合新手
#2,740 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
33k
派生
5k
平均合并
2 天 1 小时
30 天内合并 PR
52

描述

### Describe the bug

When `get_discussion` or `get_discussion_comments` is called without one of the required parameters (`owner`, `repo`, or `discussionNumber`), the tool does not return a parameter-validation error. Instead it silently substitutes a zero value and issues a GraphQL request, which returns a confusing API-level error rather than a clear message identifying the missing field.

**Affected version:** current (tested against `ghcr.io/github/github-mcp-server` latest as of 2026-06)

### Steps to reproduce

1. Configure the MCP server normally.
2. Call `get_discussion` with only `{"repo": "myrepo", "discussionNumber": 1}` (omitting `owner`).
3. Observe that the tool returns a GraphQL error like `"Could not resolve to a Repository"` rather than a message indicating `owner` is required.

Repeat with `get_discussion_comments` and any missing required field.

### Expected behavior

The tool should return a structured error immediately: `"missing required parameter: owner"` (or equivalent), consistent with how `add_discussion_comment` and the other discussion write tools behave when a required parameter is absent.

### Actual behavior

The tool issues a GraphQL query with the missing field set to its zero value (`""` for strings, `0` for numbers) and returns whichever API error results from that invalid query.

### Additional context

The write handlers in the same file (`add_discussion_comment`, `reply_to_discussion_comment`, etc.) were updated in PR #2718 to use explicit parameter validation that returns named errors on missing input. The two read handlers were not included in that pass and still use the legacy decoding pattern.

贡献指南

打开贡献指南

调研方向

Start by locating the get_discussion and get_discussion_comments handlers and compare their parameter decoding with the validated discussion write handlers updated in PR #2718. Reproduce calls with each required field omitted, then confirm both read tools return a named missing-parameter validation error without issuing a GraphQL request.

由索引模型根据 Issue 内容生成。

评估

技术栈
go
领域
api, backend-api-design
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
描述清楚
新手友好度
76/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。