Skip to content

Add MCPServerID semantic type for MCP server ID constants#17897

Merged
pelikhan merged 2 commits intomainfrom
copilot/add-mcpserverid-semantic-type
Feb 23, 2026
Merged

Add MCPServerID semantic type for MCP server ID constants#17897
pelikhan merged 2 commits intomainfrom
copilot/add-mcpserverid-semantic-type

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 23, 2026

Three MCP server ID constants were untyped strings, allowing accidental mixing with arbitrary string values. This adds a MCPServerID semantic type for compile-time safety, consistent with the existing pattern (JobName, StepID, EngineName, etc.).

Changes

  • pkg/constants/constants.go: Adds type MCPServerID string with String() and IsValid() methods; applies it to SafeOutputsMCPServerID, SafeInputsMCPServerID, and AgenticWorkflowsMCPServerID

  • 15 usage sites across 11 files: Updates string concatenation in YAML builders, strings.Contains() calls, struct field assignments, and comparisons to use .String() where a plain string is required

// Before
const SafeOutputsMCPServerID = "safeoutputs"

// After
type MCPServerID string

func (m MCPServerID) String() string { return string(m) }
func (m MCPServerID) IsValid() bool  { return len(m) > 0 }

const SafeOutputsMCPServerID MCPServerID = "safeoutputs"

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GO111MODULE 64/bin/go git init�� GOMODCACHE go /usr/lib/git-core/git -json GO111MODULE 64/bin/go /usr/lib/git-core/git (http block)
    • Triggering command: /usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name /usr/bin/docker -json GO111MODULE 64/bin/go docker pull�� test/concurrent-image:v1.0.0 go /usr/bin/git to pkg/workflow/git GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -json GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linu--package-lock-only -ato�� -bool -buildtags /usr/bin/git -errorsas -ifaceassert -nilfunc git (http block)
  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha ozjh/NgsfPETX_HDRV8gpozjh GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE 8916404/b370/importcfg env k/gh-aw/gh-aw/internal/tools/generate-action-metadata/main.go GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env 01/main.md GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha 88 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x-lang=go1.25 GOINSECURE GOMOD GOMODCACHE go env 5240-27706/test-3353790188 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x-nolocalimports GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha e=false GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env runs/20260223-115240-27706/test-1651451586/.github/workflows .cfg /opt/hostedtoolcache/go/1.25.0/x64/bin/go l GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha om/owner/repo.git om/owner/repo.git /usr/bin/git -s -w -buildmode=exe git rev-�� --show-toplevel -extld=gcc /usr/bin/git "prettier" --chegit node 64/bin/go git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha y-test.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha sistency_GoAndJavaScript3346347526/001/test-frontmatter-with-nested-objects.md GOPROXY ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOSUMDB GOWORK 64/bin/go ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel node /usr/bin/git --check **/*.cjs 64/bin/go git rev-�� --git-dir 8afRszc/J-5ptimqremote.origin.url /usr/bin/git -json GO111MODULE 64/bin/go /usr/bin/git (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD ode-gyp-bin/sh go env ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD erignore go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha vaScript3346347526/001/test-fron-test.timeout=10m0s GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env runs/20260223-115240-27706/test-2645297263/.github/workflows .cfg /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha /ref/tags/v8 GO111MODULE Name,createdAt,startedAt,updated-buildmode=exe GOINSECURE GOMOD GOMODCACHE go env runs/20260223-115240-27706/test-2645297263/.github/workflows GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 7KRlb0f/T36gUPQZremote.origin.url (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env y-test.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE erignore env tformat GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 bagabas/go-udiffenv GOMODCACHE go env DfIt/H91eAJ5JZRwGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 6811366/b382/impGOPROXY (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6 GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github%2Fworkflows%2Faudit-workflows.md
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions node --conditions development --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js GO111MODULE /opt/hostedtoolc--abbrev-ref git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE /usr/bin/cp git (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md
    • Triggering command: /tmp/go-build1808916404/b381/cli.test /tmp/go-build1808916404/b381/cli.test -test.testlogfile=/tmp/go-build1808916404/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 3814533582/.github/workflows GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json f01c94a847849a31GOMOD 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --repo owner/repo --json name,path,state /usr/bin/git -json GO111MODULE x_amd64/compile git rev-�� --show-toplevel x_amd64/compile /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build1808916404/b381/cli.test /tmp/go-build1808916404/b381/cli.test -test.testlogfile=/tmp/go-build1808916404/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE erignore env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/test/repo
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch --get-regexp ^remote\..*\.gh-resolved$ /usr/bin/git -json GO111MODULE x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git -json GO111MODULE 64/bin/go git (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Add MCPServerID semantic type for MCP server ID constants</issue_title>
<issue_description>## Objective

Introduce an MCPServerID semantic type in pkg/constants and apply it to the 3 MCP server ID constants, providing compile-time safety when referencing MCP server identifiers.

Context

Discussion #17885 (Typist - Go Type Consistency Analysis) identified 3 untyped string constants for MCP server IDs used in 15+ locations across pkg/workflow and pkg/cli. Typing them makes the intent explicit and prevents accidental string mixing.

Location

File: pkg/constants/constants.go (around lines 648–657)

// Current — untyped strings
const SafeOutputsMCPServerID = "safeoutputs"
const SafeInputsMCPServerID = "safeinputs"
const AgenticWorkflowsMCPServerID = "agenticworkflows"

// Proposed — typed
type MCPServerID string

func (m MCPServerID) String() string { return string(m) }

const SafeOutputsMCPServerID MCPServerID = "safeoutputs"
const SafeInputsMCPServerID MCPServerID = "safeinputs"
const AgenticWorkflowsMCPServerID MCPServerID = "agenticworkflows"

Approach

  1. Add type MCPServerID string with String() and IsValid() methods (consistent with other semantic types in pkg/constants) in pkg/constants/constants.go
  2. Apply the type to all 3 MCP server ID constants
  3. Update the 15+ usage sites — many use string concatenation for YAML builders (e.g., "[mcp_servers." + constants.SafeOutputsMCPServerID + "]"). These will require .String() or string() conversion

Files to Modify

  • pkg/constants/constants.go — add MCPServerID type, apply to 3 constants
  • pkg/workflow/*.go — update usage sites in YAML builders
  • pkg/cli/*.go — update any usage sites

Acceptance Criteria

  • type MCPServerID string defined with String() and IsValid() methods
  • All 3 MCP server ID constants use the MCPServerID type
  • All usage sites (string concatenation in YAML builders and elsewhere) compile correctly
  • make build and make test-unit pass
  • make fmt and make lint pass

Generated by Plan Command for issue #discussion #17885

  • expires on Feb 25, 2026, 11:40 AM UTC

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add MCPServerID semantic type for MCP server ID constants Add MCPServerID semantic type for MCP server ID constants Feb 23, 2026
@pelikhan pelikhan marked this pull request as ready for review February 23, 2026 12:01
Copilot AI review requested due to automatic review settings February 23, 2026 12:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a MCPServerID semantic type to provide compile-time type safety for MCP (Model Context Protocol) server identifier constants. The change follows the established pattern used by other semantic types in the codebase (JobName, StepID, EngineName, etc.).

Changes:

  • Added MCPServerID type with String() and IsValid() methods in pkg/constants/constants.go
  • Applied the type to three MCP server ID constants: SafeOutputsMCPServerID, SafeInputsMCPServerID, and AgenticWorkflowsMCPServerID
  • Updated all 15 usage sites across 11 files to call .String() where string values are required

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/constants/constants.go Defines MCPServerID type with helper methods and applies it to 3 MCP server ID constants
pkg/constants/constants_test.go Updates test to use explicit string() conversion for value comparison
pkg/workflow/unified_prompt_step.go Updates string concatenation to use .String() method
pkg/workflow/safe_inputs_renderer.go Updates string concatenation to use .String() method
pkg/workflow/mcp_renderer.go Updates string concatenation in TOML builders to use .String() method (4 locations)
pkg/workflow/mcp_config_builtin.go Updates string concatenation in JSON/TOML builders to use .String() method (4 locations)
pkg/workflow/copilot_engine_tools.go Updates append arguments to use .String() method (2 locations)
pkg/workflow/mcp_renderer_test.go Updates strings.Contains() calls to use .String() method (2 locations)
pkg/workflow/agentic_workflow_test.go Updates assert.Contains() call to use .String() method
pkg/workflow/importable_tools_test.go Updates strings.Contains() call to use .String() method
pkg/parser/mcp.go Updates strings.Contains() calls and struct field assignments to use .String() method (6 locations)
pkg/cli/mcp_list_tools_test.go Updates function call arguments to use .String() method (2 locations)
pkg/cli/mcp_inspect_test.go Updates struct field comparisons to use .String() method (5 locations)
pkg/cli/mcp_inspect_list.go Updates struct field comparison to use .String() method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pelikhan pelikhan merged commit ee7a697 into main Feb 23, 2026
120 checks passed
@pelikhan pelikhan deleted the copilot/add-mcpserverid-semantic-type branch February 23, 2026 12:17
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.

[plan] Add MCPServerID semantic type for MCP server ID constants

3 participants