From ce4602f353e3846fe1fdd72376978fdedeb3893e Mon Sep 17 00:00:00 2001 From: geobelsky Date: Wed, 18 Mar 2026 11:17:01 +0000 Subject: [PATCH] feat: add sendIntent, Scenario, Health, MCP methods + bump to 0.1.2 New methods for feature parity with Python/TypeScript SDKs: - sendIntent (auto correlation_id) - applyScenario, validateScenario - health - mcpInitialize, mcpListTools, mcpCallTool Compile + tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 18 +++++ pom.xml | 2 +- src/main/java/dev/axme/sdk/AxmeClient.java | 77 ++++++++++++++++++++++ 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ab12e84 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,18 @@ +# Changelog + +## 0.1.2 (2026-03-18) + +### Features +- `sendIntent()` — convenience wrapper with auto-generated correlation_id +- `applyScenario()` — compile and submit scenario bundle +- `validateScenario()` — dry-run scenario validation +- `health()` — gateway health check +- `mcpInitialize()` — MCP protocol handshake +- `mcpListTools()` — list available MCP tools +- `mcpCallTool()` — invoke MCP tool + +## 0.1.1 (2026-03-13) + +- Initial alpha release with full AXME API coverage (84 methods) +- Intent lifecycle, inbox, webhooks, admin APIs +- Jackson JSON serialization, Java 11+ compatible diff --git a/pom.xml b/pom.xml index 0e4a6fc..e7dbfa8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ai.axme axme - 0.1.1 + 0.1.2 axme Official Java SDK for Axme APIs and workflows. https://github.com/AxmeAI/axme-sdk-java diff --git a/src/main/java/dev/axme/sdk/AxmeClient.java b/src/main/java/dev/axme/sdk/AxmeClient.java index 01dd77a..b3c38d3 100644 --- a/src/main/java/dev/axme/sdk/AxmeClient.java +++ b/src/main/java/dev/axme/sdk/AxmeClient.java @@ -11,6 +11,7 @@ import java.nio.charset.StandardCharsets; import java.util.LinkedHashMap; import java.util.Map; +import java.util.UUID; public final class AxmeClient { private final String baseUrl; @@ -656,6 +657,82 @@ public Map getBillingInvoice(String invoiceId, RequestOptions op return requestJson("GET", "/v1/billing/invoices/" + invoiceId, Map.of(), null, normalizeOptions(options)); } + public String sendIntent(Map payload, RequestOptions options) + throws IOException, InterruptedException { + Map body = new LinkedHashMap<>(payload); + if (!body.containsKey("correlation_id")) { + body.put("correlation_id", UUID.randomUUID().toString()); + } + Map result = createIntent(body, options); + return (String) result.get("intent_id"); + } + + public Map applyScenario(Map bundle, RequestOptions options) + throws IOException, InterruptedException { + return requestJson("POST", "/v1/scenarios/apply", Map.of(), bundle, normalizeOptions(options)); + } + + public Map validateScenario(Map bundle, RequestOptions options) + throws IOException, InterruptedException { + return requestJson("POST", "/v1/scenarios/validate", Map.of(), bundle, normalizeOptions(options)); + } + + public Map health(RequestOptions options) + throws IOException, InterruptedException { + return requestJson("GET", "/v1/health", Map.of(), null, normalizeOptions(options)); + } + + @SuppressWarnings("unchecked") + public Map mcpInitialize(RequestOptions options) + throws IOException, InterruptedException { + Map rpcRequest = new LinkedHashMap<>(); + rpcRequest.put("jsonrpc", "2.0"); + rpcRequest.put("id", UUID.randomUUID().toString()); + rpcRequest.put("method", "initialize"); + rpcRequest.put("params", Map.of()); + Map response = requestJson("POST", "/mcp", Map.of(), rpcRequest, normalizeOptions(options)); + if (response.containsKey("error")) { + throw new AxmeHttpException(0, String.valueOf(response.get("error"))); + } + Object result = response.get("result"); + return result instanceof Map ? (Map) result : response; + } + + @SuppressWarnings("unchecked") + public Map mcpListTools(RequestOptions options) + throws IOException, InterruptedException { + Map rpcRequest = new LinkedHashMap<>(); + rpcRequest.put("jsonrpc", "2.0"); + rpcRequest.put("id", UUID.randomUUID().toString()); + rpcRequest.put("method", "tools/list"); + rpcRequest.put("params", Map.of()); + Map response = requestJson("POST", "/mcp", Map.of(), rpcRequest, normalizeOptions(options)); + if (response.containsKey("error")) { + throw new AxmeHttpException(0, String.valueOf(response.get("error"))); + } + Object result = response.get("result"); + return result instanceof Map ? (Map) result : response; + } + + @SuppressWarnings("unchecked") + public Map mcpCallTool(String name, Map arguments, RequestOptions options) + throws IOException, InterruptedException { + Map params = new LinkedHashMap<>(); + params.put("name", name); + params.put("arguments", arguments != null ? arguments : Map.of()); + Map rpcRequest = new LinkedHashMap<>(); + rpcRequest.put("jsonrpc", "2.0"); + rpcRequest.put("id", UUID.randomUUID().toString()); + rpcRequest.put("method", "tools/call"); + rpcRequest.put("params", params); + Map response = requestJson("POST", "/mcp", Map.of(), rpcRequest, normalizeOptions(options)); + if (response.containsKey("error")) { + throw new AxmeHttpException(0, String.valueOf(response.get("error"))); + } + Object result = response.get("result"); + return result instanceof Map ? (Map) result : response; + } + private Map requestJson( String method, String path,