Class AbstractPromptGenaiAdapter<E,S,P>
java.lang.Object
org.machanism.machai.process.provider.AbstractAIProvider
org.machanism.machai.mcp.server.GenericGenaiAdapter<E,S>
org.machanism.machai.mcp.server.AbstractPromptGenaiAdapter<E,S,P>
- Type Parameters:
E- server exchange or transport context typeS- transport-specific tool specification typeP- transport-specific prompt specification type
- All Implemented Interfaces:
ProcessProvider
- Direct Known Subclasses:
HttpStatelessGenericGenaiAdapter, HttpStreamableGenericGenaiAdapter, StdioGenaiAdapter
Common prompt-registration support for MCP GenAI adapters.
- Since:
- 1.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.slf4j.Logger -
Constructor Summary
ConstructorsConstructorDescriptionAbstractPromptGenaiAdapter(List<S> toolSpecifications, AbstractMcpServer.ToolSpecificationBuilder<E> toolSpecificationBuilder) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddPrompt(String name, String description, ToolFunction function, Role role, ParamDescriptor... paramsDesc) private voidaddPromptMessage(List<io.modelcontextprotocol.spec.McpSchema.PromptMessage> messages, String text, Role role) private voidaddPromptMessages(List<io.modelcontextprotocol.spec.McpSchema.PromptMessage> messages, Object result, com.fasterxml.jackson.databind.ObjectMapper mapper, Role role) protected voidaddSessionIdentifier(E exchange, Map<String, Object> arguments) Adds transport-specific session data to prompt arguments when available.protected abstract PbuildPromptSpecification(io.modelcontextprotocol.spec.McpSchema.Prompt prompt, BiFunction<E, io.modelcontextprotocol.spec.McpSchema.GetPromptRequest, io.modelcontextprotocol.spec.McpSchema.GetPromptResult> promptHandler) private ObjectexecutePrompt(ToolFunction function, com.fasterxml.jackson.databind.JsonNode parameters) Returns the prompts registered with this adapter.Methods inherited from class GenericGenaiAdapter
addTool, getToolNames, perform, toHumanReadableMethods inherited from class AbstractAIProvider
addMcpServer, addMcpServers, addPrompts, addResource, addResources, addTools, addWebSearch, addWebSearch, clear, getConfigurator, getInstructions, getMaxOutputTokens, getMaxToolCalls, getModel, getParamValue, getProjectDir, getTimeout, init, instructions, isErrorHandling, normalize, prompt, safelyInvokeTool, setErrorHandling, setInstructions, setMaxOutputTokens, setMaxToolCalls, setModel, setProjectDir, setTimeout, toSnakeCase
-
Field Details
-
log
private final org.slf4j.Logger log -
prompts
-
-
Constructor Details
-
AbstractPromptGenaiAdapter
AbstractPromptGenaiAdapter(List<S> toolSpecifications, AbstractMcpServer.ToolSpecificationBuilder<E> toolSpecificationBuilder)
-
-
Method Details
-
addPrompt
protected void addPrompt(String name, String description, ToolFunction function, Role role, ParamDescriptor... paramsDesc) - Overrides:
addPromptin classAbstractAIProvider
-
executePrompt
private Object executePrompt(ToolFunction function, com.fasterxml.jackson.databind.JsonNode parameters) throws AbstractPromptGenaiAdapter.PromptExecutionException -
addSessionIdentifier
-
addPromptMessages
-
addPromptMessage
-
buildPromptSpecification
protected abstract P buildPromptSpecification(io.modelcontextprotocol.spec.McpSchema.Prompt prompt, BiFunction<E, io.modelcontextprotocol.spec.McpSchema.GetPromptRequest, io.modelcontextprotocol.spec.McpSchema.GetPromptResult> promptHandler) -
getPrompts
-