Annotation Interface CopilotTool
Marks a method as a Copilot tool. The annotated method will be exposed to the
model as a callable tool during a session.
Example usage:
@CopilotTool("Get weather for a location")
public CompletableFuture<String> getWeather(
@CopilotToolParam(value = "City name", required = true) String location) {
return CompletableFuture.completedFuture("Sunny in " + location);
}
- Since:
- 1.0.2
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceA single metadata key/value pair.static @interfaceA single named boolean flag within aCopilotTool.MetadataValue.flags()map.static @interfaceA metadata value. -
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionDefer configuration for this tool.Opaque, host-defined metadata for this tool.Tool name.booleanWhether this tool overrides a built-in tool.booleanWhether to skip permission checks.
-
Element Details
-
value
String valueTool description (sent to the model). -
name
-
overridesBuiltInTool
boolean overridesBuiltInToolWhether this tool overrides a built-in tool.- Default:
false
-
skipPermission
boolean skipPermissionWhether to skip permission checks.- Default:
false
-
defer
-
metadata
CopilotTool.MetadataEntry[] metadataOpaque, host-defined metadata for this tool. Keys are namespaced and not part of the stable public API; specific keys may be recognized to inform host-specific behavior.Because annotation members cannot express arbitrary maps, this uses a deliberately shallow representation: each
CopilotTool.MetadataEntrymaps a string key to a singleCopilotTool.MetadataValuethat is either a boolean, a string, or a one-level map of named booleanflags. Numbers, arrays, and deeper nesting are not supported here; use the programmaticToolDefinition.createWithMetadata(...)/ToolDefinition.metadata(...)API for richer values.Example emitted shape:
Map.of("github.com/copilot:safeForTelemetry", Map.of("name", true, "inputsNames", false))- Default:
{}
-