Class McpEndpointRegistry
Registry methods preserve endpoint registration order. Every registry contains at least one endpoint, and no two endpoints may have the same normalized path.
Generated endpoints in a named application module require their endpoint package to be open or exported to Soklet. Packages containing non-public typed record arguments or results must be open to Soklet for runtime conversion.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull McpEndpointRegistryfromClasses(@NonNull Class<?> @NonNull ... endpointClasses) Resolves generated descriptors for endpoint classes in the supplied order.static @NonNull McpEndpointRegistryResolves every generated MCP endpoint descriptor visible through the current thread's context class loader.static @NonNull McpEndpointRegistryfromEndpoints(@NonNull Collection<@NonNull McpEndpoint> endpoints) Creates an immutable registry from endpoints in registration order.The endpoints in deterministic registration order.withEndpoint(@NonNull McpEndpoint endpoint) Returns a registry containing the current endpoints followed by the given endpoint.withSkillGroups(@NonNull Class<?> annotatedEndpointClass, @NonNull List<@NonNull McpSkillGroup> skillGroups) Returns a registry whose generated endpoint for the supplied annotated class carries the given Skills groups.withSkillRegistrations(@NonNull Class<?> annotatedEndpointClass, @NonNull List<@NonNull McpSkillRegistration> skillRegistrations) Returns a registry whose generated endpoint for the supplied annotated class carries the given standalone Skills registrations.withSubscriptionConfig(@NonNull Class<?> annotatedEndpointClass, @NonNull McpSubscriptionConfig subscriptionConfig) Returns a registry whose generated endpoint for the supplied annotated class carries the given subscription-change configuration.
-
Method Details
-
getEndpoints
The endpoints in deterministic registration order.- Returns:
- an immutable endpoint list
-
withEndpoint
Returns a registry containing the current endpoints followed by the given endpoint.- Parameters:
endpoint- the endpoint to append- Returns:
- a new immutable registry
- Throws:
IllegalArgumentException- if the endpoint path is already registered
-
withSubscriptionConfig
public @NonNull McpEndpointRegistry withSubscriptionConfig(@NonNull Class<?> annotatedEndpointClass, @NonNull McpSubscriptionConfig subscriptionConfig) Returns a registry whose generated endpoint for the supplied annotated class carries the given subscription-change configuration.Soklet selects the already-generated endpoint by the exact loaded
Classidentity retained during generated-descriptor discovery. It does not initialize the endpoint class, acquire an endpoint instance, or rediscover handler metadata. Endpoint order and every other endpoint value are preserved.- Parameters:
annotatedEndpointClass- annotated endpoint class whose generated endpoint is selectedsubscriptionConfig- subscription-change configuration- Returns:
- a new immutable registry
- Throws:
IllegalArgumentException- if this registry did not load a generated endpoint for the exact supplied classNullPointerException- if either argument is null
-
withSkillRegistrations
public @NonNull McpEndpointRegistry withSkillRegistrations(@NonNull Class<?> annotatedEndpointClass, @NonNull List<@NonNull McpSkillRegistration> skillRegistrations) Returns a registry whose generated endpoint for the supplied annotated class carries the given standalone Skills registrations.The list is snapshotted and replaces the complete standalone registration list; an empty list clears it. Existing Skills groups remain unchanged. Skills identities, ordinary-resource collisions, and output limits are validated against the copied endpoint before the new registry is returned. A failed replacement leaves this registry unchanged.
Soklet selects the already-generated endpoint by the exact loaded
Classidentity retained during generated-descriptor discovery. It does not initialize the endpoint class, acquire an endpoint instance, or rediscover handler metadata. Endpoint order, generated handlers, and every other endpoint value are preserved.- Parameters:
annotatedEndpointClass- annotated endpoint class whose generated endpoint is selectedskillRegistrations- complete standalone Skills registration list- Returns:
- a new immutable registry
- Throws:
IllegalArgumentException- if this registry did not load a generated endpoint for the exact supplied class, or the resulting Skills output exceeds its limitsIllegalStateException- if Skills identities or files conflict, or an ordinary resource overlaps a Skills fileNullPointerException- if either argument or a list member is null
-
withSkillGroups
public @NonNull McpEndpointRegistry withSkillGroups(@NonNull Class<?> annotatedEndpointClass, @NonNull List<@NonNull McpSkillGroup> skillGroups) Returns a registry whose generated endpoint for the supplied annotated class carries the given Skills groups.The list is snapshotted and replaces the complete group list; an empty list clears it. Existing standalone Skills registrations remain unchanged. Grouping does not select a locale or grant access. Skills identities, ordinary-resource collisions, and output limits are validated against the copied endpoint before the new registry is returned. A failed replacement leaves this registry unchanged.
Soklet selects the already-generated endpoint by the exact loaded
Classidentity retained during generated-descriptor discovery. It does not initialize the endpoint class, acquire an endpoint instance, or rediscover handler metadata. Endpoint order, generated handlers, and every other endpoint value are preserved.- Parameters:
annotatedEndpointClass- annotated endpoint class whose generated endpoint is selectedskillGroups- complete Skills group list- Returns:
- a new immutable registry
- Throws:
IllegalArgumentException- if this registry did not load a generated endpoint for the exact supplied class, or the resulting Skills output exceeds its limitsIllegalStateException- if Skills identities or files conflict, or an ordinary resource overlaps a Skills fileNullPointerException- if either argument or a list member is null
-
fromClasspathIntrospection
Resolves every generated MCP endpoint descriptor visible through the current thread's context class loader.Endpoint classes are not initialized and endpoint instances are not acquired during descriptor discovery. When a generated handler is invoked, it acquires its endpoint instance through the
instance providerconfigured on theSokletConfigthat owns the MCP server. Soklet does not retain or close the returned endpoint instance. Direct invocation of a generated registration handler outside a Soklet-managed request usesInstanceProvider.defaultInstance().- Returns:
- an immutable registry ordered by endpoint binary name
- Throws:
IllegalStateException- if no generated descriptor is found or an index or provider is malformed, conflicting, or cannot be loaded
-
fromClasses
public static @NonNull McpEndpointRegistry fromClasses(@NonNull Class<?> @NonNull ... endpointClasses) Resolves generated descriptors for endpoint classes in the supplied order.Endpoint classes are not initialized and endpoint instances are not acquired during descriptor discovery. When a generated handler is invoked, it acquires its endpoint instance through the
instance providerconfigured on theSokletConfigthat owns the MCP server. Soklet does not retain or close the returned endpoint instance. Direct invocation of a generated registration handler outside a Soklet-managed request usesInstanceProvider.defaultInstance().- Parameters:
endpointClasses- one or more annotated endpoint classes- Returns:
- an immutable registry in the supplied order
- Throws:
IllegalArgumentException- if no classes are supplied, a class is duplicated, or a class has no generated descriptor, or two selected endpoints have the same normalized pathIllegalStateException- if an index or provider is malformed, conflicting, or cannot be loadedNullPointerException- if the array or one of its classes is null
-
fromEndpoints
public static @NonNull McpEndpointRegistry fromEndpoints(@NonNull Collection<@NonNull McpEndpoint> endpoints) Creates an immutable registry from endpoints in registration order.- Parameters:
endpoints- one or more endpoints- Returns:
- an immutable endpoint registry
- Throws:
IllegalArgumentException- if no endpoints are supplied or two endpoints have the same normalized path
-