-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add foundation for resources and prompts registration #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add foundation for resources and prompts registration #45
Conversation
- Add static and dynamic resource registration hooks in capabilities/resources.go - Add prompt registration hook in capabilities/prompts.go - Add new type definitions for prompts, static resources, and dynamic resources - Add resource and prompt subdirectories with initial empty implementations - Update collections interface to support dynamic resource registration - Add comprehensive validation middleware for environment protection - Implement environment validator with caching for production environments - Update tools registration to use refactored structure - Add extensive test coverage for middleware and validation - Add helper utilities for JSON schema generation This refactoring establishes a consistent pattern for registering tools, resources (both static and dynamic), and prompts within the MCP server.
Add TestAllDynamicResourcesRegistered to verify all dynamic resources from individual collections are properly registered with the server. This ensures no collections are accidentally omitted during registration. The test validates: - All dynamic resources from individual collections are present in the registered list - No unexpected resources are registered - Proper collection registration
henryrecker-pingidentity
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple questions and a change to a few comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we expect prompts not to be linked with a given collection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At present, no, so I left this outside of a collection context. The reason being is that prompts are likely to act over a range of tools in different collections.
One thing to consider might be that we have virtual collections (e.g., a "monitoring" collection may invoke read tools from applications, populations and more)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here - will these not be tied to specific collections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left static resources outside of collection context because this these could provide cross-tool (cross-collection) context, like specific documentation or guides. The dynamic resources are in a collection context because they are likely to be invoking an API call
Change Description
This PR establishes a consistent foundation for registering tools, resources (both static and dynamic), and prompts within the MCP server. This refactoring sets up the necessary hooks and structure for future implementation of resources and prompts alongside the existing tools.
Type of Change
Key Changes
Registration Structure
internal/tools/tointernal/capabilities/for better organizationcapabilities/resources.gowithRegisterResources(),RegisterStaticResources(), andRegisterDynamicResources()hookscapabilities/prompts.gowithRegisterPrompts()hookcapabilities/tools.gofor consistencyType Definitions
PromptDefinitionfor future prompt implementationsStaticResourceDefinitionandDynamicResourceDefinitionfor future resource implementationsDynamicResourceValidationPolicyto support validation for dynamic resourcesCollection Interface Updates
CollectionandLegacySdkCollectioninterfaces to includeRegisterDynamicResources()andListDynamicResources()methodsInfrastructure
Initial Implementations
capabilities/prompts/andcapabilities/staticresources/directoriesRelated Issues
N/A - Foundation work for future features
Testing
Test Evidence
Commands Run
make testTest Results Summary
All tests pass successfully:
TestAllDynamicResourcesRegisteredto validate resource registrationKey test packages:
cmd: All command tests pass (logout, run, session)internal/capabilities: Registration and validation tests passinternal/capabilities/applications: All application tool tests passinternal/capabilities/environments: All environment tool tests passinternal/capabilities/populations: All population tool tests passinternal/capabilities/validation: All middleware validation tests passinternal/capabilities/filter: All filtering logic tests passinternal/capabilities/types: Type definition tests passinternal/errs: Error handling tests passinternal/sdk/legacy: SDK factory tests passinternal/server: Server initialization and filtering tests passinternal/tokenstore: Token storage tests passNew test added:
TestAllDynamicResourcesRegisteredvalidates that all dynamic resources from individual collections are properly registered with the serverFull Test Output
Breaking Changes
None - This is an additive change that maintains backward compatibility
Additional Context
This refactoring prepares the codebase for:
The structure follows the existing patterns established for tools registration and maintains consistency across the codebase.