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 @interfacestatic @interfaceNested 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()booleanisValid()Methods inherited from class org.eclipse.mcp.factory.ToolFactory
addVisibilityListener, createSpec, isVisible, removeVisibilityListener, setVisibilityMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:ToolFactoryCreate the definition for your tool. see MCPAnnotatedToolFactory to automatically create tools from annotated Java methods- Specified by:
createToolin classToolFactory- Returns:
-
apply
public McpSchema.CallToolResult apply(McpSyncServerExchange exchange, McpSchema.CallToolRequest req) - Overrides:
applyin classToolFactory
-
apply
Description copied from class:ToolFactorySimplistic method to transform a map of input arguments to a String[] response- Specified by:
applyin classToolFactory- Parameters:
args-- Returns:
- For simplistic responses return String or String[]
- Throws:
MCPException
-