Class AbstractMcpServerComponent<T>

java.lang.Object
com.github.thought2code.mcp.annotated.server.component.AbstractMcpServerComponent<T>
Type Parameters:
T - the type of the component
All Implemented Interfaces:
McpServerComponent<T>
Direct Known Subclasses:
McpServerCompletion, McpServerPrompt, McpServerResource, McpServerTool

public abstract class AbstractMcpServerComponent<T> extends Object implements McpServerComponent<T>
This abstract class represents an MCP server component (resource/prompt/tool) that is responsible for creating instances of a specific type T for a given method, and provides common functionality for all MCP server components.
Author:
codeboyzhou
  • Field Details

    • injector

      protected final DependencyInjector injector
      The dependency injector to use for injecting component attributes.
  • Constructor Details

    • AbstractMcpServerComponent

      protected AbstractMcpServerComponent()
      Creates a new instance of AbstractMcpServerComponent.
  • Method Details

    • localizeAttribute

      protected String localizeAttribute(String i18nKey, String defaultValue)
      Localizes the attribute with the specified i18n key using the resource bundle, or returns the default value if the key is not found in the bundle.
      Parameters:
      i18nKey - the i18n key of the attribute to localize
      defaultValue - the default value to return if the i18n key is not found in the bundle
      Returns:
      the localized value of the attribute, or the default value if the i18n key is not found in the bundle