Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

The assign_to_agent tool description lacked a concrete usage example, potentially causing confusion about how to pass the required issue_number parameter. Additionally, the tool only supported issues, not pull requests. The tool's inputSchema was correctly defined, but the description didn't demonstrate invocation syntax and the implementation needed PR support.

Changes

  • Tool description enhancement: Added inline usage examples showing parameter syntax for both issues and PRs

    • Examples: assign_to_agent(issue_number=123, agent="copilot") and assign_to_agent(pull_number=456, agent="copilot")
    • Updated in both pkg/workflow/js/safe_outputs_tools.json (embedded) and actions/setup/js/safe_outputs_tools.json (runtime)
  • Pull request support: Added full support for assigning agents to pull requests

    • Added getPullRequestDetails() function to query PR assignees via GraphQL repository.pullRequest(number:)
    • Updated tool schema to accept both issue_number and pull_number parameters (mutually exclusive using oneOf)
    • Modified implementation to route to appropriate GraphQL query based on type
    • Updated error messages, summaries, and staged previews to distinguish between issues and PRs
  • Documentation updates: Updated safe outputs documentation to reflect PR support

    • Changed table of contents entry from "Assign Copilot agents to issues" to "Assign Copilot agents to issues or PRs"
    • Enhanced section description to mention both issues and pull requests
    • Added clarification that the agent must provide either issue_number or pull_number in the output
    • Updated YAML example with clearer inline comments
  • Playground workflow updates: Updated the playground assign-to-agent workflow to support both issue and PR URLs

    • Renamed input from issue_url to item_url to support both URL types
    • Enhanced input description to show examples for both issue and PR URLs
    • Updated task instructions to parse URL type and use appropriate parameter (issue_number or pull_number)
  • Binary rebuild: Recompiled to embed updated tool schema

  • Workflow updates: Recompiled affected workflows to include enhanced tool description in lock files

  • Tests: Updated tests to match new error message format, all tests passing

The tool now clearly demonstrates how to invoke it with parameters for both issues and pull requests. Both leverage GitHub's GraphQL API where Issue and PullRequest types implement the Assignable interface, allowing the same replaceActorsForAssignable mutation to work for both.

Before:

{
  "name": "assign_to_agent",
  "description": "Assign the GitHub Copilot coding agent to work on an issue. The agent will analyze the issue and attempt to implement a solution, creating a pull request when complete. Use this to delegate coding tasks to Copilot.",
  "inputSchema": {
    "type": "object",
    "required": ["issue_number"],
    "properties": {
      "issue_number": { ... },
      "agent": { ... }
    }
  }
}

After:

{
  "name": "assign_to_agent",
  "description": "Assign the GitHub Copilot coding agent to work on an issue or pull request. The agent will analyze the issue/PR and attempt to implement a solution, creating a pull request when complete. Use this to delegate coding tasks to Copilot. Example usage: assign_to_agent(issue_number=123, agent=\"copilot\") or assign_to_agent(pull_number=456, agent=\"copilot\")",
  "inputSchema": {
    "type": "object",
    "oneOf": [
      {"required": ["issue_number"]},
      {"required": ["pull_number"]}
    ],
    "properties": {
      "issue_number": { ... },
      "pull_number": { ... },
      "agent": { ... }
    }
  }
}
Original prompt

In workflow: Playground assign-to-agent, the safeoutputs-assign_to_agent tool was called but requires an issue_number parameter that the current tool interface doesn't support passing directly. The tool appears to need enhancement to accept the issue_number parameter in its function signature. The error message indicates it expects: {"issue_number": 123, "agent": "example value"} but the current tool definition doesn't expose parameters. Check how this is down in campaigns which have a working assign-to-agent step.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 15, 2026 08:19
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Enhance assign-to-agent tool to accept issue_number parameter Add usage example to assign_to_agent tool description Jan 15, 2026
Copilot AI requested a review from mnkiefer January 15, 2026 08:30
@mnkiefer
Copy link
Contributor

@copilot Should assign-to-agent not. have an option like assign-to-user? Is is assignable to both issues and PRs?
target: "*" # "triggering" (default), "*", or number

Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot Should assign-to-agent not. have an option like assign-to-user? Is is assignable to both issues and PRs?
target: "*" # "triggering" (default), "*", or number

