Interface McpUriTemplateManager

All Known Implementing Classes:
DefaultMcpUriTemplateManager

public interface McpUriTemplateManager
Interface for working with URI templates.

This interface provides methods for extracting variables from URI templates and matching them against actual URIs.

Author:
Christian Tzolov
  • Method Details

    • getVariableNames

      List<String> getVariableNames()
      Extract URI variable names from this URI template.
      Returns:
      A list of variable names extracted from the template
      Throws:
      IllegalArgumentException - if duplicate variable names are found
    • extractVariableValues

      Map<String,String> extractVariableValues(String uri)
      Extract URI variable values from the actual request URI.

      This method converts the URI template into a regex pattern, then uses that pattern to extract variable values from the request URI.

      Parameters:
      uri - The actual URI from the request
      Returns:
      A map of variable names to their values
      Throws:
      IllegalArgumentException - if the URI template is invalid or the request URI doesn't match the template pattern
    • matches

      boolean matches(String uri)
      Indicate whether the given URI matches this template.
      Parameters:
      uri - the URI to match to
      Returns:
      true if it matches; false otherwise
    • isUriTemplate

      boolean isUriTemplate(String uri)
      Check if the given URI is a URI template.
      Returns:
      Returns true if the URI contains variables in the format {variableName}