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
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final DependencyInjectorThe dependency injector to use for injecting component attributes. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new instance ofAbstractMcpServerComponent. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringlocalizeAttribute(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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.thought2code.mcp.annotated.server.component.McpServerComponent
create
-
Field Details
-
injector
The dependency injector to use for injecting component attributes.
-
-
Constructor Details
-
AbstractMcpServerComponent
protected AbstractMcpServerComponent()Creates a new instance ofAbstractMcpServerComponent.
-
-
Method Details
-
localizeAttribute
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 localizedefaultValue- 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
-