Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 19, 2025

SEP-973: Icons and metadata support implementation

This PR implements SEP-973 which adds support for icons and additional metadata for Implementations, Resources, Tools, and Prompts.

Implementation Plan

  • Review and understand SEP-973 specification requirements
  • Understand current codebase structure and build system
  • Create Icon class with src, mimeType, and sizes properties
  • Add Icons property to Implementation class
  • Add WebsiteUrl property to Implementation class
  • Add Icons property to Resource class
  • Add Icons property to Tool class
  • Add Icons property to Prompt class
  • Create comprehensive tests for Icon validation and serialization
  • Create tests for all updated classes with icon support
  • Fix property accessor consistency across classes
  • Address code review feedback and improve test patterns
  • Validate all changes work with existing codebase (requires .NET 9 SDK)
  • Test building and ensure backward compatibility

Recent Changes (Addressing Code Review Feedback)

  • Removed documentation files: Removed SEP-973-IMPLEMENTATION.md and SEP-973-EXAMPLES.md as they shouldn't be checked in
  • Enhanced test patterns: Updated all test classes to follow existing patterns with round-trip serialization validation
  • Added JsonException tests: Added tests that verify proper exceptions are thrown for invalid JSON payloads
  • Split test files: Separated combined test classes into individual files (ResourceTests.cs, PromptTests.cs)
  • Renamed test classes: Changed ToolIconTests to ToolTests and made tests less icon-centric
  • Improved test coverage: Tests now focus on overall functionality rather than just icon-specific behavior

Key Changes Implemented

1. New Icon Class (Icon.cs)

  • Required: Src property for URI pointing to icon resource
  • Optional: MimeType and Sizes properties
  • Supports HTTP/HTTPS URLs and data URIs
  • Comprehensive security documentation per SEP-973
  • Uses init-only properties for immutability

2. Enhanced Classes with Icon Support

  • Implementation: Added Icons and WebsiteUrl properties
  • Resource: Added Icons property
  • Tool: Added Icons property
  • Prompt: Added Icons property

3. Specification Compliance

✅ Matches TypeScript schema exactly
✅ Correct JSON property names (icons, websiteUrl, src, mimeType, sizes)
✅ All new properties are optional for backward compatibility
✅ Supports multiple icons per entity
✅ Documents required (PNG, JPEG) and recommended (SVG, WebP) MIME types
✅ Includes security considerations for SVG and URI validation

4. Comprehensive Test Coverage

  • IconTests.cs: Icon serialization, round-trip validation, and JsonException tests
  • ImplementationTests.cs: Full Implementation testing with required property validation
  • ToolTests.cs: Tool functionality testing including new icon support
  • ResourceTests.cs: Resource serialization and property validation
  • PromptTests.cs: Prompt functionality testing
  • All tests follow existing repository patterns with round-trip validation
  • Tests validate JsonException behavior for invalid JSON
  • Tests cover all properties, not just icon-specific functionality

Technical Details

  • Uses IList<Icon>? for consistency with existing collection patterns
  • Proper JSON serialization with JsonPropertyName attributes
  • Follows existing codebase conventions and patterns
  • All optional properties use nullable types
  • Test classes follow established naming and structure patterns

Security Features

Implementation includes documentation for:

  • URI validation and trusted domain requirements
  • SVG security precautions (executable JavaScript content)
  • Resource exhaustion protection recommendations
  • MIME type validation guidelines

Note: Build validation requires .NET 9 SDK. The implementation follows established patterns and should compile correctly with the appropriate SDK version.

Fixes #753.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Contributor Author

Copilot AI commented Sep 19, 2025

@MackinnonBuck 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

@Copilot Copilot AI changed the title [WIP] Implement SEP-973: Icons and metadata support Implement SEP-973: Icons and metadata support for Implementations, Resources, Tools, and Prompts Sep 19, 2025
@Copilot Copilot AI requested a review from MackinnonBuck September 19, 2025 21:31
Copilot finished work on behalf of MackinnonBuck September 19, 2025 21:31
@Copilot Copilot AI requested a review from MackinnonBuck September 19, 2025 22:22
Copilot finished work on behalf of MackinnonBuck September 19, 2025 22:22
@MackinnonBuck MackinnonBuck marked this pull request as ready for review September 19, 2025 23:24
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.

Implement SEP-973: Icons and metadata support
2 participants