Skip to content

Commit 910a4fc

Browse files
George-iamclaude
andauthored
feat: add sendIntent, Scenario, Health, MCP methods + bump to 0.1.2 (#18)
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) <noreply@anthropic.com>
1 parent ba91f77 commit 910a4fc

3 files changed

Lines changed: 96 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
## 0.1.2 (2026-03-18)
4+
5+
### Features
6+
- `sendIntent()` — convenience wrapper with auto-generated correlation_id
7+
- `applyScenario()` — compile and submit scenario bundle
8+
- `validateScenario()` — dry-run scenario validation
9+
- `health()` — gateway health check
10+
- `mcpInitialize()` — MCP protocol handshake
11+
- `mcpListTools()` — list available MCP tools
12+
- `mcpCallTool()` — invoke MCP tool
13+
14+
## 0.1.1 (2026-03-13)
15+
16+
- Initial alpha release with full AXME API coverage (84 methods)
17+
- Intent lifecycle, inbox, webhooks, admin APIs
18+
- Jackson JSON serialization, Java 11+ compatible

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>ai.axme</groupId>
88
<artifactId>axme</artifactId>
9-
<version>0.1.1</version>
9+
<version>0.1.2</version>
1010
<name>axme</name>
1111
<description>Official Java SDK for Axme APIs and workflows.</description>
1212
<url>https://github.com/AxmeAI/axme-sdk-java</url>

src/main/java/dev/axme/sdk/AxmeClient.java

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.nio.charset.StandardCharsets;
1212
import java.util.LinkedHashMap;
1313
import java.util.Map;
14+
import java.util.UUID;
1415

1516
public final class AxmeClient {
1617
private final String baseUrl;
@@ -656,6 +657,82 @@ public Map<String, Object> getBillingInvoice(String invoiceId, RequestOptions op
656657
return requestJson("GET", "/v1/billing/invoices/" + invoiceId, Map.of(), null, normalizeOptions(options));
657658
}
658659

660+
public String sendIntent(Map<String, Object> payload, RequestOptions options)
661+
throws IOException, InterruptedException {
662+
Map<String, Object> body = new LinkedHashMap<>(payload);
663+
if (!body.containsKey("correlation_id")) {
664+
body.put("correlation_id", UUID.randomUUID().toString());
665+
}
666+
Map<String, Object> result = createIntent(body, options);
667+
return (String) result.get("intent_id");
668+
}
669+
670+
public Map<String, Object> applyScenario(Map<String, Object> bundle, RequestOptions options)
671+
throws IOException, InterruptedException {
672+
return requestJson("POST", "/v1/scenarios/apply", Map.of(), bundle, normalizeOptions(options));
673+
}
674+
675+
public Map<String, Object> validateScenario(Map<String, Object> bundle, RequestOptions options)
676+
throws IOException, InterruptedException {
677+
return requestJson("POST", "/v1/scenarios/validate", Map.of(), bundle, normalizeOptions(options));
678+
}
679+
680+
public Map<String, Object> health(RequestOptions options)
681+
throws IOException, InterruptedException {
682+
return requestJson("GET", "/v1/health", Map.of(), null, normalizeOptions(options));
683+
}
684+
685+
@SuppressWarnings("unchecked")
686+
public Map<String, Object> mcpInitialize(RequestOptions options)
687+
throws IOException, InterruptedException {
688+
Map<String, Object> rpcRequest = new LinkedHashMap<>();
689+
rpcRequest.put("jsonrpc", "2.0");
690+
rpcRequest.put("id", UUID.randomUUID().toString());
691+
rpcRequest.put("method", "initialize");
692+
rpcRequest.put("params", Map.of());
693+
Map<String, Object> response = requestJson("POST", "/mcp", Map.of(), rpcRequest, normalizeOptions(options));
694+
if (response.containsKey("error")) {
695+
throw new AxmeHttpException(0, String.valueOf(response.get("error")));
696+
}
697+
Object result = response.get("result");
698+
return result instanceof Map ? (Map<String, Object>) result : response;
699+
}
700+
701+
@SuppressWarnings("unchecked")
702+
public Map<String, Object> mcpListTools(RequestOptions options)
703+
throws IOException, InterruptedException {
704+
Map<String, Object> rpcRequest = new LinkedHashMap<>();
705+
rpcRequest.put("jsonrpc", "2.0");
706+
rpcRequest.put("id", UUID.randomUUID().toString());
707+
rpcRequest.put("method", "tools/list");
708+
rpcRequest.put("params", Map.of());
709+
Map<String, Object> response = requestJson("POST", "/mcp", Map.of(), rpcRequest, normalizeOptions(options));
710+
if (response.containsKey("error")) {
711+
throw new AxmeHttpException(0, String.valueOf(response.get("error")));
712+
}
713+
Object result = response.get("result");
714+
return result instanceof Map ? (Map<String, Object>) result : response;
715+
}
716+
717+
@SuppressWarnings("unchecked")
718+
public Map<String, Object> mcpCallTool(String name, Map<String, Object> arguments, RequestOptions options)
719+
throws IOException, InterruptedException {
720+
Map<String, Object> params = new LinkedHashMap<>();
721+
params.put("name", name);
722+
params.put("arguments", arguments != null ? arguments : Map.of());
723+
Map<String, Object> rpcRequest = new LinkedHashMap<>();
724+
rpcRequest.put("jsonrpc", "2.0");
725+
rpcRequest.put("id", UUID.randomUUID().toString());
726+
rpcRequest.put("method", "tools/call");
727+
rpcRequest.put("params", params);
728+
Map<String, Object> response = requestJson("POST", "/mcp", Map.of(), rpcRequest, normalizeOptions(options));
729+
if (response.containsKey("error")) {
730+
throw new AxmeHttpException(0, String.valueOf(response.get("error")));
731+
}
732+
Object result = response.get("result");
733+
return result instanceof Map ? (Map<String, Object>) result : response;
734+
}
735+
659736
private Map<String, Object> requestJson(
660737
String method,
661738
String path,

0 commit comments

Comments
 (0)