Class MCPAnnotatedToolFactory
java.lang.Object
org.eclipse.mcp.factory.ToolFactory
org.eclipse.mcp.experimental.annotated.MCPAnnotatedToolFactory
- All Implemented Interfaces:
IFactory
- Direct Known Subclasses:
AnnotatedToolFactory
,BuiltinAnnotatedToolsFactory
Conveniences for creating one or more ToolFactories from annotated Java methods.
A JSON Input schema for your method's arguments will be constructed and basic mappings to/from JSON
will be handled. Arguments may be of types Boolean,Character, Double, Float, Integer, Long, Short, String[] Integer[]
No JSON Output Schema is generated at this time
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interface
static @interface
Nested classes/interfaces inherited from class org.eclipse.mcp.factory.ToolFactory
ToolFactory.ToolVisibilityListener
-
Constructor Summary
ConstructorsConstructorDescriptionMCPAnnotatedToolFactory
(Method method, MCPAnnotatedToolFactory.Tool toolAnnotation) -
Method Summary
Modifier and TypeMethodDescriptionapply
(McpSyncServerExchange exchange, McpSchema.CallToolRequest req) Simplistic method to transform a map of input arguments to a String[] responseCreate the definition for your tool.static ToolFactory[]
createToolFactories
(Class<?> c) static ToolFactory[]
createToolFactories
(Class<?>[] classes) getName()
boolean
isValid()
Methods inherited from class org.eclipse.mcp.factory.ToolFactory
addVisibilityListener, createSpec, isVisible, removeVisibilityListener, setVisibility
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.mcp.factory.IFactory
getId, getJsonSchemaJacksonOptions
-
Constructor Details
-
MCPAnnotatedToolFactory
-
-
Method Details
-
createToolFactories
- Throws:
MCPException
-
createToolFactories
- Throws:
MCPException
-
createInputSchema
-
createOutputSchema
-
getName
-
getDescription
-
isValid
public boolean isValid() -
createTool
Description copied from class:ToolFactory
Create the definition for your tool. see MCPAnnotatedToolFactory to automatically create tools from annotated Java methods- Specified by:
createTool
in classToolFactory
- Returns:
-
apply
public McpSchema.CallToolResult apply(McpSyncServerExchange exchange, McpSchema.CallToolRequest req) - Overrides:
apply
in classToolFactory
-
apply
Description copied from class:ToolFactory
Simplistic method to transform a map of input arguments to a String[] response- Specified by:
apply
in classToolFactory
- Parameters:
args
-- Returns:
- For simplistic responses return String or String[]
- Throws:
MCPException
-