Package org.machanism.machai.mcp.server
Class HttpStatelessGenericGenaiAdapter
java.lang.Object
org.machanism.machai.ai.provider.AbstractAIProvider
org.machanism.machai.mcp.server.GenericGenaiAdapter<io.modelcontextprotocol.common.McpTransportContext,io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification>
org.machanism.machai.mcp.server.AbstractPromptGenaiAdapter<io.modelcontextprotocol.common.McpTransportContext,io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification,io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncPromptSpecification>
org.machanism.machai.mcp.server.HttpStatelessGenericGenaiAdapter
- All Implemented Interfaces:
Genai
public class HttpStatelessGenericGenaiAdapter
extends AbstractPromptGenaiAdapter<io.modelcontextprotocol.common.McpTransportContext,io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification,io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncPromptSpecification>
Adapts Machai tools, prompts, and resources to the stateless HTTP MCP
transport.
- Since:
- 1.2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncResourceSpecification> Resource specifications registered by this adapter.Fields inherited from class org.machanism.machai.ai.provider.AbstractAIProvider
chatModel, DEFAULT_WEBSEARCH_TYPE_NAME, ERROR_TOOL_RESULT_PREFIX, instructions, LINE_SEPARATOR, LOG_LINE_LENG, MAX_OUTPUT_TOKENS, maxOutputTokens, maxToolCalls, MCP_PROP_NAME_PREFIX, PARAGRAPH_SEPARATOR, PASSWORD_PROP_NAME, PROJECT_DIR_PARAM_NAME, projectDir, timeoutSec, USERNAME_PROP_NAME -
Constructor Summary
ConstructorsConstructorDescriptionHttpStatelessGenericGenaiAdapter(List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification> toolSpecifications, AbstractMcpServer.ToolSpecificationBuilder<io.modelcontextprotocol.common.McpTransportContext> builder) Creates an adapter backed by the supplied tool specification collection. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddResource(URI uri, String description, String mimeType, ToolFunction function, ParamDescriptor... paramsDesc) protected io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncPromptSpecificationbuildPromptSpecification(io.modelcontextprotocol.spec.McpSchema.Prompt prompt, BiFunction<io.modelcontextprotocol.common.McpTransportContext, io.modelcontextprotocol.spec.McpSchema.GetPromptRequest, io.modelcontextprotocol.spec.McpSchema.GetPromptResult> promptHandler) List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncResourceSpecification> Returns the resources registered with this adapter.Methods inherited from class org.machanism.machai.mcp.server.AbstractPromptGenaiAdapter
addPrompt, addSessionIdentifier, getPromptsMethods inherited from class org.machanism.machai.mcp.server.GenericGenaiAdapter
addTool, perform, toHumanReadableMethods inherited from class org.machanism.machai.ai.provider.AbstractAIProvider
addMcpServer, addMcpServers, addPrompts, addResources, addTools, addWebSearch, addWebSearch, clear, getConfigurator, getParamValue, getProjectDir, getTimeout, init, instructions, isErrorHandling, normalize, prompt, safelyInvokeTool, setErrorHandling, setProjectDir, setTimeout
-
Field Details
-
resourceSpecifications
private final List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncResourceSpecification> resourceSpecificationsResource specifications registered by this adapter.
-
-
Constructor Details
-
HttpStatelessGenericGenaiAdapter
HttpStatelessGenericGenaiAdapter(List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification> toolSpecifications, AbstractMcpServer.ToolSpecificationBuilder<io.modelcontextprotocol.common.McpTransportContext> builder) Creates an adapter backed by the supplied tool specification collection.- Parameters:
toolSpecifications- collection receiving generated tool specificationsbuilder- builder that creates transport-specific tool specifications
-
-
Method Details
-
buildPromptSpecification
protected io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncPromptSpecification buildPromptSpecification(io.modelcontextprotocol.spec.McpSchema.Prompt prompt, BiFunction<io.modelcontextprotocol.common.McpTransportContext, io.modelcontextprotocol.spec.McpSchema.GetPromptRequest, io.modelcontextprotocol.spec.McpSchema.GetPromptResult> promptHandler) - Specified by:
buildPromptSpecificationin classAbstractPromptGenaiAdapter<io.modelcontextprotocol.common.McpTransportContext,io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification, io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncPromptSpecification>
-
addResource
protected void addResource(URI uri, String description, String mimeType, ToolFunction function, ParamDescriptor... paramsDesc) - Overrides:
addResourcein classAbstractAIProvider
-
getResources
public List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncResourceSpecification> getResources()Returns the resources registered with this adapter.- Returns:
- mutable list of stateless resource specifications
-