v1.0.5-preview.1
Pre-releaseFeature: MCP OAuth host token callbacks
When a Copilot session connects to an OAuth-protected MCP server, the SDK now calls back to your application to supply OAuth tokens. Register an onMcpAuthRequest handler in the session config to provide tokens or cancel the request. (#1669)
const session = await client.startSession({
onMcpAuthRequest: async (request) => {
const token = await myOAuthFlow(request.serverUrl, request.reason);
return token ? { kind: "token", accessToken: token } : { kind: "cancelled" };
},
});var session = await client.StartSessionAsync(new SessionConfig
{
OnMcpAuthRequest = async (ctx) =>
{
var token = await MyOAuthFlow(ctx.ServerUrl, ctx.Reason);
return token is not null
? McpAuthResult.FromToken(new McpAuthToken { AccessToken = token })
: McpAuthResult.Cancel();
},
});Feature: sessionId in BYOK bearer-token callback; field renamed to bearerTokenProvider
The BYOK config field has been renamed from getBearerToken to bearerTokenProvider across all SDKs. The callback now also receives a sessionId, so a single callback shared across multiple sessions can scope token acquisition or caching per session. (#1796)
const client = new CopilotClient({
provider: {
bearerTokenProvider: async ({ providerName, sessionId }) => {
return await getTokenForSession(sessionId);
},
},
});var client = new CopilotClient(new CopilotClientConfig
{
Provider = new ProviderConfig
{
BearerTokenProvider = async (args) => await GetTokenForSession(args.SessionId),
},
});Feature: Java @CopilotTool annotation-based tool definition
Java applications can now define Copilot tools by annotating methods with @CopilotTool and @CopilotToolParam instead of building ToolDefinition objects manually. A compile-time annotation processor generates the metadata, and ToolDefinition.fromObject() registers all annotated methods at once. (#1792)
`@CopilotTool`("Get the current weather for a given city")
public String getWeather(
`@CopilotToolParam`(value = "The city", required = true) String city,
`@CopilotToolParam`(value = "Unit: celsius or fahrenheit", defaultValue = "celsius") String unit) {
return fetchWeather(city, unit);
}List<ToolDefinition> tools = ToolDefinition.fromObject(new WeatherTools());Other changes
- feature: [Java]
@CopilotToolmethods can declareToolInvocationas a hidden injected parameter to access runtime context such assessionId(#1832) - feature: [Java] rename
@Paramannotation to@CopilotToolParam(#1838) - feature: [Rust] add 9 GitHub-anchored variants to the
Attachmentenum (GitHubCommit,GitHubRelease,GitHubActionsJob,GitHubRepository,GitHubFileDiff,GitHubTreeComparison,GitHubUrl,GitHubFile,GitHubSnippet) (#1823)
New contributors
@pallaviraiturkar0made their first contribution in #1823@rojimade their first contribution in #1827
Generated by Release Changelog Generator · sonnet46 1.5M