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
  • 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 specifications
      builder - 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: AbstractPromptGenaiAdapter
      Adds transport-specific session data to prompt arguments when available.
      Overrides:
      addSessionIdentifier in class AbstractPromptGenaiAdapter<io.modelcontextprotocol.server.McpSyncServerExchange,io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification,io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification>
      Parameters:
      exchange - server exchange or transport context
      arguments - 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:
      buildPromptSpecification in class AbstractPromptGenaiAdapter<io.modelcontextprotocol.server.McpSyncServerExchange,io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification,io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification>