Package org.machanism.machai.mcp.server
Class HttpStreamableGenericGenaiAdapter
java.lang.Object
org.machanism.machai.ai.provider.AbstractAIProvider
org.machanism.machai.mcp.server.GenericGenaiAdapter<io.modelcontextprotocol.server.McpSyncServerExchange,io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification>
org.machanism.machai.mcp.server.AbstractPromptGenaiAdapter<io.modelcontextprotocol.server.McpSyncServerExchange,io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification,io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification>
org.machanism.machai.mcp.server.HttpStreamableGenericGenaiAdapter
- All Implemented Interfaces:
Genai
public class HttpStreamableGenericGenaiAdapter
extends AbstractPromptGenaiAdapter<io.modelcontextprotocol.server.McpSyncServerExchange,io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification,io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification>
Adapts Machai tools and prompts to the streamable HTTP MCP transport.
- Since:
- 1.2.0
-
Field Summary
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
ConstructorsConstructorDescriptionHttpStreamableGenericGenaiAdapter(List<io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification> toolSpecifications, AbstractMcpServer.ToolSpecificationBuilder<io.modelcontextprotocol.server.McpSyncServerExchange> builder) Creates an adapter backed by the supplied tool specification collection. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddSessionIdentifier(io.modelcontextprotocol.server.McpSyncServerExchange exchange, Map<String, Object> arguments) Adds transport-specific session data to prompt arguments when available.protected io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecificationbuildPromptSpecification(io.modelcontextprotocol.spec.McpSchema.Prompt prompt, BiFunction<io.modelcontextprotocol.server.McpSyncServerExchange, io.modelcontextprotocol.spec.McpSchema.GetPromptRequest, io.modelcontextprotocol.spec.McpSchema.GetPromptResult> promptHandler) Methods inherited from class org.machanism.machai.mcp.server.AbstractPromptGenaiAdapter
addPrompt, 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, addResource, addResources, addTools, addWebSearch, addWebSearch, clear, getConfigurator, getParamValue, getProjectDir, getTimeout, init, instructions, isErrorHandling, normalize, prompt, safelyInvokeTool, setErrorHandling, setProjectDir, setTimeout
-
Constructor Details
-
HttpStreamableGenericGenaiAdapter
HttpStreamableGenericGenaiAdapter(List<io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification> toolSpecifications, AbstractMcpServer.ToolSpecificationBuilder<io.modelcontextprotocol.server.McpSyncServerExchange> 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
-
addSessionIdentifier
protected void addSessionIdentifier(io.modelcontextprotocol.server.McpSyncServerExchange exchange, Map<String, Object> arguments) Description copied from class:AbstractPromptGenaiAdapterAdds transport-specific session data to prompt arguments when available.- Overrides:
addSessionIdentifierin classAbstractPromptGenaiAdapter<io.modelcontextprotocol.server.McpSyncServerExchange,io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification, io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification> - Parameters:
exchange- server exchange or transport contextarguments- prompt arguments
-
buildPromptSpecification
protected io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification buildPromptSpecification(io.modelcontextprotocol.spec.McpSchema.Prompt prompt, BiFunction<io.modelcontextprotocol.server.McpSyncServerExchange, io.modelcontextprotocol.spec.McpSchema.GetPromptRequest, io.modelcontextprotocol.spec.McpSchema.GetPromptResult> promptHandler) - Specified by:
buildPromptSpecificationin classAbstractPromptGenaiAdapter<io.modelcontextprotocol.server.McpSyncServerExchange,io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification, io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification>
-