Skip to content

feat(mcp): Add accessibility guidance tool#3970

Open
DivyaNagaraja1 wants to merge 2 commits into
Workday:prerelease/minorfrom
DivyaNagaraja1:adding-get-accessibility-guidelines-mcptool
Open

feat(mcp): Add accessibility guidance tool#3970
DivyaNagaraja1 wants to merge 2 commits into
Workday:prerelease/minorfrom
DivyaNagaraja1:adding-get-accessibility-guidelines-mcptool

Conversation

@DivyaNagaraja1

@DivyaNagaraja1 DivyaNagaraja1 commented Jun 10, 2026

Copy link
Copy Markdown

Summary

Resolves: #3902
Adds a Canvas Kit MCP accessibility guidance capability. The new get-accessibility-guidelines tool returns guidance-only accessibility resources from existing Canvas Kit accessibility docs and component story docs.
This PR:

  • Exposes docs://accessibility/{slug} resources from existing modules/docs/mdx/accessibility documentation.
  • Dynamically extracts component Accessibility sections from story MDX files and exposes them as docs://examples/{slug}/accessibility.
  • Returns component docs links, component accessibility links, and scenario-specific accessibility guidance links from the new MCP tool.
  • Keeps the tool guidance-only. It does not scan code or pages, run automated accessibility tests, certify WCAG conformance, or guarantee compliance.

Release Category

Infrastructure

Release Note

Adds MCP accessibility guidance resources and a get-accessibility-guidelines tool for AI assistants working with Canvas Kit components.

BREAKING CHANGES


Checklist

For the Reviewer

  • PR title is short and descriptive
  • PR summary describes the change (Fixes/Resolves linked correctly)
  • PR Release Notes describes additional information useful to call out in a release message or removed if not applicable
  • Breaking Changes provides useful information to upgrade to this code or removed if not applicable

Where Should the Reviewer Start?

Start with:
modules/mcp/lib/index.ts
Then review:
modules/mcp/lib/accessibility-enums.ts
modules/mcp/build/discover-stories.ts
modules/mcp/lib/config.json
modules/mcp/build/index.ts

Areas for Feedback? (optional)

  • [x ] Code
  • [ x] Documentation
  • Testing
  • Codemods

Testing Manually

Inspect locally:

npx @modelcontextprotocol/inspector node dist/cli.js
Test get-accessibility-guidelines with:

{
"component": "checkbox",
"scenario": "tables",
}

Tool Result: Success
{
"component": "checkbox",
"scenario": "tables",
"scenarioSlugs": [
"forms",
"overview",
"tables"
],
"accessibilityResources": [
{
"uri": "docs://accessibility/forms",
"title": "Canvas Kit Form Accessibility",
"description": "Guidance from existing Canvas Kit accessibility documentation for form fields in table contexts."
},
{
"uri": "docs://accessibility/overview",
"title": "Canvas Kit Accessibility Overview",
"description": "Core Canvas Kit accessibility principles and component usage guidance. Guidance only; no automated validation or compliance certification."
},
{
"uri": "docs://accessibility/tables",
"title": "Canvas Kit Table Accessibility",
"description": "Guidance for semantic data tables, interactive tables, sorting, filtering, row selection, and table focus behavior."
}
],
"componentAccessibilityDocumentation": null,
"exampleDocumentation": {
"uri": "docs://examples/checkbox",
"title": "Components/Inputs/Checkbox Documentation & Sample Code",
"description": "Documentation and code examples for Components/Inputs/Checkbox."
}
}

Screenshots or GIFs (if applicable)

image

Summary by CodeRabbit

  • New Features

    • Added a tool to retrieve accessibility guidance by component and/or scenario.
    • Integrated accessibility docs and per-component accessibility guidance into the MCP resources.
    • Component documentation Accessibility sections are now extracted and exposed as per-example accessibility resources.
  • Documentation

    • Updated docs and table-of-contents to describe the new accessibility tool, resource URIs, examples, and copying of accessibility docs into the package.

@DivyaNagaraja1 DivyaNagaraja1 requested a review from a team as a code owner June 10, 2026 20:43
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fd7ed06d-2b79-4869-8cb7-f87babeef559

📥 Commits

Reviewing files that changed from the base of the PR and between 5de651e and fedb905.

📒 Files selected for processing (1)
  • modules/mcp/lib/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • modules/mcp/lib/index.ts

📝 Walkthrough

Walkthrough

Adds a new get-accessibility-guidelines MCP tool, typed accessibility enums and resolution, build-time extraction/copying of accessibility MDX, MCP resource registration for accessibility docs and per-story excerpts, and documentation updates in README and MCPDocs.mdx.

Changes

Accessibility Guidelines Tool

Layer / File(s) Summary
Accessibility taxonomy and scenario resolution
modules/mcp/lib/accessibility-enums.ts
ACCESSIBILITY_SCENARIOS and ACCESSIBILITY_COMPONENTS exported as typed constants; component classification sets and getAccessibilityScenarioSlugsForComponent() and resolveAccessibilityScenarioSlugs() map components and scenarios to deduped scenario slug arrays.
Build configuration and story metadata extraction
modules/mcp/lib/config.json, modules/mcp/build/discover-stories.ts, modules/mcp/build/index.ts
Adds accessibilityFiles to config; extractAccessibilitySection() extracts ## Accessibility sections from MDX; StoryEntry gains accessibilityProse; build copy logic accepts explicit sourceDir and copies accessibility files into dist/lib.
MCP server resources and tool
modules/mcp/lib/index.ts
Registers docs://accessibility/{slug} resources, conditionally registers docs://examples/{slug}/accessibility per story, imports scenario resolver, and implements get-accessibility-guidelines tool that validates inputs, resolves scenario slugs, and returns JSON with resource_link entries.
Documentation
modules/mcp/README.md, modules/mcp/stories/mdx/MCPDocs.mdx
Documents get-accessibility-guidelines usage and response format, adds docs://accessibility/* and docs://examples/{slug}/accessibility resource descriptions, and notes build:copy now includes accessibility docs.

Sequence Diagram

sequenceDiagram
  participant Client
  participant Tool as get-accessibility-guidelines
  participant Resolver as resolveAccessibilityScenarioSlugs
  participant Resources as ResourceRegistry
  participant Disk as DiskLib

  Client->>Tool: {component?, scenario?}
  Tool->>Resolver: (component?, scenario?)
  Resolver-->>Tool: scenario slugs[]
  Tool->>Resources: fetch resources by slug
  Resources->>Disk: read markdown file
  Disk-->>Resources: content (markdown)
  Resources-->>Tool: resource_link entries
  Tool-->>Client: JSON summary + resource links
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A rabbit hops through guidelines fine,
Scenarios and components align,
MDX sections neatly pulled apart,
Resources and tools play their part,
Accessibility blooms — a thoughtful sign. 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly summarizes the main change: adding a new accessibility guidance tool to the MCP server.
Linked Issues check ✅ Passed All objectives from issue #3902 are met: tool returns accessibility resources at docs://accessibility/{slug}, exposes component docs at docs://examples/{slug}/accessibility, and provides guidance-only resources without code scanning or testing.
Out of Scope Changes check ✅ Passed All changes are directly related to the accessibility guidelines tool implementation and its supporting infrastructure; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed due to a network error.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@DivyaNagaraja1 DivyaNagaraja1 marked this pull request as draft June 10, 2026 20:44
@DivyaNagaraja1 DivyaNagaraja1 marked this pull request as ready for review June 10, 2026 20:45

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@modules/mcp/lib/index.ts`:
- Around line 717-734: The inputSchema currently marks component and scenario as
optional but the handler enforces at least one present, causing runtime errors;
update the inputSchema (the object assigned to inputSchema where component and
scenario are defined) to add a .refine() on the parent zod object that checks:
at least one of component or scenario is defined (e.g., refine(data =>
!!data.component || !!data.scenario, { message: 'At least one of "component" or
"scenario" is required.' })), so validation fails early and the runtime check in
the async handler becomes redundant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ebcd5542-aad6-444d-a2ad-fadc5eab1fd9

📥 Commits

Reviewing files that changed from the base of the PR and between 1595b29 and 5de651e.

📒 Files selected for processing (7)
  • modules/mcp/README.md
  • modules/mcp/build/discover-stories.ts
  • modules/mcp/build/index.ts
  • modules/mcp/lib/accessibility-enums.ts
  • modules/mcp/lib/config.json
  • modules/mcp/lib/index.ts
  • modules/mcp/stories/mdx/MCPDocs.mdx

Comment thread modules/mcp/lib/index.ts Outdated
@DivyaNagaraja1 DivyaNagaraja1 changed the base branch from master to prerelease/minor June 11, 2026 20:16
@RayRedGoose RayRedGoose requested a review from Copilot June 12, 2026 18:40

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 encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@cypress

cypress Bot commented Jun 12, 2026

Copy link
Copy Markdown

Workday/canvas-kit    Run #11000

Run Properties:  status check passed Passed #11000  •  git commit a43783a60a ℹ️: Merge fedb9052b3e737ff5a5d27860e2f5c0122f92e83 into 1595b29aabedbd7f9f3e4bc6316b...
Project Workday/canvas-kit
Branch Review adding-get-accessibility-guidelines-mcptool
Run status status check passed Passed #11000
Run duration 02m 24s
Commit git commit a43783a60a ℹ️: Merge fedb9052b3e737ff5a5d27860e2f5c0122f92e83 into 1595b29aabedbd7f9f3e4bc6316b...
Committer DivyaNagaraja1
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 17
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 809
View all changes introduced in this branch ↗︎
UI Coverage  19.62%
  Untested elements 1530  
  Tested elements 371  
Accessibility  99.41%
  Failed rules  5 critical   5 serious   0 moderate   2 minor
  Failed elements 68  

@RayRedGoose RayRedGoose added the on hold PR is on hold until further notice label Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on hold PR is on hold until further notice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add get-accessibility-guidelines tool to our MCP

3 participants