Skip to content

v1.0.5-preview.1

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 30 Jun 08:48
91eaa4b

Feature: 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] @CopilotTool methods can declare ToolInvocation as a hidden injected parameter to access runtime context such as sessionId (#1832)
  • feature: [Java] rename @Param annotation to @CopilotToolParam (#1838)
  • feature: [Rust] add 9 GitHub-anchored variants to the Attachment enum (GitHubCommit, GitHubRelease, GitHubActionsJob, GitHubRepository, GitHubFileDiff, GitHubTreeComparison, GitHubUrl, GitHubFile, GitHubSnippet) (#1823)

New contributors

  • @pallaviraiturkar0 made their first contribution in #1823
  • @roji made their first contribution in #1827

Generated by Release Changelog Generator · sonnet46 1.5M