feat(mcp): Add accessibility guidance tool#3970
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a new ChangesAccessibility Guidelines Tool
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (7)
modules/mcp/README.mdmodules/mcp/build/discover-stories.tsmodules/mcp/build/index.tsmodules/mcp/lib/accessibility-enums.tsmodules/mcp/lib/config.jsonmodules/mcp/lib/index.tsmodules/mcp/stories/mdx/MCPDocs.mdx
…e required constraint
Workday/canvas-kit
|
||||||||||||||||||||||||||||||||||||||||
| Project |
Workday/canvas-kit
|
| Branch Review |
adding-get-accessibility-guidelines-mcptool
|
| Run status |
|
| Run duration | 02m 24s |
| Commit |
|
| Committer | DivyaNagaraja1 |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
17
|
|
|
0
|
|
|
809
|
| View all changes introduced in this branch ↗︎ | |
UI Coverage
19.62%
|
|
|---|---|
|
|
1530
|
|
|
371
|
Accessibility
99.41%
|
|
|---|---|
|
|
5 critical
5 serious
0 moderate
2 minor
|
|
|
68
|
Summary
Resolves: #3902
Adds a Canvas Kit MCP accessibility guidance capability. The new
get-accessibility-guidelinestool returns guidance-only accessibility resources from existing Canvas Kit accessibility docs and component story docs.This PR:
docs://accessibility/{slug}resources from existingmodules/docs/mdx/accessibilitydocumentation.docs://examples/{slug}/accessibility.Release Category
Infrastructure
Release Note
Adds MCP accessibility guidance resources and a
get-accessibility-guidelinestool for AI assistants working with Canvas Kit components.BREAKING CHANGES
Checklist
ready for reviewhas been added to PRFor the Reviewer
Where Should the Reviewer Start?
Start with:
modules/mcp/lib/index.tsThen review:
modules/mcp/lib/accessibility-enums.tsmodules/mcp/build/discover-stories.tsmodules/mcp/lib/config.jsonmodules/mcp/build/index.tsAreas for Feedback? (optional)
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)
Summary by CodeRabbit
New Features
Documentation