Skip to content

Add optional rationale parameter to update_issue_type tool#2458

Draft
alondahari wants to merge 1 commit into
mainfrom
alondahari/add-rationale-to-update-issue-type
Draft

Add optional rationale parameter to update_issue_type tool#2458
alondahari wants to merge 1 commit into
mainfrom
alondahari/add-rationale-to-update-issue-type

Conversation

@alondahari
Copy link
Copy Markdown
Member

@alondahari alondahari commented May 12, 2026

Summary

Adds an optional rationale string parameter (max 280 chars) to the update_issue_type MCP tool, enabling agents to explain their classification decisions when setting an issue's type.

Motivation

Per the decision update on github/plan-track-agentic-toolkit#57, we're adding rationale directly to the upstream tool rather than as a remote-server-only override. This keeps the open-source tool schema in sync with the API contract while the API gracefully ignores the rationale when the server-side feature flag is disabled.

Why a standalone tool instead of using issueUpdateTool

The issueUpdateTool helper constrains handlers to returning a *github.IssueRequest, which only supports Type *string. When rationale is provided, the REST API expects the type field as an object ({"value": "...", "rationale": "..."}) rather than a plain string. Since go-github's IssueRequest struct can't represent this object form, we need to build a custom request body and use client.NewRequest/client.Do directly. Breaking out of the helper is the minimal change that enables the two serialization paths (string when no rationale, object when rationale is present) without modifying the shared helper or other tools that depend on it.

Once the API changes are stable and go-github is updated to support the object form natively, we intend to migrate this tool back to the shared issueUpdateTool helper.

Changes

  • pkg/github/issues_granular.go — Rewrote GranularUpdateIssueType as a standalone tool (no longer uses issueUpdateTool helper). When rationale is provided, sends the type as an object {"value": "...", "rationale": "..."} via a raw PATCH request. When omitted, sends {"type": "..."} preserving existing behavior.
  • pkg/github/granular_tools_test.go — Expanded test to table-driven covering both type-only and type-with-rationale cases.
  • pkg/github/__toolsnaps__/update_issue_type.snap — Updated schema snapshot.

Acceptance criteria

  • rationale is always in the schema (no feature-flag gating in this repo)
  • ✅ No behavioral change when rationale is omitted
  • ✅ Single API call passes both type and rationale when provided

Closes github/plan-track-agentic-toolkit#57

/cc @margaretmz

@alondahari alondahari force-pushed the alondahari/add-rationale-to-update-issue-type branch 3 times, most recently from c82dcb5 to 3b57894 Compare May 12, 2026 14:30
Add an optional `rationale` string parameter (max 280 chars) to the
`update_issue_type` MCP tool. When provided, the type is sent as an
object `{"name": "...", "rationale": "..."}` to the REST API,
enabling agents to explain their classification decisions. When omitted,
existing behavior is preserved (type sent as a plain string).

This supports the agent rationale experiment for type mutations. The
parameter is always visible in the schema — the API gracefully ignores
the rationale when the server-side feature flag is disabled.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@alondahari alondahari force-pushed the alondahari/add-rationale-to-update-issue-type branch from 3b57894 to 2ce2ced Compare May 12, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants