Class GenericMCPToolAdapter
java.lang.Object
ai.redouble.nucleo.harness.AbstractJob<MCPToolResult>
ai.redouble.nucleo.tools.AbstractTool<MCPToolInput, MCPToolResult>
ai.redouble.nucleo.mcp.GenericMCPToolAdapter
- All Implemented Interfaces:
GuardedExecution, Identifiable, Job<MCPToolResult>, Tool<MCPToolInput, MCPToolResult>
Adapts an MCP-served tool to the Nucleo tool framework. Wraps an
MCPClient and a specific MCPToolDescriptor, exposing the standard
Tool contract so MCP tools participate in thinker tool
loops alongside native ones.
The adapter takes a connector MCPHandle so observability metadata
(obs.mcp.handle, obs.mcp.tool) and the namespaced LLM-facing
identity stay consistent with MCPToolProvider.name().
- Since:
- 0.1 (2026-01-10)
- Author:
- Andrey Santrosyan
-
Field Summary
Fields inherited from class AbstractTool
inputFields inherited from class AbstractJob
timeout, upstreamRetriesFields inherited from interface Job
DEFAULT_UPSTREAM_RETRIESFields inherited from interface Tool
OBS_INPUT, OBS_OUTPUT -
Constructor Summary
ConstructorsConstructorDescriptionGenericMCPToolAdapter(Identifiable parent, MCPClient client, MCPToolDescriptor descriptor, MCPHandle handle) Creates an adapter for a specific MCP tool. -
Method Summary
Modifier and TypeMethodDescriptionexecute(JobResources resources, JobContext<MCPToolResult> ctx) Executes the job with the provided resources and context.Default requirements for tools.Methods inherited from class AbstractTool
getInput, getJobType, postExecute, preExecute, setInputMethods inherited from class AbstractJob
getId, getName, getParentJobId, getPriority, getTimeout, getUpstreamRetries, getUserId, getWorkflowId, randomIdSuffix, setTimeout, setUpstreamRetries, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface GuardedExecution
declareAdmissionGuardrails, declareAuthGuardrails, declareContentGuardrailsMethods inherited from interface Identifiable
getParentJobId, getUserId, getWorkflowIdMethods inherited from interface Job
getDisplayName, getId, getJobId, getName, getPriority, getTimeout, getUpstreamRetriesMethods inherited from interface Tool
guardedInputTarget
-
Constructor Details
-
GenericMCPToolAdapter
public GenericMCPToolAdapter(Identifiable parent, MCPClient client, MCPToolDescriptor descriptor, MCPHandle handle) Creates an adapter for a specific MCP tool.- Parameters:
parent- the parent for lineage trackingclient- the MCP client to use for tool callsdescriptor- the descriptor for the specific tool to wraphandle- the connector handle that owns this tool (required so observability metadata and namespacing line up with the provider)
-
-
Method Details
-
getRequirements
Description copied from class:AbstractToolDefault requirements for tools. Subclasses should override to add database, LLM, or other requirements. JobType is handled byAbstractTool.getJobType(), not here.- Specified by:
getRequirementsin interfaceJob<MCPToolResult>- Overrides:
getRequirementsin classAbstractTool<MCPToolInput, MCPToolResult>- Returns:
- resource requirements, or null if the job needs no resources
-
execute
public MCPToolResult execute(JobResources resources, JobContext<MCPToolResult> ctx) throws LLMReadableCheckedException Description copied from interface:JobExecutes the job with the provided resources and context. A job reports progress and checks for cancellation through the context, and completes all its work before returning. A tool narrows this contract to the LLM-readable exceptions ofTool.execute(JobResources, JobContext).- Parameters:
resources- the allocated resourcesctx- the job execution context for monitoring- Returns:
- the job result, which may be null
- Throws:
LLMReadableCheckedException- if execution fails
-
getDescriptor
-
getToolName
-
getToolDescription
-
getClient
-
getHandle
-