Initial library commit
This commit was merged in pull request #2.
This commit is contained in:
20
src/main/java/mcp/tools/DefaultMcpTool.java
Normal file
20
src/main/java/mcp/tools/DefaultMcpTool.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package mcp.tools;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation to mark an {@link McpTool} for automatic discovery and registration.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface DefaultMcpTool {
|
||||
/**
|
||||
* Whether this tool is enabled for automatic registration.
|
||||
*
|
||||
* @return true if enabled, false otherwise.
|
||||
*/
|
||||
boolean enabled() default true;
|
||||
}
|
||||
18
src/main/java/mcp/tools/McpTool.java
Normal file
18
src/main/java/mcp/tools/McpTool.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package mcp.tools;
|
||||
|
||||
import io.modelcontextprotocol.spec.McpSchema;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Interface for implementing MCP tools.
|
||||
* <p>
|
||||
* Implementations must have a public no-args constructor if they are to be
|
||||
* discovered automatically via {@link DefaultMcpTool}.
|
||||
*/
|
||||
public interface McpTool {
|
||||
String name();
|
||||
String description();
|
||||
String schema();
|
||||
McpSchema.CallToolResult call(McpSchema.CallToolRequest request, Map<String, Object> arguments);
|
||||
}
|
||||
Reference in New Issue
Block a user