This is an automated email from the ASF dual-hosted git repository.
terrymanu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new c6f6603d68f Refine MCP resource URI template API contract (#39003)
c6f6603d68f is described below
commit c6f6603d68fd56189ad8710114c02c6b9116da3c
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Jul 5 14:54:53 2026 +0800
Refine MCP resource URI template API contract (#39003)
---
docs/document/content/dev-manual/mcp.cn.md | 4 ++-
docs/document/content/dev-manual/mcp.en.md | 4 ++-
.../mcp/api/protocol/response/MCPResponse.java | 5 ++++
.../mcp/api/resource/MCPResourceHandler.java | 12 ++++++---
.../resource/descriptor/MCPResourceDescriptor.java | 10 +++++---
.../mcp/api/tool/MCPToolHandler.java | 8 +++---
.../descriptor/MCPResourceDescriptorTest.java | 4 +--
.../resource/MCPResourceSpecificationFactory.java | 10 ++++----
.../MCPResourceSpecificationFactoryTest.java | 28 +++++++++++++++++++-
.../handler/ResourceDefinitionRegistry.java | 14 +++++-----
.../capability/DatabaseCapabilitiesHandler.java | 2 +-
.../handler/capability/RuntimeStatusHandler.java | 2 +-
.../capability/ServerCapabilitiesHandler.java | 2 +-
.../handler/capability/ServerGuidanceHandler.java | 2 +-
.../handler/metadata/MetadataResourceHandler.java | 10 ++++----
.../handler/workflow/WorkflowPlanHandler.java | 2 +-
.../core/handler/core/CoreHandlerProviderTest.java | 2 +-
.../handler/CoreResourceHandlerSurfaceTest.java | 16 ++++++------
.../handler/ResourceDefinitionRegistryTest.java | 8 +++---
.../metadata/MetadataResourceHandlerTest.java | 4 +--
.../handler/BroadcastRuleCountHandler.java | 4 +--
.../resource/handler/BroadcastRulesHandler.java | 4 +--
.../handler/BroadcastTableRuleHandler.java | 4 +--
.../broadcast/BroadcastMCPHandlerProviderTest.java | 2 +-
.../handler/BroadcastRuleCountHandlerTest.java | 2 +-
.../handler/BroadcastRulesHandlerTest.java | 2 +-
.../handler/BroadcastTableRuleHandlerTest.java | 2 +-
.../resource/handler/EncryptAlgorithmsHandler.java | 4 +--
.../resource/handler/EncryptRuleHandler.java | 4 +--
.../resource/handler/EncryptRulesHandler.java | 4 +--
.../encrypt/EncryptMCPHandlerProviderTest.java | 2 +-
.../handler/EncryptAlgorithmsHandlerTest.java | 2 +-
.../resource/handler/EncryptRuleHandlerTest.java | 2 +-
.../resource/handler/EncryptRulesHandlerTest.java | 2 +-
.../resource/handler/MaskAlgorithmsHandler.java | 4 +--
.../mask/resource/handler/MaskRuleHandler.java | 4 +--
.../mask/resource/handler/MaskRulesHandler.java | 4 +--
.../feature/mask/MaskMCPHandlerProviderTest.java | 2 +-
.../handler/MaskAlgorithmsHandlerTest.java | 2 +-
.../mask/resource/handler/MaskRuleHandlerTest.java | 2 +-
.../resource/handler/MaskRulesHandlerTest.java | 2 +-
.../LoadBalanceAlgorithmPluginsHandler.java | 4 +--
.../ReadwriteSplittingRuleCountHandler.java | 4 +--
.../handler/ReadwriteSplittingRuleHandler.java | 4 +--
.../ReadwriteSplittingRuleStatusHandler.java | 4 +--
.../handler/ReadwriteSplittingRulesHandler.java | 4 +--
.../handler/ReadwriteSplittingStatusHandler.java | 4 +--
.../ReadwriteSplittingMCPHandlerProviderTest.java | 2 +-
.../LoadBalanceAlgorithmPluginsHandlerTest.java | 2 +-
.../ReadwriteSplittingRuleCountHandlerTest.java | 2 +-
.../handler/ReadwriteSplittingRuleHandlerTest.java | 2 +-
.../ReadwriteSplittingRuleStatusHandlerTest.java | 2 +-
.../ReadwriteSplittingRulesHandlerTest.java | 2 +-
.../ReadwriteSplittingStatusHandlerTest.java | 2 +-
.../resource/handler/ShadowResourceHandler.java | 4 +--
.../handler/AbstractShardingResourceHandler.java | 4 +--
.../sharding/ShardingMCPHandlerProviderTest.java | 4 +--
.../MCPCompletionTargetDescriptorValidator.java | 4 +--
.../descriptor/MCPDescriptorCatalogIndex.java | 20 +++++++--------
.../MCPDescriptorCatalogPayloadBuilder.java | 4 +--
.../MCPDescriptorCatalogYamlSwapper.java | 14 +++++-----
.../descriptor/MCPResourceDescriptorValidator.java | 30 +++++++++++-----------
.../MCPResourceNavigationDescriptorValidator.java | 2 +-
.../MCPResourceNavigationPayloadBuilder.java | 2 +-
.../MCPToolDescriptorCatalogValidator.java | 4 +--
.../ShardingSphereMCPResourceMetadata.java | 2 +-
.../descriptor/MCPDescriptorCatalogIndexTest.java | 2 +-
.../descriptor/MCPDescriptorCatalogLoaderTest.java | 4 +--
.../MCPProtocolDescriptorCatalogTest.java | 4 +--
.../plugin/PluginFixtureStatusResourceHandler.java | 2 +-
.../PluginFixtureStatusResourceHandlerTest.java | 4 +--
71 files changed, 200 insertions(+), 157 deletions(-)
diff --git a/docs/document/content/dev-manual/mcp.cn.md
b/docs/document/content/dev-manual/mcp.cn.md
index 39fbccc344b..16ae84c2411 100644
--- a/docs/document/content/dev-manual/mcp.cn.md
+++ b/docs/document/content/dev-manual/mcp.cn.md
@@ -67,13 +67,15 @@ MCP 子链路按 `api + support + features + core + bootstrap` 分层组织:
- 实现 `MCPToolHandler<T extends MCPHandlerContext>`。
- 声明 context type。
- 声明 canonical tool name。
+- `handle(...)` 只返回成功的 `MCPResponse`;参数非法、资源不存在、查询失败、超时、不支持等受控失败应抛出
`ShardingSphereMCPException` 子类或明确的运行时异常,由 runtime 转换为 MCP tool 错误结果。
- 在 descriptor 中维护 input schema、output schema、annotations、相关
resources、follow-up tools 和副作用说明。
对外新增 resource:
- 实现 `MCPResourceHandler<T extends MCPHandlerContext>`。
- 声明 context type。
-- 声明 canonical URI template。
+- 声明 canonical resource URI template。固定 URI 也是没有变量的 URI template。
+- `handle(...)` 只返回成功的 `MCPResponse`;失败不要在 handler 中手工构造错误 response,由 runtime
转换为 MCP resource 读取错误。
- 在 descriptor 中维护 URI 参数含义、对象范围、MIME type、title、description、annotations
和关系元数据。
运行时代码需要 descriptor 时,应使用 canonical tool name 或 resource URI template,通过
`MCPDescriptorCatalogIndex` 从 catalog 解析。
diff --git a/docs/document/content/dev-manual/mcp.en.md
b/docs/document/content/dev-manual/mcp.en.md
index 100bd4226a0..99031ea78f6 100644
--- a/docs/document/content/dev-manual/mcp.en.md
+++ b/docs/document/content/dev-manual/mcp.en.md
@@ -67,13 +67,15 @@ When adding a public tool:
- Implement `MCPToolHandler<T extends MCPHandlerContext>`.
- Declare the context type.
- Declare the canonical tool name.
+- `handle(...)` returns only a successful `MCPResponse`. For controlled
failures such as invalid arguments, missing resources, query failure, timeout,
or unsupported operations, throw a `ShardingSphereMCPException` subclass or a
clear runtime exception and let runtime convert it to an MCP tool error result.
- Maintain input schema, output schema, annotations, related resources,
follow-up tools, and side-effect notes in the descriptor.
When adding a public resource:
- Implement `MCPResourceHandler<T extends MCPHandlerContext>`.
- Declare the context type.
-- Declare the canonical URI template.
+- Declare the canonical resource URI template. A fixed URI is also a URI
template without variables.
+- `handle(...)` returns only a successful `MCPResponse`. Do not build error
responses in handlers; runtime converts failures to MCP resource read errors.
- Maintain URI parameter meaning, object scope, MIME type, title, description,
annotations, and relationship metadata in the descriptor.
When runtime code needs the descriptor for a handler, resolve it from
`MCPDescriptorCatalogIndex` by canonical tool name or resource URI template.
diff --git
a/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/protocol/response/MCPResponse.java
b/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/protocol/response/MCPResponse.java
index 12d3f91e0e1..47c0a727d09 100644
---
a/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/protocol/response/MCPResponse.java
+++
b/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/protocol/response/MCPResponse.java
@@ -17,10 +17,15 @@
package org.apache.shardingsphere.mcp.api.protocol.response;
+import
org.apache.shardingsphere.mcp.api.protocol.exception.ShardingSphereMCPException;
+
import java.util.Map;
/**
* MCP response.
+ *
+ * <p>Tool and resource handlers return this type for successful calls.
Controlled failures should be reported by throwing
+ * {@link ShardingSphereMCPException}; runtime converts those failures to the
protocol-specific MCP error surface.</p>
*/
@FunctionalInterface
public interface MCPResponse {
diff --git
a/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/resource/MCPResourceHandler.java
b/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/resource/MCPResourceHandler.java
index 8ddc5714450..fc6416068f0 100644
---
a/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/resource/MCPResourceHandler.java
+++
b/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/resource/MCPResourceHandler.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.mcp.api.resource;
import org.apache.shardingsphere.mcp.api.MCPHandlerContext;
+import
org.apache.shardingsphere.mcp.api.protocol.exception.ShardingSphereMCPException;
import org.apache.shardingsphere.mcp.api.protocol.response.MCPResponse;
/**
@@ -35,18 +36,21 @@ public interface MCPResourceHandler<T extends
MCPHandlerContext> {
Class<T> getContextType();
/**
- * Get resource URI or resource template URI template.
+ * Get canonical resource URI template.
*
- * @return resource URI or resource template URI template
+ * <p>A fixed resource URI is represented as a URI template without
variables.</p>
+ *
+ * @return canonical resource URI template
*/
- String getResourceUriOrTemplate();
+ String getResourceUriTemplate();
/**
* Handle one resource request.
*
* @param handlerContext handler context
* @param uriVariables URI variables
- * @return resource response
+ * @return successful resource response
+ * @throws ShardingSphereMCPException controlled failure to be converted
by runtime
*/
MCPResponse handle(T handlerContext, MCPUriVariables uriVariables);
}
diff --git
a/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/resource/descriptor/MCPResourceDescriptor.java
b/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/resource/descriptor/MCPResourceDescriptor.java
index 23d48225e62..e1d1932ff14 100644
---
a/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/resource/descriptor/MCPResourceDescriptor.java
+++
b/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/resource/descriptor/MCPResourceDescriptor.java
@@ -24,12 +24,14 @@ import java.util.Map;
/**
* MCP resource descriptor.
+ *
+ * <p>The URI template is the canonical resource identifier. A fixed resource
URI is a URI template without variables.</p>
*/
@RequiredArgsConstructor
@Getter
public final class MCPResourceDescriptor {
- private final String uriOrTemplate;
+ private final String uriTemplate;
private final String name;
@@ -44,11 +46,11 @@ public final class MCPResourceDescriptor {
private final Map<String, Object> meta;
/**
- * Judge whether the resource is a URI template.
+ * Judge whether the resource URI template contains variables.
*
- * @return true if the resource is a URI template
+ * @return true if the resource URI template contains variables
*/
public boolean isTemplated() {
- return null != uriOrTemplate && uriOrTemplate.contains("{");
+ return null != uriTemplate && uriTemplate.contains("{");
}
}
diff --git
a/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/tool/MCPToolHandler.java
b/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/tool/MCPToolHandler.java
index c7d4d56aaa5..e3420889440 100644
---
a/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/tool/MCPToolHandler.java
+++
b/mcp/api/src/main/java/org/apache/shardingsphere/mcp/api/tool/MCPToolHandler.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.mcp.api.tool;
import org.apache.shardingsphere.mcp.api.MCPHandlerContext;
+import
org.apache.shardingsphere.mcp.api.protocol.exception.ShardingSphereMCPException;
import org.apache.shardingsphere.mcp.api.protocol.response.MCPResponse;
/**
@@ -35,9 +36,9 @@ public interface MCPToolHandler<T extends MCPHandlerContext> {
Class<T> getContextType();
/**
- * Get tool name.
+ * Get canonical tool name.
*
- * @return tool name
+ * @return canonical tool name
*/
String getToolName();
@@ -46,7 +47,8 @@ public interface MCPToolHandler<T extends MCPHandlerContext> {
*
* @param handlerContext handler context
* @param toolCall tool call
- * @return tool response
+ * @return successful tool response
+ * @throws ShardingSphereMCPException controlled failure to be converted
by runtime
*/
MCPResponse handle(T handlerContext, MCPToolCall toolCall);
}
diff --git
a/mcp/api/src/test/java/org/apache/shardingsphere/mcp/api/resource/descriptor/MCPResourceDescriptorTest.java
b/mcp/api/src/test/java/org/apache/shardingsphere/mcp/api/resource/descriptor/MCPResourceDescriptorTest.java
index 48eb6629175..10bdecedafa 100644
---
a/mcp/api/src/test/java/org/apache/shardingsphere/mcp/api/resource/descriptor/MCPResourceDescriptorTest.java
+++
b/mcp/api/src/test/java/org/apache/shardingsphere/mcp/api/resource/descriptor/MCPResourceDescriptorTest.java
@@ -33,7 +33,7 @@ class MCPResourceDescriptorTest {
void assertGetUriTemplateForFixedResource() {
MCPResourceDescriptor actual = new
MCPResourceDescriptor("shardingsphere://databases", "databases", "Databases",
"List databases.", "application/json",
MCPResourceAnnotations.EMPTY, Collections.emptyMap());
- assertThat(actual.getUriOrTemplate(),
is("shardingsphere://databases"));
+ assertThat(actual.getUriTemplate(), is("shardingsphere://databases"));
assertFalse(actual.isTemplated());
}
@@ -41,7 +41,7 @@ class MCPResourceDescriptorTest {
void assertGetUriTemplateForResourceTemplate() {
MCPResourceDescriptor actual = new
MCPResourceDescriptor("shardingsphere://databases/{database}", "database",
"Database",
"Read one database.", "application/json",
MCPResourceAnnotations.EMPTY, Collections.emptyMap());
- assertThat(actual.getUriOrTemplate(),
is("shardingsphere://databases/{database}"));
+ assertThat(actual.getUriTemplate(),
is("shardingsphere://databases/{database}"));
assertTrue(actual.isTemplated());
}
diff --git
a/mcp/bootstrap/src/main/java/org/apache/shardingsphere/mcp/bootstrap/transport/capability/resource/MCPResourceSpecificationFactory.java
b/mcp/bootstrap/src/main/java/org/apache/shardingsphere/mcp/bootstrap/transport/capability/resource/MCPResourceSpecificationFactory.java
index 2dc39598398..df48392162f 100644
---
a/mcp/bootstrap/src/main/java/org/apache/shardingsphere/mcp/bootstrap/transport/capability/resource/MCPResourceSpecificationFactory.java
+++
b/mcp/bootstrap/src/main/java/org/apache/shardingsphere/mcp/bootstrap/transport/capability/resource/MCPResourceSpecificationFactory.java
@@ -23,14 +23,12 @@ import io.modelcontextprotocol.spec.McpSchema;
import io.modelcontextprotocol.spec.McpSchema.ReadResourceResult;
import io.modelcontextprotocol.spec.McpSchema.TextResourceContents;
import org.apache.shardingsphere.infra.util.json.JsonUtils;
-import
org.apache.shardingsphere.mcp.api.protocol.exception.ShardingSphereMCPException;
import
org.apache.shardingsphere.mcp.api.resource.descriptor.MCPResourceAnnotations;
import
org.apache.shardingsphere.mcp.api.resource.descriptor.MCPResourceDescriptor;
import
org.apache.shardingsphere.mcp.bootstrap.transport.MCPTransportErrorFactory;
import org.apache.shardingsphere.mcp.core.context.MCPRuntimeContext;
import org.apache.shardingsphere.mcp.core.resource.MCPResourceController;
import
org.apache.shardingsphere.mcp.core.resource.handler.ResourceDefinitionRegistry;
-import
org.apache.shardingsphere.mcp.support.database.metadata.jdbc.RuntimeDatabaseConnectionException;
import java.util.Collection;
import java.util.Collections;
@@ -67,7 +65,7 @@ public final class MCPResourceSpecificationFactory {
private McpSchema.Resource createResource(final MCPResourceDescriptor
descriptor) {
McpSchema.Resource.Builder result = McpSchema.Resource.builder()
- .uri(descriptor.getUriOrTemplate())
+ .uri(descriptor.getUriTemplate())
.name(descriptor.getName())
.title(descriptor.getTitle())
.description(descriptor.getDescription())
@@ -94,7 +92,7 @@ public final class MCPResourceSpecificationFactory {
private McpSchema.ResourceTemplate createResourceTemplate(final
MCPResourceDescriptor descriptor) {
McpSchema.ResourceTemplate.Builder result =
McpSchema.ResourceTemplate.builder()
- .uriTemplate(descriptor.getUriOrTemplate())
+ .uriTemplate(descriptor.getUriTemplate())
.name(descriptor.getName())
.title(descriptor.getTitle())
.description(descriptor.getDescription())
@@ -117,7 +115,9 @@ public final class MCPResourceSpecificationFactory {
try {
Map<String, Object> payload =
controller.handle(request.uri()).toPayload();
return new ReadResourceResult(Collections.singletonList(new
TextResourceContents(request.uri(), JSON_CONTENT_TYPE,
JsonUtils.toJsonString(payload))));
- } catch (final ShardingSphereMCPException |
RuntimeDatabaseConnectionException | IllegalArgumentException |
IllegalStateException | UnsupportedOperationException ex) {
+ // CHECKSTYLE:OFF
+ } catch (final Exception ex) {
+ // CHECKSTYLE:ON
throw MCPTransportErrorFactory.createError(ex);
}
}
diff --git
a/mcp/bootstrap/src/test/java/org/apache/shardingsphere/mcp/bootstrap/transport/capability/resource/MCPResourceSpecificationFactoryTest.java
b/mcp/bootstrap/src/test/java/org/apache/shardingsphere/mcp/bootstrap/transport/capability/resource/MCPResourceSpecificationFactoryTest.java
index 014b7c37700..96a79d93d2d 100644
---
a/mcp/bootstrap/src/test/java/org/apache/shardingsphere/mcp/bootstrap/transport/capability/resource/MCPResourceSpecificationFactoryTest.java
+++
b/mcp/bootstrap/src/test/java/org/apache/shardingsphere/mcp/bootstrap/transport/capability/resource/MCPResourceSpecificationFactoryTest.java
@@ -25,22 +25,32 @@ import io.modelcontextprotocol.spec.McpSchema;
import io.modelcontextprotocol.spec.McpSchema.ReadResourceRequest;
import io.modelcontextprotocol.spec.McpSchema.ReadResourceResult;
import io.modelcontextprotocol.spec.McpSchema.TextResourceContents;
+import
org.apache.shardingsphere.mcp.api.resource.descriptor.MCPResourceAnnotations;
+import
org.apache.shardingsphere.mcp.api.resource.descriptor.MCPResourceDescriptor;
+import org.apache.shardingsphere.mcp.core.context.MCPRequestScope;
import org.apache.shardingsphere.mcp.core.context.MCPRuntimeContext;
+import
org.apache.shardingsphere.mcp.core.resource.handler.ResourceDefinitionRegistry;
import
org.apache.shardingsphere.mcp.support.descriptor.MCPShardingSphereMetadataKeys;
import org.junit.jupiter.api.Test;
+import org.mockito.MockedStatic;
import java.util.Collection;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isA;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.when;
class MCPResourceSpecificationFactoryTest {
@@ -51,7 +61,7 @@ class MCPResourceSpecificationFactoryTest {
SyncResourceSpecification actualSpecification =
findResourceSpecification(actual, "shardingsphere://capabilities");
assertThat(actualSpecification.resource().name(),
is("server-capability-catalog"));
assertThat(actualSpecification.resource().title(), is("ShardingSphere
MCP Capability Catalog"));
- assertTrue(!actualSpecification.resource().description().isBlank());
+ assertFalse(actualSpecification.resource().description().isBlank());
assertThat(actualSpecification.resource().mimeType(),
is("application/json"));
assertThat(actualSpecification.resource().meta().get(MCPShardingSphereMetadataKeys.RESOURCE_KIND),
is("capability-catalog"));
assertNotNull(actualSpecification.readHandler());
@@ -90,6 +100,22 @@ class MCPResourceSpecificationFactoryTest {
assertThat(actualData.get("message"), is("Unsupported resource URI
`shardingsphere://unknown`."));
}
+ @Test
+ void assertReadResourceConvertsRuntimeFailure() {
+ MCPResourceDescriptor descriptor = new
MCPResourceDescriptor("shardingsphere://runtime-error", "runtime-error",
"Runtime Error", "Read runtime error.", "application/json",
+ MCPResourceAnnotations.EMPTY, Map.of());
+ try (MockedStatic<ResourceDefinitionRegistry> mocked =
mockStatic(ResourceDefinitionRegistry.class)) {
+
mocked.when(ResourceDefinitionRegistry::getSupportedResourceDescriptors).thenReturn(List.of(descriptor));
+ mocked.when(() ->
ResourceDefinitionRegistry.dispatch(any(MCPRequestScope.class),
eq("shardingsphere://runtime-error"))).thenThrow(new RuntimeException("runtime
failure"));
+ SyncResourceSpecification actualSpecification =
findResourceSpecification(
+ new
MCPResourceSpecificationFactory(createRuntimeContext()).createResourceSpecifications(),
"shardingsphere://runtime-error");
+ McpError actual = assertThrows(McpError.class,
+ () ->
actualSpecification.readHandler().apply(mock(McpSyncServerExchange.class), new
ReadResourceRequest("shardingsphere://runtime-error")));
+ assertThat(actual.getJsonRpcError().code(),
is(McpSchema.ErrorCodes.INTERNAL_ERROR));
+ assertThat(actual.getJsonRpcError().message(), is("runtime
failure"));
+ }
+ }
+
@Test
void assertCreateResourceTemplateSpecifications() {
Collection<SyncResourceTemplateSpecification> actual = new
MCPResourceSpecificationFactory(mock(MCPRuntimeContext.class)).createResourceTemplateSpecifications();
diff --git
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/ResourceDefinitionRegistry.java
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/ResourceDefinitionRegistry.java
index d5cf99b252a..8e74886afeb 100644
---
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/ResourceDefinitionRegistry.java
+++
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/ResourceDefinitionRegistry.java
@@ -61,11 +61,11 @@ public final class ResourceDefinitionRegistry {
ShardingSpherePreconditions.checkNotEmpty(handlers, () -> new
IllegalStateException("No resource handlers are registered."));
Map<MCPUriPattern, MCPResourceHandler<?>> result = new
LinkedHashMap<>(handlers.size(), 1F);
for (MCPResourceHandler<?> each : handlers) {
- String uriOrTemplate = each.getResourceUriOrTemplate();
- ShardingSpherePreconditions.checkState(null != uriOrTemplate &&
!uriOrTemplate.isBlank(),
- () -> new IllegalArgumentException(String.format("Resource
URI or URI template is required for `%s`.", each.getClass().getName())));
+ String uriTemplate = each.getResourceUriTemplate();
+ ShardingSpherePreconditions.checkState(null != uriTemplate &&
!uriTemplate.isBlank(),
+ () -> new IllegalArgumentException(String.format("Resource
URI template is required for `%s`.", each.getClass().getName())));
MCPHandlerContexts.validateContextType(each.getContextType(),
each.getClass());
- result.put(new MCPUriPattern(uriOrTemplate), each);
+ result.put(new MCPUriPattern(uriTemplate), each);
}
return result;
}
@@ -96,19 +96,19 @@ public final class ResourceDefinitionRegistry {
}
private static MCPResourceDefinition createResourceDefinition(final
MCPUriPattern uriPattern, final MCPResourceHandler<?> handler) {
- return new MCPResourceDefinition(uriPattern,
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(handler.getResourceUriOrTemplate()),
handler);
+ return new MCPResourceDefinition(uriPattern,
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(handler.getResourceUriTemplate()),
handler);
}
private static void validateRegisteredResourceDescriptors() {
for (MCPResourceDescriptor each :
MCPDescriptorCatalogIndex.getResourceDescriptors()) {
ShardingSpherePreconditions.checkState(isRegisteredResourceDescriptor(each),
- () -> new IllegalStateException(String.format("MCP
resource descriptor `%s` has no registered handler.",
each.getUriOrTemplate())));
+ () -> new IllegalStateException(String.format("MCP
resource descriptor `%s` has no registered handler.", each.getUriTemplate())));
}
}
private static boolean isRegisteredResourceDescriptor(final
MCPResourceDescriptor descriptor) {
for (MCPResourceDefinition each : REGISTERED_RESOURCE_DEFINITIONS) {
- if
(descriptor.getUriOrTemplate().equals(each.getUriPattern().getPattern())) {
+ if
(descriptor.getUriTemplate().equals(each.getUriPattern().getPattern())) {
return true;
}
}
diff --git
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/DatabaseCapabilitiesHandler.java
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/DatabaseCapabilitiesHandler.java
index 90490e100ad..c4e92aac8d6 100644
---
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/DatabaseCapabilitiesHandler.java
+++
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/DatabaseCapabilitiesHandler.java
@@ -37,7 +37,7 @@ public final class DatabaseCapabilitiesHandler implements
MCPResourceHandler<MCP
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return URI_PATTERN;
}
diff --git
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/RuntimeStatusHandler.java
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/RuntimeStatusHandler.java
index 935051841f7..6abfca627c9 100644
---
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/RuntimeStatusHandler.java
+++
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/RuntimeStatusHandler.java
@@ -50,7 +50,7 @@ public final class RuntimeStatusHandler implements
MCPResourceHandler<MCPDatabas
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return URI_PATTERN;
}
diff --git
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/ServerCapabilitiesHandler.java
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/ServerCapabilitiesHandler.java
index 1cbde06ab6f..b87fc16c79b 100644
---
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/ServerCapabilitiesHandler.java
+++
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/ServerCapabilitiesHandler.java
@@ -42,7 +42,7 @@ public final class ServerCapabilitiesHandler implements
MCPResourceHandler<MCPSe
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return URI_PATTERN;
}
diff --git
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/ServerGuidanceHandler.java
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/ServerGuidanceHandler.java
index 426b64f3cde..2ea188792ad 100644
---
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/ServerGuidanceHandler.java
+++
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/capability/ServerGuidanceHandler.java
@@ -37,7 +37,7 @@ public final class ServerGuidanceHandler implements
MCPResourceHandler<MCPServic
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return URI_PATTERN;
}
diff --git
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/metadata/MetadataResourceHandler.java
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/metadata/MetadataResourceHandler.java
index 5a1d8840bbe..05db85dacbb 100644
---
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/metadata/MetadataResourceHandler.java
+++
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/metadata/MetadataResourceHandler.java
@@ -60,7 +60,7 @@ public final class MetadataResourceHandler implements
MCPResourceHandler<MCPData
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return uriTemplate;
}
@@ -68,7 +68,7 @@ public final class MetadataResourceHandler implements
MCPResourceHandler<MCPData
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
List<?> items = metadataLoader.apply(databaseContext, uriVariables);
MCPResourceDescriptor descriptor =
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(uriTemplate);
- ShardingSphereMCPResourceMetadata metadata =
MCPDescriptorCatalogIndex.getRequiredShardingSphereResourceMetadata(descriptor.getUriOrTemplate());
+ ShardingSphereMCPResourceMetadata metadata =
MCPDescriptorCatalogIndex.getRequiredShardingSphereResourceMetadata(descriptor.getUriTemplate());
Map<String, Object> navigationPayload =
createNavigationPayload(descriptor, uriVariables);
if (isDetailResource(metadata)) {
if (items.isEmpty()) {
@@ -271,15 +271,15 @@ public final class MetadataResourceHandler implements
MCPResourceHandler<MCPData
private Map<String, Object> createNavigationPayload(final
MCPResourceDescriptor descriptor, final MCPUriVariables uriVariables) {
Map<String, Object> result = new LinkedHashMap<>(3, 1F);
- String uriOrTemplate = descriptor.getUriOrTemplate();
- Optional<String> selfUri = new
MCPUriTemplate(uriOrTemplate).expandIfComplete(uriVariables);
+ String uriTemplate = descriptor.getUriTemplate();
+ Optional<String> selfUri = new
MCPUriTemplate(uriTemplate).expandIfComplete(uriVariables);
selfUri.ifPresent(optional -> result.put("self_uri", optional));
String parentUri = createParentUri(selfUri.orElse(""));
if (!parentUri.isEmpty()) {
result.put(MCPPayloadFieldNames.PARENT_RESOURCE,
MCPResourceHintUtils.create(parentUri, resolveResourceKind(parentUri),
"inspect_parent",
"Read the parent metadata resource before broadening or
correcting the request.", MCPPayloadFieldNames.PARENT_RESOURCE));
}
- List<Map<String, Object>> nextResources =
MCPDescriptorCatalogIndex.getResourceNavigationDescriptors(uriOrTemplate).stream()
+ List<Map<String, Object>> nextResources =
MCPDescriptorCatalogIndex.getResourceNavigationDescriptors(uriTemplate).stream()
.filter(each -> each.getTo().startsWith("shardingsphere://"))
.map(each -> createNextResourceHint(each.getTo(),
each.getDescription(), uriVariables)).flatMap(Optional::stream).toList();
if (!nextResources.isEmpty()) {
diff --git
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/workflow/WorkflowPlanHandler.java
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/workflow/WorkflowPlanHandler.java
index 15b5354fae3..45bebdd3915 100644
---
a/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/workflow/WorkflowPlanHandler.java
+++
b/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/resource/handler/workflow/WorkflowPlanHandler.java
@@ -39,7 +39,7 @@ public final class WorkflowPlanHandler implements
MCPResourceHandler<MCPWorkflow
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return URI_PATTERN;
}
diff --git
a/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/handler/core/CoreHandlerProviderTest.java
b/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/handler/core/CoreHandlerProviderTest.java
index a6c2b444ce7..f2657a987a7 100644
---
a/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/handler/core/CoreHandlerProviderTest.java
+++
b/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/handler/core/CoreHandlerProviderTest.java
@@ -42,7 +42,7 @@ class CoreHandlerProviderTest {
void assertGetResourceHandlers() {
Collection<MCPResourceHandler<?>> actual = new
CoreHandlerProvider().getResourceHandlers();
assertThat(actual.size(), is(27));
- List<String> actualUris =
actual.stream().map(MCPResourceHandler::getResourceUriOrTemplate).toList();
+ List<String> actualUris =
actual.stream().map(MCPResourceHandler::getResourceUriTemplate).toList();
assertTrue(actualUris.contains("shardingsphere://capabilities"));
assertTrue(actualUris.contains("shardingsphere://guidance"));
assertTrue(actualUris.contains("shardingsphere://runtime"));
diff --git
a/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/CoreResourceHandlerSurfaceTest.java
b/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/CoreResourceHandlerSurfaceTest.java
index 7d2996c8510..412ab851400 100644
---
a/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/CoreResourceHandlerSurfaceTest.java
+++
b/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/CoreResourceHandlerSurfaceTest.java
@@ -68,8 +68,8 @@ class CoreResourceHandlerSurfaceTest {
@ParameterizedTest(name = "{0}")
@MethodSource("handlerCases")
void assertGetResourceDescriptor(final HandlerCase handlerCase) {
- MCPResourceDescriptor actual =
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(handlerCase.getHandler().getResourceUriOrTemplate());
- assertThat(actual.getUriOrTemplate(),
is(handlerCase.getExpectedUriOrTemplate()));
+ MCPResourceDescriptor actual =
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(handlerCase.getHandler().getResourceUriTemplate());
+ assertThat(actual.getUriTemplate(),
is(handlerCase.getExpectedUriTemplate()));
assertFalse(actual.getDescription().isBlank());
}
@@ -77,7 +77,7 @@ class CoreResourceHandlerSurfaceTest {
@MethodSource("handlerCases")
void assertHandle(final HandlerCase handlerCase) {
try (MCPRequestScope requestContext = new
MCPRequestScope(runtimeContext)) {
- MCPResponse actual = handle(handlerCase.getHandler(),
requestContext, parseUriVariables(handlerCase.getExpectedUriOrTemplate(),
handlerCase.getResourceUri()));
+ MCPResponse actual = handle(handlerCase.getHandler(),
requestContext, parseUriVariables(handlerCase.getExpectedUriTemplate(),
handlerCase.getResourceUri()));
Map<String, Object> actualPayload = actual.toPayload();
if (HandlerResultType.DATABASE_CAPABILITY ==
handlerCase.getExpectedType()) {
assertThat(actual, isA(MCPDatabaseCapabilityResponse.class));
@@ -148,8 +148,8 @@ class CoreResourceHandlerSurfaceTest {
}
}
- private MCPUriVariables parseUriVariables(final String uriOrTemplate,
final String resourceUri) {
- return new
MCPUriPattern(uriOrTemplate).parse(resourceUri).orElseThrow();
+ private MCPUriVariables parseUriVariables(final String uriTemplate, final
String resourceUri) {
+ return new MCPUriPattern(uriTemplate).parse(resourceUri).orElseThrow();
}
private <T extends MCPHandlerContext> MCPResponse handle(final
MCPResourceHandler<T> handler, final MCPRequestScope requestContext, final
MCPUriVariables uriVariables) {
@@ -394,7 +394,7 @@ class CoreResourceHandlerSurfaceTest {
private final MCPResourceHandler<?> handler;
- private final String expectedUriOrTemplate;
+ private final String expectedUriTemplate;
private final String resourceUri;
@@ -408,8 +408,8 @@ class CoreResourceHandlerSurfaceTest {
return handler;
}
- private String getExpectedUriOrTemplate() {
- return expectedUriOrTemplate;
+ private String getExpectedUriTemplate() {
+ return expectedUriTemplate;
}
private String getResourceUri() {
diff --git
a/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/ResourceDefinitionRegistryTest.java
b/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/ResourceDefinitionRegistryTest.java
index 588fee9d937..56857213e2c 100644
---
a/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/ResourceDefinitionRegistryTest.java
+++
b/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/ResourceDefinitionRegistryTest.java
@@ -117,7 +117,7 @@ class ResourceDefinitionRegistryTest {
@Test
void assertGetSupportedResourceDescriptors() {
- Collection<String> actual =
ResourceDefinitionRegistry.getSupportedResourceDescriptors().stream().map(MCPResourceDescriptor::getUriOrTemplate).toList();
+ Collection<String> actual =
ResourceDefinitionRegistry.getSupportedResourceDescriptors().stream().map(MCPResourceDescriptor::getUriTemplate).toList();
assertThat(actual,
is(ResourceDefinitionRegistry.getSupportedResources()));
}
@@ -150,14 +150,14 @@ class ResourceDefinitionRegistryTest {
private static MCPResourceHandler<?> createResourceHandler(final String
uriTemplate) {
MCPResourceHandler<MCPServiceHandlerContext> result =
mock(MCPResourceHandler.class);
when(result.getContextType()).thenReturn(MCPServiceHandlerContext.class);
- when(result.getResourceUriOrTemplate()).thenReturn(uriTemplate);
+ when(result.getResourceUriTemplate()).thenReturn(uriTemplate);
return result;
}
private static MCPResourceHandler<?> createUnsupportedResourceHandler() {
MCPResourceHandler<MCPHandlerContext> result =
mock(MCPResourceHandler.class);
when(result.getContextType()).thenReturn(MCPHandlerContext.class);
-
when(result.getResourceUriOrTemplate()).thenReturn("shardingsphere://unsupported");
+
when(result.getResourceUriTemplate()).thenReturn("shardingsphere://unsupported");
return result;
}
@@ -204,7 +204,7 @@ class ResourceDefinitionRegistryTest {
private static String getRequiredUriMessage() {
MCPResourceHandler<?> handler = createResourceHandler(null);
- return String.format("Resource URI or URI template is required for
`%s`.", handler.getClass().getName());
+ return String.format("Resource URI template is required for `%s`.",
handler.getClass().getName());
}
private static String getDuplicateUriTemplateMessage() {
diff --git
a/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/metadata/MetadataResourceHandlerTest.java
b/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/metadata/MetadataResourceHandlerTest.java
index f680bd56374..78c12abaa59 100644
---
a/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/metadata/MetadataResourceHandlerTest.java
+++
b/mcp/core/src/test/java/org/apache/shardingsphere/mcp/core/resource/handler/metadata/MetadataResourceHandlerTest.java
@@ -43,8 +43,8 @@ class MetadataResourceHandlerTest {
@Test
void assertGetResourceDescriptor() {
MetadataResourceHandler handler = new
MetadataResourceHandler("shardingsphere://databases", (requestContext,
uriVariables) -> List.of());
- MCPResourceDescriptor actual =
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(handler.getResourceUriOrTemplate());
- assertThat(actual.getUriOrTemplate(),
is("shardingsphere://databases"));
+ MCPResourceDescriptor actual =
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(handler.getResourceUriTemplate());
+ assertThat(actual.getUriTemplate(), is("shardingsphere://databases"));
assertThat(actual.getTitle(), is("Logical Databases"));
}
diff --git
a/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRuleCountHandler.java
b/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRuleCountHandler.java
index ba351ae05f6..7803cc071a2 100644
---
a/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRuleCountHandler.java
+++
b/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRuleCountHandler.java
@@ -48,7 +48,7 @@ public final class BroadcastRuleCountHandler implements
MCPResourceHandler<MCPDa
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return BroadcastFeatureDefinition.RULE_COUNT_RESOURCE_URI;
}
@@ -56,6 +56,6 @@ public final class BroadcastRuleCountHandler implements
MCPResourceHandler<MCPDa
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(ruleInspectionService.queryBroadcastRuleCount(databaseContext.getQueryFacade(),
uriVariables.getValue("database")),
MCPResourceNavigationPayloadBuilder.create(
-
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables, BroadcastFeatureDefinition.RULES_RESOURCE_URI));
+
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables, BroadcastFeatureDefinition.RULES_RESOURCE_URI));
}
}
diff --git
a/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRulesHandler.java
b/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRulesHandler.java
index a156f93ea9e..dacac37d67b 100644
---
a/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRulesHandler.java
+++
b/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRulesHandler.java
@@ -48,13 +48,13 @@ public final class BroadcastRulesHandler implements
MCPResourceHandler<MCPDataba
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return BroadcastFeatureDefinition.RULES_RESOURCE_URI;
}
@Override
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(ruleInspectionService.queryBroadcastRules(databaseContext.getQueryFacade(),
uriVariables.getValue("database")),
-
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables));
+
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables));
}
}
diff --git
a/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastTableRuleHandler.java
b/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastTableRuleHandler.java
index e0a92102e59..6792ffe8803 100644
---
a/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastTableRuleHandler.java
+++
b/mcp/features/broadcast/src/main/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastTableRuleHandler.java
@@ -53,7 +53,7 @@ public final class BroadcastTableRuleHandler implements
MCPResourceHandler<MCPDa
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return BroadcastFeatureDefinition.TABLE_RULE_RESOURCE_URI;
}
@@ -65,6 +65,6 @@ public final class BroadcastTableRuleHandler implements
MCPResourceHandler<MCPDa
List<Map<String, Object>> items =
ruleInspectionService.queryBroadcastRules(databaseContext.getQueryFacade(),
database).stream()
.filter(each ->
WorkflowSQLUtils.isSameIdentifier(databaseType, table,
WorkflowRuleValueUtils.getRuleValue(each, "broadcast_table"))).toList();
return new MCPItemsResponse(items,
MCPResourceNavigationPayloadBuilder.create(
-
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables, BroadcastFeatureDefinition.RULES_RESOURCE_URI));
+
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables, BroadcastFeatureDefinition.RULES_RESOURCE_URI));
}
}
diff --git
a/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/BroadcastMCPHandlerProviderTest.java
b/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/BroadcastMCPHandlerProviderTest.java
index 8057fe7338a..b2065f74b6a 100644
---
a/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/BroadcastMCPHandlerProviderTest.java
+++
b/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/BroadcastMCPHandlerProviderTest.java
@@ -38,7 +38,7 @@ class BroadcastMCPHandlerProviderTest {
@Test
void assertGetResourceHandlers() {
Collection<MCPResourceHandler<?>> actual = new
BroadcastMCPHandlerProvider().getResourceHandlers();
-
assertThat(actual.stream().map(MCPResourceHandler::getResourceUriOrTemplate).toList(),
is(List.of(
+
assertThat(actual.stream().map(MCPResourceHandler::getResourceUriTemplate).toList(),
is(List.of(
BroadcastFeatureDefinition.RULES_RESOURCE_URI,
BroadcastFeatureDefinition.TABLE_RULE_RESOURCE_URI,
BroadcastFeatureDefinition.RULE_COUNT_RESOURCE_URI)));
diff --git
a/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRuleCountHandlerTest.java
b/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRuleCountHandlerTest.java
index 066755ddbb9..18338c19f6e 100644
---
a/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRuleCountHandlerTest.java
+++
b/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRuleCountHandlerTest.java
@@ -44,7 +44,7 @@ class BroadcastRuleCountHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new BroadcastRuleCountHandler().getResourceUriOrTemplate(),
is(BroadcastFeatureDefinition.RULE_COUNT_RESOURCE_URI));
+ assertThat(new BroadcastRuleCountHandler().getResourceUriTemplate(),
is(BroadcastFeatureDefinition.RULE_COUNT_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRulesHandlerTest.java
b/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRulesHandlerTest.java
index 3786be14ce8..15d4b4aaaa9 100644
---
a/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRulesHandlerTest.java
+++
b/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastRulesHandlerTest.java
@@ -44,7 +44,7 @@ class BroadcastRulesHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new BroadcastRulesHandler().getResourceUriOrTemplate(),
is(BroadcastFeatureDefinition.RULES_RESOURCE_URI));
+ assertThat(new BroadcastRulesHandler().getResourceUriTemplate(),
is(BroadcastFeatureDefinition.RULES_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastTableRuleHandlerTest.java
b/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastTableRuleHandlerTest.java
index 3247c962930..38d53254e60 100644
---
a/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastTableRuleHandlerTest.java
+++
b/mcp/features/broadcast/src/test/java/org/apache/shardingsphere/mcp/feature/broadcast/resource/handler/BroadcastTableRuleHandlerTest.java
@@ -43,7 +43,7 @@ class BroadcastTableRuleHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new BroadcastTableRuleHandler().getResourceUriOrTemplate(),
is(BroadcastFeatureDefinition.TABLE_RULE_RESOURCE_URI));
+ assertThat(new BroadcastTableRuleHandler().getResourceUriTemplate(),
is(BroadcastFeatureDefinition.TABLE_RULE_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptAlgorithmsHandler.java
b/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptAlgorithmsHandler.java
index de69d56de52..02c32a937f7 100644
---
a/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptAlgorithmsHandler.java
+++
b/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptAlgorithmsHandler.java
@@ -40,13 +40,13 @@ public final class EncryptAlgorithmsHandler implements
MCPResourceHandler<MCPDat
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return EncryptFeatureDefinition.ALGORITHMS_RESOURCE_URI;
}
@Override
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(ruleInspectionService.queryEncryptAlgorithms(databaseContext.getQueryFacade()),
-
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables));
+
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables));
}
}
diff --git
a/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRuleHandler.java
b/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRuleHandler.java
index c2f15483d95..0a2b9f3ec0b 100644
---
a/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRuleHandler.java
+++
b/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRuleHandler.java
@@ -40,7 +40,7 @@ public final class EncryptRuleHandler implements
MCPResourceHandler<MCPDatabaseH
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return EncryptFeatureDefinition.RULE_RESOURCE_URI;
}
@@ -48,6 +48,6 @@ public final class EncryptRuleHandler implements
MCPResourceHandler<MCPDatabaseH
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(ruleInspectionService.queryEncryptRules(databaseContext.getQueryFacade(),
uriVariables.getValue("database"), uriVariables.getValue("table")),
MCPResourceNavigationPayloadBuilder.create(
-
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables, EncryptFeatureDefinition.RULES_RESOURCE_URI));
+
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables, EncryptFeatureDefinition.RULES_RESOURCE_URI));
}
}
diff --git
a/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRulesHandler.java
b/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRulesHandler.java
index dfc5c88611a..b332f50a6de 100644
---
a/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRulesHandler.java
+++
b/mcp/features/encrypt/src/main/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRulesHandler.java
@@ -40,13 +40,13 @@ public final class EncryptRulesHandler implements
MCPResourceHandler<MCPDatabase
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return EncryptFeatureDefinition.RULES_RESOURCE_URI;
}
@Override
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(ruleInspectionService.queryEncryptRules(databaseContext.getQueryFacade(),
uriVariables.getValue("database")),
-
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables));
+
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables));
}
}
diff --git
a/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/EncryptMCPHandlerProviderTest.java
b/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/EncryptMCPHandlerProviderTest.java
index 7287e8d052f..bb60d480f44 100644
---
a/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/EncryptMCPHandlerProviderTest.java
+++
b/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/EncryptMCPHandlerProviderTest.java
@@ -38,7 +38,7 @@ class EncryptMCPHandlerProviderTest {
@Test
void assertGetResourceHandlers() {
Collection<MCPResourceHandler<?>> actual = new
EncryptMCPHandlerProvider().getResourceHandlers();
-
assertThat(actual.stream().map(MCPResourceHandler::getResourceUriOrTemplate).toList(),
is(List.of(
+
assertThat(actual.stream().map(MCPResourceHandler::getResourceUriTemplate).toList(),
is(List.of(
"shardingsphere://features/encrypt/algorithms",
"shardingsphere://features/encrypt/databases/{database}/rules",
"shardingsphere://features/encrypt/databases/{database}/tables/{table}/rules")));
diff --git
a/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptAlgorithmsHandlerTest.java
b/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptAlgorithmsHandlerTest.java
index 777b110fd96..612d7730102 100644
---
a/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptAlgorithmsHandlerTest.java
+++
b/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptAlgorithmsHandlerTest.java
@@ -45,7 +45,7 @@ class EncryptAlgorithmsHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new EncryptAlgorithmsHandler().getResourceUriOrTemplate(),
is(EncryptFeatureDefinition.ALGORITHMS_RESOURCE_URI));
+ assertThat(new EncryptAlgorithmsHandler().getResourceUriTemplate(),
is(EncryptFeatureDefinition.ALGORITHMS_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRuleHandlerTest.java
b/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRuleHandlerTest.java
index 26c204509d1..d8c92b24be4 100644
---
a/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRuleHandlerTest.java
+++
b/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRuleHandlerTest.java
@@ -45,7 +45,7 @@ class EncryptRuleHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new EncryptRuleHandler().getResourceUriOrTemplate(),
is(EncryptFeatureDefinition.RULE_RESOURCE_URI));
+ assertThat(new EncryptRuleHandler().getResourceUriTemplate(),
is(EncryptFeatureDefinition.RULE_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRulesHandlerTest.java
b/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRulesHandlerTest.java
index 322de83a64b..86199f66e34 100644
---
a/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRulesHandlerTest.java
+++
b/mcp/features/encrypt/src/test/java/org/apache/shardingsphere/mcp/feature/encrypt/resource/handler/EncryptRulesHandlerTest.java
@@ -45,7 +45,7 @@ class EncryptRulesHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new EncryptRulesHandler().getResourceUriOrTemplate(),
is(EncryptFeatureDefinition.RULES_RESOURCE_URI));
+ assertThat(new EncryptRulesHandler().getResourceUriTemplate(),
is(EncryptFeatureDefinition.RULES_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskAlgorithmsHandler.java
b/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskAlgorithmsHandler.java
index 39a8ed1981c..d60ed9d1fbc 100644
---
a/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskAlgorithmsHandler.java
+++
b/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskAlgorithmsHandler.java
@@ -40,13 +40,13 @@ public final class MaskAlgorithmsHandler implements
MCPResourceHandler<MCPDataba
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return MaskFeatureDefinition.ALGORITHMS_RESOURCE_URI;
}
@Override
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(ruleInspectionService.queryMaskAlgorithms(databaseContext.getQueryFacade()),
-
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables));
+
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables));
}
}
diff --git
a/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRuleHandler.java
b/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRuleHandler.java
index 1fb29bb6e40..4fda6f183e0 100644
---
a/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRuleHandler.java
+++
b/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRuleHandler.java
@@ -40,7 +40,7 @@ public final class MaskRuleHandler implements
MCPResourceHandler<MCPDatabaseHand
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return MaskFeatureDefinition.RULE_RESOURCE_URI;
}
@@ -48,6 +48,6 @@ public final class MaskRuleHandler implements
MCPResourceHandler<MCPDatabaseHand
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(ruleInspectionService.queryMaskRules(databaseContext.getQueryFacade(),
uriVariables.getValue("database"), uriVariables.getValue("table")),
MCPResourceNavigationPayloadBuilder.create(
-
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables, MaskFeatureDefinition.RULES_RESOURCE_URI));
+
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables, MaskFeatureDefinition.RULES_RESOURCE_URI));
}
}
diff --git
a/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRulesHandler.java
b/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRulesHandler.java
index 56941305a0a..8485bf42a8d 100644
---
a/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRulesHandler.java
+++
b/mcp/features/mask/src/main/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRulesHandler.java
@@ -40,13 +40,13 @@ public final class MaskRulesHandler implements
MCPResourceHandler<MCPDatabaseHan
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return MaskFeatureDefinition.RULES_RESOURCE_URI;
}
@Override
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(ruleInspectionService.queryMaskRules(databaseContext.getQueryFacade(),
uriVariables.getValue("database")),
-
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables));
+
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables));
}
}
diff --git
a/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/MaskMCPHandlerProviderTest.java
b/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/MaskMCPHandlerProviderTest.java
index cc570608bde..975615a5e50 100644
---
a/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/MaskMCPHandlerProviderTest.java
+++
b/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/MaskMCPHandlerProviderTest.java
@@ -35,7 +35,7 @@ class MaskMCPHandlerProviderTest {
@Test
void assertGetResourceHandlers() {
Collection<MCPResourceHandler<?>> actual = new
MaskMCPHandlerProvider().getResourceHandlers();
-
assertThat(actual.stream().map(MCPResourceHandler::getResourceUriOrTemplate).toList(),
is(List.of(
+
assertThat(actual.stream().map(MCPResourceHandler::getResourceUriTemplate).toList(),
is(List.of(
"shardingsphere://features/mask/algorithms",
"shardingsphere://features/mask/databases/{database}/rules",
"shardingsphere://features/mask/databases/{database}/tables/{table}/rules")));
diff --git
a/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskAlgorithmsHandlerTest.java
b/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskAlgorithmsHandlerTest.java
index faac3173a72..a8ca0eee411 100644
---
a/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskAlgorithmsHandlerTest.java
+++
b/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskAlgorithmsHandlerTest.java
@@ -45,7 +45,7 @@ class MaskAlgorithmsHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new MaskAlgorithmsHandler().getResourceUriOrTemplate(),
is(MaskFeatureDefinition.ALGORITHMS_RESOURCE_URI));
+ assertThat(new MaskAlgorithmsHandler().getResourceUriTemplate(),
is(MaskFeatureDefinition.ALGORITHMS_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRuleHandlerTest.java
b/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRuleHandlerTest.java
index 67efd4773da..7e75a83eee2 100644
---
a/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRuleHandlerTest.java
+++
b/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRuleHandlerTest.java
@@ -45,7 +45,7 @@ class MaskRuleHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new MaskRuleHandler().getResourceUriOrTemplate(),
is(MaskFeatureDefinition.RULE_RESOURCE_URI));
+ assertThat(new MaskRuleHandler().getResourceUriTemplate(),
is(MaskFeatureDefinition.RULE_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRulesHandlerTest.java
b/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRulesHandlerTest.java
index 91f9dbb1a8c..0f1a70c5ecb 100644
---
a/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRulesHandlerTest.java
+++
b/mcp/features/mask/src/test/java/org/apache/shardingsphere/mcp/feature/mask/resource/handler/MaskRulesHandlerTest.java
@@ -45,7 +45,7 @@ class MaskRulesHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new MaskRulesHandler().getResourceUriOrTemplate(),
is(MaskFeatureDefinition.RULES_RESOURCE_URI));
+ assertThat(new MaskRulesHandler().getResourceUriTemplate(),
is(MaskFeatureDefinition.RULES_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/LoadBalanceAlgorithmPluginsHandler.java
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/LoadBalanceAlgorithmPluginsHandler.java
index bb996917110..1ac3b2f275a 100644
---
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/LoadBalanceAlgorithmPluginsHandler.java
+++
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/LoadBalanceAlgorithmPluginsHandler.java
@@ -48,13 +48,13 @@ public final class LoadBalanceAlgorithmPluginsHandler
implements MCPResourceHand
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return
ReadwriteSplittingFeatureDefinition.LOAD_BALANCE_ALGORITHM_PLUGINS_RESOURCE_URI;
}
@Override
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(inspectionService.queryLoadBalanceAlgorithmPlugins(databaseContext.getQueryFacade()),
-
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables));
+
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables));
}
}
diff --git
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleCountHandler.java
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleCountHandler.java
index 74b7a77e305..06980ff98a1 100644
---
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleCountHandler.java
+++
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleCountHandler.java
@@ -48,7 +48,7 @@ public final class ReadwriteSplittingRuleCountHandler
implements MCPResourceHand
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return ReadwriteSplittingFeatureDefinition.RULE_COUNT_RESOURCE_URI;
}
@@ -56,6 +56,6 @@ public final class ReadwriteSplittingRuleCountHandler
implements MCPResourceHand
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(inspectionService.queryRuleCount(databaseContext.getQueryFacade(),
uriVariables.getValue("database")),
MCPResourceNavigationPayloadBuilder.create(
-
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables, ReadwriteSplittingFeatureDefinition.RULES_RESOURCE_URI));
+
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables, ReadwriteSplittingFeatureDefinition.RULES_RESOURCE_URI));
}
}
diff --git
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleHandler.java
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleHandler.java
index 2a77de1f496..e414e6c5f80 100644
---
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleHandler.java
+++
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleHandler.java
@@ -48,7 +48,7 @@ public final class ReadwriteSplittingRuleHandler implements
MCPResourceHandler<M
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return ReadwriteSplittingFeatureDefinition.RULE_RESOURCE_URI;
}
@@ -56,6 +56,6 @@ public final class ReadwriteSplittingRuleHandler implements
MCPResourceHandler<M
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(inspectionService.queryRule(databaseContext.getQueryFacade(),
uriVariables.getValue("database"), uriVariables.getValue("rule")),
MCPResourceNavigationPayloadBuilder.create(
-
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables, ReadwriteSplittingFeatureDefinition.RULES_RESOURCE_URI));
+
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables, ReadwriteSplittingFeatureDefinition.RULES_RESOURCE_URI));
}
}
diff --git
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleStatusHandler.java
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleStatusHandler.java
index a3287f4ba23..d3516def834 100644
---
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleStatusHandler.java
+++
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleStatusHandler.java
@@ -48,7 +48,7 @@ public final class ReadwriteSplittingRuleStatusHandler
implements MCPResourceHan
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return ReadwriteSplittingFeatureDefinition.RULE_STATUS_RESOURCE_URI;
}
@@ -56,6 +56,6 @@ public final class ReadwriteSplittingRuleStatusHandler
implements MCPResourceHan
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(inspectionService.queryRuleStatus(databaseContext.getQueryFacade(),
uriVariables.getValue("database"), uriVariables.getValue("rule")),
MCPResourceNavigationPayloadBuilder.create(
-
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables, ReadwriteSplittingFeatureDefinition.STATUS_RESOURCE_URI));
+
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables, ReadwriteSplittingFeatureDefinition.STATUS_RESOURCE_URI));
}
}
diff --git
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRulesHandler.java
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRulesHandler.java
index 8c9f9a71f18..39fea0119eb 100644
---
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRulesHandler.java
+++
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRulesHandler.java
@@ -48,13 +48,13 @@ public final class ReadwriteSplittingRulesHandler
implements MCPResourceHandler<
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return ReadwriteSplittingFeatureDefinition.RULES_RESOURCE_URI;
}
@Override
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(inspectionService.queryRules(databaseContext.getQueryFacade(),
uriVariables.getValue("database")),
-
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables));
+
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables));
}
}
diff --git
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingStatusHandler.java
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingStatusHandler.java
index c29d8cdd131..2fcad721304 100644
---
a/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingStatusHandler.java
+++
b/mcp/features/readwrite-splitting/src/main/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingStatusHandler.java
@@ -48,7 +48,7 @@ public final class ReadwriteSplittingStatusHandler implements
MCPResourceHandler
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return ReadwriteSplittingFeatureDefinition.STATUS_RESOURCE_URI;
}
@@ -56,6 +56,6 @@ public final class ReadwriteSplittingStatusHandler implements
MCPResourceHandler
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new
MCPItemsResponse(inspectionService.queryStatuses(databaseContext.getQueryFacade(),
uriVariables.getValue("database")),
MCPResourceNavigationPayloadBuilder.create(
-
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables, ReadwriteSplittingFeatureDefinition.RULES_RESOURCE_URI));
+
MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables, ReadwriteSplittingFeatureDefinition.RULES_RESOURCE_URI));
}
}
diff --git
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/ReadwriteSplittingMCPHandlerProviderTest.java
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/ReadwriteSplittingMCPHandlerProviderTest.java
index bf230cf9534..cfb6286b773 100644
---
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/ReadwriteSplittingMCPHandlerProviderTest.java
+++
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/ReadwriteSplittingMCPHandlerProviderTest.java
@@ -40,7 +40,7 @@ class ReadwriteSplittingMCPHandlerProviderTest {
@Test
void assertGetResourceHandlers() {
Collection<MCPResourceHandler<?>> actual = new
ReadwriteSplittingMCPHandlerProvider().getResourceHandlers();
-
assertThat(actual.stream().map(MCPResourceHandler::getResourceUriOrTemplate).toList(),
containsInAnyOrder(
+
assertThat(actual.stream().map(MCPResourceHandler::getResourceUriTemplate).toList(),
containsInAnyOrder(
ReadwriteSplittingFeatureDefinition.RULES_RESOURCE_URI,
ReadwriteSplittingFeatureDefinition.RULE_RESOURCE_URI,
ReadwriteSplittingFeatureDefinition.STATUS_RESOURCE_URI,
diff --git
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/LoadBalanceAlgorithmPluginsHandlerTest.java
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/LoadBalanceAlgorithmPluginsHandlerTest.java
index 085990a9edf..f54783a7597 100644
---
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/LoadBalanceAlgorithmPluginsHandlerTest.java
+++
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/LoadBalanceAlgorithmPluginsHandlerTest.java
@@ -44,7 +44,7 @@ class LoadBalanceAlgorithmPluginsHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new
LoadBalanceAlgorithmPluginsHandler().getResourceUriOrTemplate(),
is(ReadwriteSplittingFeatureDefinition.LOAD_BALANCE_ALGORITHM_PLUGINS_RESOURCE_URI));
+ assertThat(new
LoadBalanceAlgorithmPluginsHandler().getResourceUriTemplate(),
is(ReadwriteSplittingFeatureDefinition.LOAD_BALANCE_ALGORITHM_PLUGINS_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleCountHandlerTest.java
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleCountHandlerTest.java
index 85b6c7944f9..7896244b708 100644
---
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleCountHandlerTest.java
+++
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleCountHandlerTest.java
@@ -44,7 +44,7 @@ class ReadwriteSplittingRuleCountHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new
ReadwriteSplittingRuleCountHandler().getResourceUriOrTemplate(),
is(ReadwriteSplittingFeatureDefinition.RULE_COUNT_RESOURCE_URI));
+ assertThat(new
ReadwriteSplittingRuleCountHandler().getResourceUriTemplate(),
is(ReadwriteSplittingFeatureDefinition.RULE_COUNT_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleHandlerTest.java
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleHandlerTest.java
index a525528c80a..6d6e689368a 100644
---
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleHandlerTest.java
+++
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleHandlerTest.java
@@ -44,7 +44,7 @@ class ReadwriteSplittingRuleHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new
ReadwriteSplittingRuleHandler().getResourceUriOrTemplate(),
is(ReadwriteSplittingFeatureDefinition.RULE_RESOURCE_URI));
+ assertThat(new
ReadwriteSplittingRuleHandler().getResourceUriTemplate(),
is(ReadwriteSplittingFeatureDefinition.RULE_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleStatusHandlerTest.java
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleStatusHandlerTest.java
index 19cfc6610bb..cb9df977075 100644
---
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleStatusHandlerTest.java
+++
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRuleStatusHandlerTest.java
@@ -44,7 +44,7 @@ class ReadwriteSplittingRuleStatusHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new
ReadwriteSplittingRuleStatusHandler().getResourceUriOrTemplate(),
is(ReadwriteSplittingFeatureDefinition.RULE_STATUS_RESOURCE_URI));
+ assertThat(new
ReadwriteSplittingRuleStatusHandler().getResourceUriTemplate(),
is(ReadwriteSplittingFeatureDefinition.RULE_STATUS_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRulesHandlerTest.java
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRulesHandlerTest.java
index 62b695ddad4..aeede168ed3 100644
---
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRulesHandlerTest.java
+++
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingRulesHandlerTest.java
@@ -44,7 +44,7 @@ class ReadwriteSplittingRulesHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new
ReadwriteSplittingRulesHandler().getResourceUriOrTemplate(),
is(ReadwriteSplittingFeatureDefinition.RULES_RESOURCE_URI));
+ assertThat(new
ReadwriteSplittingRulesHandler().getResourceUriTemplate(),
is(ReadwriteSplittingFeatureDefinition.RULES_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingStatusHandlerTest.java
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingStatusHandlerTest.java
index 8d44e3935f6..ad3b4d1beb7 100644
---
a/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingStatusHandlerTest.java
+++
b/mcp/features/readwrite-splitting/src/test/java/org/apache/shardingsphere/mcp/feature/readwritesplitting/resource/handler/ReadwriteSplittingStatusHandlerTest.java
@@ -44,7 +44,7 @@ class ReadwriteSplittingStatusHandlerTest {
@Test
void assertGetResourceUriTemplate() {
- assertThat(new
ReadwriteSplittingStatusHandler().getResourceUriOrTemplate(),
is(ReadwriteSplittingFeatureDefinition.STATUS_RESOURCE_URI));
+ assertThat(new
ReadwriteSplittingStatusHandler().getResourceUriTemplate(),
is(ReadwriteSplittingFeatureDefinition.STATUS_RESOURCE_URI));
}
@Test
diff --git
a/mcp/features/shadow/src/main/java/org/apache/shardingsphere/mcp/feature/shadow/resource/handler/ShadowResourceHandler.java
b/mcp/features/shadow/src/main/java/org/apache/shardingsphere/mcp/feature/shadow/resource/handler/ShadowResourceHandler.java
index ca1fd15e6a2..6f824aff822 100644
---
a/mcp/features/shadow/src/main/java/org/apache/shardingsphere/mcp/feature/shadow/resource/handler/ShadowResourceHandler.java
+++
b/mcp/features/shadow/src/main/java/org/apache/shardingsphere/mcp/feature/shadow/resource/handler/ShadowResourceHandler.java
@@ -129,14 +129,14 @@ public final class ShadowResourceHandler implements
MCPResourceHandler<MCPDataba
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return resourceUriTemplate;
}
@Override
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new MCPItemsResponse(query(databaseContext, uriVariables),
-
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables));
+
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables));
}
private List<Map<String, Object>> query(final MCPDatabaseHandlerContext
databaseContext, final MCPUriVariables uriVariables) {
diff --git
a/mcp/features/sharding/src/main/java/org/apache/shardingsphere/mcp/feature/sharding/resource/handler/AbstractShardingResourceHandler.java
b/mcp/features/sharding/src/main/java/org/apache/shardingsphere/mcp/feature/sharding/resource/handler/AbstractShardingResourceHandler.java
index 51f34034812..6315b2ba9d3 100644
---
a/mcp/features/sharding/src/main/java/org/apache/shardingsphere/mcp/feature/sharding/resource/handler/AbstractShardingResourceHandler.java
+++
b/mcp/features/sharding/src/main/java/org/apache/shardingsphere/mcp/feature/sharding/resource/handler/AbstractShardingResourceHandler.java
@@ -46,14 +46,14 @@ abstract class AbstractShardingResourceHandler implements
MCPResourceHandler<MCP
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return resourceUriTemplate;
}
@Override
public MCPResponse handle(final MCPDatabaseHandlerContext databaseContext,
final MCPUriVariables uriVariables) {
return new MCPItemsResponse(query(databaseContext, uriVariables),
-
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriOrTemplate()),
uriVariables));
+
MCPResourceNavigationPayloadBuilder.create(MCPDescriptorCatalogIndex.getRequiredResourceDescriptor(getResourceUriTemplate()),
uriVariables));
}
protected ShardingInspectionService getInspectionService() {
diff --git
a/mcp/features/sharding/src/test/java/org/apache/shardingsphere/mcp/feature/sharding/ShardingMCPHandlerProviderTest.java
b/mcp/features/sharding/src/test/java/org/apache/shardingsphere/mcp/feature/sharding/ShardingMCPHandlerProviderTest.java
index 8fdeed0446d..be0ca356066 100644
---
a/mcp/features/sharding/src/test/java/org/apache/shardingsphere/mcp/feature/sharding/ShardingMCPHandlerProviderTest.java
+++
b/mcp/features/sharding/src/test/java/org/apache/shardingsphere/mcp/feature/sharding/ShardingMCPHandlerProviderTest.java
@@ -41,8 +41,8 @@ class ShardingMCPHandlerProviderTest {
void assertGetResourceHandlers() {
Collection<MCPResourceHandler<?>> actual = new
ShardingMCPHandlerProvider().getResourceHandlers();
assertThat(actual.size(), is(22));
-
assertTrue(actual.stream().map(MCPResourceHandler::getResourceUriOrTemplate).toList().contains(ShardingFeatureDefinition.TABLE_RULES_RESOURCE_URI));
-
assertTrue(actual.stream().map(MCPResourceHandler::getResourceUriOrTemplate).toList().contains(ShardingFeatureDefinition.UNUSED_AUDITORS_RESOURCE_URI));
+
assertTrue(actual.stream().map(MCPResourceHandler::getResourceUriTemplate).toList().contains(ShardingFeatureDefinition.TABLE_RULES_RESOURCE_URI));
+
assertTrue(actual.stream().map(MCPResourceHandler::getResourceUriTemplate).toList().contains(ShardingFeatureDefinition.UNUSED_AUDITORS_RESOURCE_URI));
assertTrue(actual.stream().anyMatch(each -> each instanceof
ShardingAlgorithmResourceHandler));
assertTrue(actual.stream().anyMatch(each -> each instanceof
ShardingTableResourceHandler));
assertTrue(actual.stream().anyMatch(each -> each instanceof
ShardingStrategyResourceHandler));
diff --git
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPCompletionTargetDescriptorValidator.java
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPCompletionTargetDescriptorValidator.java
index 6fbc4ffbdf2..e914ba5eb92 100644
---
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPCompletionTargetDescriptorValidator.java
+++
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPCompletionTargetDescriptorValidator.java
@@ -51,7 +51,7 @@ public final class MCPCompletionTargetDescriptorValidator {
Map<String, Set<String>> promptArguments =
prompts.stream().collect(Collectors.toMap(MCPPromptDescriptor::getName,
each ->
each.getArguments().stream().map(MCPPromptArgumentDescriptor::getName).collect(Collectors.toSet())));
Set<String> promptNames = promptArguments.keySet();
- Map<String, MCPResourceDescriptor> resourceDescriptors =
resources.stream().collect(Collectors.toMap(MCPResourceDescriptor::getUriOrTemplate,
each -> each));
+ Map<String, MCPResourceDescriptor> resourceDescriptors =
resources.stream().collect(Collectors.toMap(MCPResourceDescriptor::getUriTemplate,
each -> each));
Map<String, MCPCompletionTargetDescriptor> registered = new
LinkedHashMap<>(descriptors.size(), 1F);
for (MCPCompletionTargetDescriptor each : descriptors) {
validateCompletionReference(each, promptNames,
resourceDescriptors.keySet());
@@ -106,7 +106,7 @@ public final class MCPCompletionTargetDescriptorValidator {
MCPResourceDescriptor resource =
resources.get(descriptor.getReference());
ShardingSpherePreconditions.checkState(resource.isTemplated(),
() -> new IllegalStateException(String.format("Completion
target `resource:%s` must reference a resource template.",
descriptor.getReference())));
- Collection<String> templateVariables = new
MCPUriTemplate(resource.getUriOrTemplate()).getVariableNames();
+ Collection<String> templateVariables = new
MCPUriTemplate(resource.getUriTemplate()).getVariableNames();
for (String each : descriptor.getArguments()) {
ShardingSpherePreconditions.checkState(templateVariables.contains(each), () ->
new IllegalStateException(
String.format("Completion target `resource:%s` argument
`%s` is not a URI template variable.", descriptor.getReference(), each)));
diff --git
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogIndex.java
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogIndex.java
index 6f198a5209d..5778adf371a 100644
---
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogIndex.java
+++
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogIndex.java
@@ -61,17 +61,17 @@ public final class MCPDescriptorCatalogIndex {
int expectedSize =
CATALOG.getProtocolDescriptors().getResourceDescriptors().size() +
CATALOG.getProtocolDescriptors().getResourceTemplateDescriptors().size();
Map<String, MCPResourceDescriptor> result = new
LinkedHashMap<>(expectedSize, 1F);
for (MCPResourceDescriptor each :
CATALOG.getProtocolDescriptors().getResourceDescriptors()) {
- result.put(each.getUriOrTemplate(), each);
+ result.put(each.getUriTemplate(), each);
}
for (MCPResourceDescriptor each :
CATALOG.getProtocolDescriptors().getResourceTemplateDescriptors()) {
- result.put(each.getUriOrTemplate(), each);
+ result.put(each.getUriTemplate(), each);
}
return result;
}
private static Map<String, ShardingSphereMCPResourceMetadata>
createShardingSphereResourceMetadata() {
return
CATALOG.getShardingSphereDescriptors().getResourceMetadata().stream()
-
.collect(Collectors.toMap(ShardingSphereMCPResourceMetadata::getUriOrTemplate,
each -> each));
+
.collect(Collectors.toMap(ShardingSphereMCPResourceMetadata::getUriTemplate,
each -> each));
}
private static Map<String, MCPToolDescriptor> createToolDescriptors() {
@@ -121,22 +121,22 @@ public final class MCPDescriptorCatalogIndex {
/**
* Get required resource descriptor.
*
- * @param uriOrTemplate resource URI or resource template URI template
+ * @param uriTemplate resource URI template
* @return resource descriptor
*/
- public static MCPResourceDescriptor getRequiredResourceDescriptor(final
String uriOrTemplate) {
- return
Optional.ofNullable(RESOURCE_DESCRIPTORS.get(uriOrTemplate)).orElseThrow(() ->
new IllegalStateException(String.format("MCP resource descriptor is required
for `%s`.", uriOrTemplate)));
+ public static MCPResourceDescriptor getRequiredResourceDescriptor(final
String uriTemplate) {
+ return
Optional.ofNullable(RESOURCE_DESCRIPTORS.get(uriTemplate)).orElseThrow(() ->
new IllegalStateException(String.format("MCP resource descriptor is required
for `%s`.", uriTemplate)));
}
/**
* Get required ShardingSphere MCP resource metadata descriptor.
*
- * @param uriOrTemplate resource URI or resource template URI template
+ * @param uriTemplate resource URI template
* @return ShardingSphere MCP resource metadata descriptor
*/
- public static ShardingSphereMCPResourceMetadata
getRequiredShardingSphereResourceMetadata(final String uriOrTemplate) {
- return
Optional.ofNullable(SHARDINGSPHERE_RESOURCE_METADATA.get(uriOrTemplate)).orElseThrow(
- () -> new IllegalStateException(String.format("ShardingSphere
MCP resource metadata descriptor is required for `%s`.", uriOrTemplate)));
+ public static ShardingSphereMCPResourceMetadata
getRequiredShardingSphereResourceMetadata(final String uriTemplate) {
+ return
Optional.ofNullable(SHARDINGSPHERE_RESOURCE_METADATA.get(uriTemplate)).orElseThrow(
+ () -> new IllegalStateException(String.format("ShardingSphere
MCP resource metadata descriptor is required for `%s`.", uriTemplate)));
}
/**
diff --git
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogPayloadBuilder.java
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogPayloadBuilder.java
index 37c7792f54d..e578bb21b2f 100644
---
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogPayloadBuilder.java
+++
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogPayloadBuilder.java
@@ -79,7 +79,7 @@ final class MCPDescriptorCatalogPayloadBuilder {
private Map<String, Object> createResourcePayload(final
MCPResourceDescriptor descriptor, final String uriFieldName) {
Map<String, Object> result = new LinkedHashMap<>(8, 1F);
- result.put(uriFieldName, descriptor.getUriOrTemplate());
+ result.put(uriFieldName, descriptor.getUriTemplate());
result.put("name", descriptor.getName());
result.put("title", descriptor.getTitle());
result.put("description", descriptor.getDescription());
@@ -197,7 +197,7 @@ final class MCPDescriptorCatalogPayloadBuilder {
}
private String resolveReferenceType(final String reference) {
- if
(catalog.getProtocolDescriptors().getAllResourceDescriptors().stream().anyMatch(each
-> each.getUriOrTemplate().equals(reference))) {
+ if
(catalog.getProtocolDescriptors().getAllResourceDescriptors().stream().anyMatch(each
-> each.getUriTemplate().equals(reference))) {
return reference.contains("{") ? "resource_template" : "resource";
}
if
(catalog.getProtocolDescriptors().getToolDescriptors().stream().anyMatch(each
-> each.getName().equals(reference))) {
diff --git
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogYamlSwapper.java
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogYamlSwapper.java
index ca7be1ba1ec..37a9eeea8e7 100644
---
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogYamlSwapper.java
+++
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogYamlSwapper.java
@@ -93,26 +93,26 @@ final class MCPDescriptorCatalogYamlSwapper {
}
}
- private static ShardingSphereMCPResourceMetadata
swapShardingSphereResourceMetadata(final String uriOrTemplate, final
YamlShardingSphereMCPResourceMetadata yamlMetadata) {
+ private static ShardingSphereMCPResourceMetadata
swapShardingSphereResourceMetadata(final String uriTemplate, final
YamlShardingSphereMCPResourceMetadata yamlMetadata) {
if (null == yamlMetadata) {
- return new ShardingSphereMCPResourceMetadata(uriOrTemplate,
List.of(), null, null, null, List.of(), List.of(), List.of());
+ return new ShardingSphereMCPResourceMetadata(uriTemplate,
List.of(), null, null, null, List.of(), List.of(), List.of());
}
- return new ShardingSphereMCPResourceMetadata(uriOrTemplate,
swapUriVariables(yamlMetadata.getUriVariables()),
yamlMetadata.getResourceKind(), yamlMetadata.getObjectScope(),
+ return new ShardingSphereMCPResourceMetadata(uriTemplate,
swapUriVariables(yamlMetadata.getUriVariables()),
yamlMetadata.getResourceKind(), yamlMetadata.getObjectScope(),
yamlMetadata.getFeature(),
emptyIfNull(yamlMetadata.getRelatedTools()),
emptyIfNull(yamlMetadata.getRelatedResources()),
emptyIfNull(yamlMetadata.getUseBefore()));
}
- private static Map<String, Object> createResourceMeta(final String
uriOrTemplate, final Map<String, Object> rawMeta, final
ShardingSphereMCPResourceMetadata metadata) {
- validateNoTypedResourceMetadataKeys(uriOrTemplate, rawMeta);
+ private static Map<String, Object> createResourceMeta(final String
uriTemplate, final Map<String, Object> rawMeta, final
ShardingSphereMCPResourceMetadata metadata) {
+ validateNoTypedResourceMetadataKeys(uriTemplate, rawMeta);
Map<String, Object> result = new LinkedHashMap<>(rawMeta.size() +
MCPShardingSphereMetadataKeys.TYPED_RESOURCE_METADATA_KEYS.size(), 1F);
result.putAll(rawMeta);
result.putAll(metadata.toMeta());
return result;
}
- private static void validateNoTypedResourceMetadataKeys(final String
uriOrTemplate, final Map<String, Object> rawMeta) {
+ private static void validateNoTypedResourceMetadataKeys(final String
uriTemplate, final Map<String, Object> rawMeta) {
for (String each :
MCPShardingSphereMetadataKeys.TYPED_RESOURCE_METADATA_KEYS) {
if (rawMeta.containsKey(each)) {
- throw new IllegalStateException(String.format("MCP resource
descriptor `%s` raw meta must not define typed ShardingSphere resource metadata
key `%s`.", uriOrTemplate, each));
+ throw new IllegalStateException(String.format("MCP resource
descriptor `%s` raw meta must not define typed ShardingSphere resource metadata
key `%s`.", uriTemplate, each));
}
}
}
diff --git
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceDescriptorValidator.java
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceDescriptorValidator.java
index a033d03216a..8735c5dc253 100644
---
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceDescriptorValidator.java
+++
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceDescriptorValidator.java
@@ -46,48 +46,48 @@ public final class MCPResourceDescriptorValidator {
int expectedSize =
catalog.getProtocolDescriptors().getResourceDescriptors().size() +
catalog.getProtocolDescriptors().getResourceTemplateDescriptors().size();
Map<String, MCPResourceDescriptor> registered = new
LinkedHashMap<>(expectedSize, 1F);
for (MCPResourceDescriptor each :
catalog.getProtocolDescriptors().getResourceDescriptors()) {
- checkNotBlank(each.getUriOrTemplate(), "Resource URI");
+ checkNotBlank(each.getUriTemplate(), "Resource URI");
ShardingSpherePreconditions.checkState(!each.isTemplated(),
- () -> new IllegalStateException(String.format("Fixed
resource `%s` must not contain template variables.", each.getUriOrTemplate())));
+ () -> new IllegalStateException(String.format("Fixed
resource `%s` must not contain template variables.", each.getUriTemplate())));
validateResourceDescriptor(each, registered);
}
for (MCPResourceDescriptor each :
catalog.getProtocolDescriptors().getResourceTemplateDescriptors()) {
- checkNotBlank(each.getUriOrTemplate(), "Resource template URI
template");
+ checkNotBlank(each.getUriTemplate(), "Resource template URI");
ShardingSpherePreconditions.checkState(each.isTemplated(),
- () -> new IllegalStateException(String.format("Resource
template `%s` must contain template variables.", each.getUriOrTemplate())));
+ () -> new IllegalStateException(String.format("Resource
template `%s` must contain template variables.", each.getUriTemplate())));
validateResourceDescriptor(each, registered);
- validateResourceVariables(each,
findShardingSphereResourceMetadata(catalog,
each.getUriOrTemplate()).map(ShardingSphereMCPResourceMetadata::getUriVariables).orElse(List.of()));
+ validateResourceVariables(each,
findShardingSphereResourceMetadata(catalog,
each.getUriTemplate()).map(ShardingSphereMCPResourceMetadata::getUriVariables).orElse(List.of()));
}
}
private static void validateResourceDescriptor(final MCPResourceDescriptor
descriptor, final Map<String, MCPResourceDescriptor> registered) {
- ShardingSpherePreconditions.checkState(null ==
registered.putIfAbsent(descriptor.getUriOrTemplate(), descriptor),
- () -> new IllegalStateException(String.format("Duplicate MCP
resource descriptor `%s`.", descriptor.getUriOrTemplate())));
+ ShardingSpherePreconditions.checkState(null ==
registered.putIfAbsent(descriptor.getUriTemplate(), descriptor),
+ () -> new IllegalStateException(String.format("Duplicate MCP
resource descriptor `%s`.", descriptor.getUriTemplate())));
}
- private static Optional<ShardingSphereMCPResourceMetadata>
findShardingSphereResourceMetadata(final MCPDescriptorCatalog catalog, final
String uriOrTemplate) {
- return
catalog.getShardingSphereDescriptors().getResourceMetadata().stream().filter(each
-> uriOrTemplate.equals(each.getUriOrTemplate())).findFirst();
+ private static Optional<ShardingSphereMCPResourceMetadata>
findShardingSphereResourceMetadata(final MCPDescriptorCatalog catalog, final
String uriTemplate) {
+ return
catalog.getShardingSphereDescriptors().getResourceMetadata().stream().filter(each
-> uriTemplate.equals(each.getUriTemplate())).findFirst();
}
private static void validateResourceVariables(final MCPResourceDescriptor
descriptor, final Collection<MCPUriVariableDescriptor> uriVariables) {
- List<String> templateVariables = new
MCPUriTemplate(descriptor.getUriOrTemplate()).getVariableNames();
+ List<String> templateVariables = new
MCPUriTemplate(descriptor.getUriTemplate()).getVariableNames();
Set<String> registeredTemplateVariables = new HashSet<>();
for (String each : templateVariables) {
ShardingSpherePreconditions.checkState(registeredTemplateVariables.add(each),
- () -> new IllegalStateException(String.format("Duplicate
URI template variable `%s` in resource descriptor `%s`.", each,
descriptor.getUriOrTemplate())));
+ () -> new IllegalStateException(String.format("Duplicate
URI template variable `%s` in resource descriptor `%s`.", each,
descriptor.getUriTemplate())));
}
Map<String, MCPUriVariableDescriptor> declaredParameters = new
LinkedHashMap<>(uriVariables.size(), 1F);
for (MCPUriVariableDescriptor each : uriVariables) {
ShardingSpherePreconditions.checkState(each.isRequired(), () ->
new IllegalStateException(
- String.format("Resource parameter `%s.%s` must be required
because URI template variables are required.", descriptor.getUriOrTemplate(),
each.getName())));
+ String.format("Resource parameter `%s.%s` must be required
because URI template variables are required.", descriptor.getUriTemplate(),
each.getName())));
ShardingSpherePreconditions.checkState(registeredTemplateVariables.contains(each.getName()),
- () -> new IllegalStateException(String.format("Resource
descriptor `%s` declares non-template parameter `%s`.",
descriptor.getUriOrTemplate(), each.getName())));
+ () -> new IllegalStateException(String.format("Resource
descriptor `%s` declares non-template parameter `%s`.",
descriptor.getUriTemplate(), each.getName())));
ShardingSpherePreconditions.checkState(null ==
declaredParameters.putIfAbsent(each.getName(), each),
- () -> new IllegalStateException(String.format("Duplicate
MCP resource parameter `%s.%s`.", descriptor.getUriOrTemplate(),
each.getName())));
+ () -> new IllegalStateException(String.format("Duplicate
MCP resource parameter `%s.%s`.", descriptor.getUriTemplate(),
each.getName())));
}
for (String variableName : templateVariables) {
ShardingSpherePreconditions.checkState(declaredParameters.containsKey(variableName),
- () -> new IllegalStateException(String.format("Resource
descriptor `%s` must describe URI template variable `%s`.",
descriptor.getUriOrTemplate(), variableName)));
+ () -> new IllegalStateException(String.format("Resource
descriptor `%s` must describe URI template variable `%s`.",
descriptor.getUriTemplate(), variableName)));
}
}
diff --git
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceNavigationDescriptorValidator.java
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceNavigationDescriptorValidator.java
index 32b2e14d7d9..08450f469f3 100644
---
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceNavigationDescriptorValidator.java
+++
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceNavigationDescriptorValidator.java
@@ -55,7 +55,7 @@ public final class MCPResourceNavigationDescriptorValidator {
private static Set<String> createPublicIdentifiers(final
MCPDescriptorCatalog catalog) {
Set<String> result = new HashSet<>();
-
catalog.getProtocolDescriptors().getAllResourceDescriptors().stream().map(MCPResourceDescriptor::getUriOrTemplate).forEach(result::add);
+
catalog.getProtocolDescriptors().getAllResourceDescriptors().stream().map(MCPResourceDescriptor::getUriTemplate).forEach(result::add);
catalog.getProtocolDescriptors().getToolDescriptors().stream().map(MCPToolDescriptor::getName).forEach(result::add);
catalog.getProtocolDescriptors().getPromptDescriptors().stream().map(MCPPromptDescriptor::getName).forEach(result::add);
return result;
diff --git
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceNavigationPayloadBuilder.java
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceNavigationPayloadBuilder.java
index 2680d8836f2..03b427c709c 100644
---
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceNavigationPayloadBuilder.java
+++
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPResourceNavigationPayloadBuilder.java
@@ -56,7 +56,7 @@ public final class MCPResourceNavigationPayloadBuilder {
*/
public static Map<String, Object> create(final MCPResourceDescriptor
descriptor, final MCPUriVariables uriVariables, final String parentUriTemplate)
{
Map<String, Object> result = new LinkedHashMap<>(2, 1F);
- new
MCPUriTemplate(descriptor.getUriOrTemplate()).expandIfComplete(uriVariables).ifPresent(optional
-> result.put("self_uri", optional));
+ new
MCPUriTemplate(descriptor.getUriTemplate()).expandIfComplete(uriVariables).ifPresent(optional
-> result.put("self_uri", optional));
Optional<String> parentUri = new
MCPUriTemplate(parentUriTemplate).expandIfComplete(uriVariables);
parentUri.filter(optional -> !optional.isEmpty()).ifPresent(optional
-> result.put(MCPPayloadFieldNames.PARENT_RESOURCE,
createParentResourceHint(optional)));
return result;
diff --git
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPToolDescriptorCatalogValidator.java
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPToolDescriptorCatalogValidator.java
index 8be0371b5cb..66e4f175c6e 100644
---
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPToolDescriptorCatalogValidator.java
+++
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/MCPToolDescriptorCatalogValidator.java
@@ -64,9 +64,9 @@ public final class MCPToolDescriptorCatalogValidator {
Map<String, MCPToolDescriptor> registered = new
LinkedHashMap<>(descriptors.size(), 1F);
Map<String, MCPToolRuntimeDescriptor> runtimes =
runtimeDescriptors.stream()
.collect(Collectors.toMap(MCPToolRuntimeDescriptor::getToolName, each -> each));
- Set<String> resourceIdentifiers =
catalog.getProtocolDescriptors().getAllResourceDescriptors().stream().map(MCPResourceDescriptor::getUriOrTemplate).collect(Collectors.toSet());
+ Set<String> resourceIdentifiers =
catalog.getProtocolDescriptors().getAllResourceDescriptors().stream().map(MCPResourceDescriptor::getUriTemplate).collect(Collectors.toSet());
Set<String> shardingSphereResourceIdentifiers =
catalog.getShardingSphereDescriptors().getResourceMetadata().stream()
-
.map(ShardingSphereMCPResourceMetadata::getUriOrTemplate).collect(Collectors.toSet());
+
.map(ShardingSphereMCPResourceMetadata::getUriTemplate).collect(Collectors.toSet());
for (MCPToolDescriptor each : descriptors) {
ShardingSpherePreconditions.checkState(null ==
registered.putIfAbsent(each.getName(), each),
() -> new IllegalStateException(String.format("Duplicate
MCP tool descriptor `%s`.", each.getName())));
diff --git
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/ShardingSphereMCPResourceMetadata.java
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/ShardingSphereMCPResourceMetadata.java
index 3177d1c8e0c..a5d6f7e6a2f 100644
---
a/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/ShardingSphereMCPResourceMetadata.java
+++
b/mcp/support/src/main/java/org/apache/shardingsphere/mcp/support/descriptor/ShardingSphereMCPResourceMetadata.java
@@ -31,7 +31,7 @@ import java.util.Map;
@Getter
public final class ShardingSphereMCPResourceMetadata {
- private final String uriOrTemplate;
+ private final String uriTemplate;
private final Collection<MCPUriVariableDescriptor> uriVariables;
diff --git
a/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogIndexTest.java
b/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogIndexTest.java
index 8c060233f29..b45268d4eeb 100644
---
a/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogIndexTest.java
+++
b/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogIndexTest.java
@@ -37,7 +37,7 @@ class MCPDescriptorCatalogIndexTest {
@Test
void assertGetResourceDescriptors() {
Collection<MCPResourceDescriptor> actualDescriptors =
MCPDescriptorCatalogIndex.getResourceDescriptors();
- assertTrue(actualDescriptors.stream().anyMatch(each ->
"shardingsphere://workflows/{plan_id}".equals(each.getUriOrTemplate())));
+ assertTrue(actualDescriptors.stream().anyMatch(each ->
"shardingsphere://workflows/{plan_id}".equals(each.getUriTemplate())));
}
@Test
diff --git
a/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogLoaderTest.java
b/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogLoaderTest.java
index a220aa65127..89a4c989bf7 100644
---
a/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogLoaderTest.java
+++
b/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPDescriptorCatalogLoaderTest.java
@@ -106,7 +106,7 @@ class MCPDescriptorCatalogLoaderTest {
}
private MCPResourceDescriptor findResource(final MCPDescriptorCatalog
catalog, final String uriTemplate) {
- return
catalog.getProtocolDescriptors().getAllResourceDescriptors().stream().filter(each
-> uriTemplate.equals(each.getUriOrTemplate())).findFirst().orElseThrow();
+ return
catalog.getProtocolDescriptors().getAllResourceDescriptors().stream().filter(each
-> uriTemplate.equals(each.getUriTemplate())).findFirst().orElseThrow();
}
private MCPResourceDescriptor createResourceTemplateDescriptor() {
@@ -131,7 +131,7 @@ class MCPDescriptorCatalogLoaderTest {
}
private ShardingSphereMCPResourceMetadata
findShardingSphereResourceMetadata(final MCPDescriptorCatalog catalog, final
String uriTemplate) {
- return
catalog.getShardingSphereDescriptors().getResourceMetadata().stream().filter(each
-> uriTemplate.equals(each.getUriOrTemplate())).findFirst().orElseThrow();
+ return
catalog.getShardingSphereDescriptors().getResourceMetadata().stream().filter(each
-> uriTemplate.equals(each.getUriTemplate())).findFirst().orElseThrow();
}
private Map<?, ?> findInputProperty(final MCPToolDescriptor
toolDescriptor, final String fieldName) {
diff --git
a/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPProtocolDescriptorCatalogTest.java
b/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPProtocolDescriptorCatalogTest.java
index 2b294294a0b..8753562081f 100644
---
a/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPProtocolDescriptorCatalogTest.java
+++
b/mcp/support/src/test/java/org/apache/shardingsphere/mcp/support/descriptor/MCPProtocolDescriptorCatalogTest.java
@@ -69,8 +69,8 @@ class MCPProtocolDescriptorCatalogTest {
assertThat(actual.getAllResourceDescriptors(),
is(List.of(resourceDescriptor, resourceTemplateDescriptor)));
}
- private MCPResourceDescriptor createResourceDescriptor(final String
uriOrTemplate) {
- return new MCPResourceDescriptor(uriOrTemplate, "test-resource", "Test
Resource", "Read a test resource.", "application/json",
MCPResourceAnnotations.EMPTY, Map.of());
+ private MCPResourceDescriptor createResourceDescriptor(final String
uriTemplate) {
+ return new MCPResourceDescriptor(uriTemplate, "test-resource", "Test
Resource", "Read a test resource.", "application/json",
MCPResourceAnnotations.EMPTY, Map.of());
}
private MCPToolDescriptor createToolDescriptor() {
diff --git
a/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/support/fixture/plugin/PluginFixtureStatusResourceHandler.java
b/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/support/fixture/plugin/PluginFixtureStatusResourceHandler.java
index ff4f0e49834..b8c126f15a4 100644
---
a/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/support/fixture/plugin/PluginFixtureStatusResourceHandler.java
+++
b/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/support/fixture/plugin/PluginFixtureStatusResourceHandler.java
@@ -39,7 +39,7 @@ public final class PluginFixtureStatusResourceHandler
implements MCPResourceHand
}
@Override
- public String getResourceUriOrTemplate() {
+ public String getResourceUriTemplate() {
return URI_PATTERN;
}
diff --git
a/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/support/fixture/plugin/PluginFixtureStatusResourceHandlerTest.java
b/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/support/fixture/plugin/PluginFixtureStatusResourceHandlerTest.java
index a14d4956106..7c049e73e03 100644
---
a/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/support/fixture/plugin/PluginFixtureStatusResourceHandlerTest.java
+++
b/test/e2e/mcp/src/test/java/org/apache/shardingsphere/test/e2e/mcp/support/fixture/plugin/PluginFixtureStatusResourceHandlerTest.java
@@ -35,8 +35,8 @@ class PluginFixtureStatusResourceHandlerTest {
}
@Test
- void assertGetResourceUriOrTemplate() {
- assertThat(new
PluginFixtureStatusResourceHandler().getResourceUriOrTemplate(),
is("shardingsphere://features/test-fixture/status"));
+ void assertGetResourceUriTemplate() {
+ assertThat(new
PluginFixtureStatusResourceHandler().getResourceUriTemplate(),
is("shardingsphere://features/test-fixture/status"));
}
@Test