Good catch! The assign-to-agent config struct already includes SafeOutputTargetConfig (with the target field), but:

  1. Not documented: The documentation doesn't mention the target option for assign-to-agent
  2. Limited implementation: Currently only supports issues (uses issue_number and getIssueDetails), not PRs
  3. Missing in tool schema: The MCP tool definition doesn't expose target as a parameter

The target option would be useful for workflows triggered by events other than issues (like workflow_dispatch), where you'd want to specify target: "*" and pass any issue_number.

Should I:

  • Add target support to the documentation?
  • Update the implementation to support PRs (similar to how assign-to-user works)?
  • Add target to the tool's inputSchema?

@mnkiefer
Copy link
Contributor

@copilot Does the api support PRs?

Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot Does the api support PRs?

Yes, the GitHub GraphQL API supports it. Both Issue and PullRequest implement the Assignable interface, so the replaceActorsForAssignable mutation used in the code should work for PRs.

However, the current implementation only queries issues:

  • getIssueDetails() uses repository.issue(number:) which only fetches issues
  • It would need a PR equivalent query using repository.pullRequest(number:)

The REST API approach (used by assign_to_user) is simpler since github.rest.issues.addAssignees() works for both issues and PRs automatically (PRs are treated as issues in the REST API).

@mnkiefer
Copy link
Contributor

@copilot Also add option for pull requests.

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot Also add option for pull requests.

Added pull request support in commit d8bd867. The tool now accepts either issue_number or pull_number parameters:

Changes:

  • Added getPullRequestDetails() function using GraphQL repository.pullRequest(number:) query
  • Updated tool schema with pull_number parameter (mutually exclusive with issue_number)
  • Modified implementation to route to appropriate GraphQL query based on type
  • Updated error messages, summaries, and staged previews to distinguish between issues/PRs

Usage examples:

assign_to_agent(issue_number=123, agent="copilot")
assign_to_agent(pull_number=456, agent="copilot")

Both leverage the replaceActorsForAssignable GraphQL mutation which works for any Assignable type (Issue or PullRequest).

Copilot AI changed the title Add usage example to assign_to_agent tool description Add usage example and pull request support to assign_to_agent tool Jan 15, 2026
@mnkiefer
Copy link
Contributor

@copilot Update safe outputs docs.

@mnkiefer mnkiefer marked this pull request as ready for review January 15, 2026 11:05
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot Update safe outputs docs.

Updated safe outputs documentation in commit 89655ca:

Changes to docs/src/content/docs/reference/safe-outputs.md:

  • Updated table of contents entry from "Assign Copilot agents to issues" to "Assign Copilot agents to issues or PRs"
  • Enhanced section description to mention both issues and pull requests
  • Added clarification that the agent must provide either issue_number or pull_number in the output
  • Updated YAML example with clearer inline comments

The documentation now accurately reflects that assign-to-agent supports both issues and pull requests.

@mnkiefer
Copy link
Contributor

@copilot Playground: Assign to agent workflow to align with this to make sure it get's the issue number (since input is issue url).

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot Playground: Assign to agent workflow to align with this to make sure it get's the issue number (since input is issue url).

Updated playground workflow in commit 8bb6202:

Changes to .github/workflows/playground-assign-to-agent.md:

  • Renamed input from issue_url to item_url to support both issues and PRs
  • Updated input description to show examples for both URL types
  • Enhanced task instructions to:
    • Parse the URL to determine if it's an issue (/issues/) or PR (/pull/)
    • Extract the numeric ID from the URL
    • Use the correct parameter (issue_number or pull_number) based on URL type

The workflow now properly guides the agent to extract the ID from the URL and call assign_to_agent with the appropriate parameter.

Copilot AI requested a review from mnkiefer January 15, 2026 11:20
@mnkiefer mnkiefer merged commit 7d5160a into main Jan 15, 2026
117 checks passed
@mnkiefer mnkiefer deleted the copilot/enhance-assign-to-agent-tool branch January 15, 2026 11:50
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