Skip to content

fix(mcp): use component slug in primer.style URLs - #8582

Merged
joshblack merged 2 commits into
primer:mainfrom
Pranay623:fix-mcp-component-slug-urls
Oct 20, 2026
Merged

joshblack merged 2 commits into
primer:mainfrom
Pranay623:fix-mcp-component-slug-urls

Conversation

@Pranay623

Copy link
Copy Markdown
Contributor

Summary

Fixes incorrect documentation URLs in get_component_examples and get_component_accessibility_guidelines by using match.slug instead of match.id.

Problem

Multi-word components such as TextInput have IDs containing underscores (text_input), while their Primer documentation URLs use hyphenated slugs (text-input). Using the ID causes Primer to return its homepage with HTTP 200, resulting in incorrect documentation being returned by both MCP tools.

Changes

  • Updated get_component_examples to use match.slug when constructing component documentation URLs.
  • Updated get_component_accessibility_guidelines to use match.slug when constructing accessibility guidelines URLs.
  • Added regression tests to verify the correct URLs are used for both tools.

Testing

  • MCP test suite
  • MCP build
  • Type-check
  • Regression tests for both affected tools

Related Issue

Fixes #8561

Copilot AI balanced review requested due to automatic review settings October 20, 2026 16:01
@Pranay623
Pranay623 requested a review from a team as a code owner October 20, 2026 16:01
@changeset-bot

changeset-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eaa638b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/mcp Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Updated the component MCP tools to ensure HTTP requests match the slug of components for primer.style.
@joshblack joshblack changed the title Fix component slug URLs in MCP tools fix(mcp): use component slug in primer.style URLs Oct 20, 2026
@primer primer deleted a comment from github-actions Bot Oct 20, 2026
@joshblack

Copy link
Copy Markdown
Member

.skip-integration-checks

@joshblack
joshblack added this pull request to the merge queue Oct 20, 2026
Merged via the queue into primer:main with commit e0524db Oct 20, 2026
57 of 58 checks passed
@primer primer Bot mentioned this pull request Oct 20, 2026

This branch was successfully deployed

1 active deployment
github-pages — eaa638b6 Deployed Oct 20, 2026 by joshblack via deploy-preview #30106
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: skipped manually Changes in this PR do not require an integration test

Projects

None yet

3 participants