File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -327,6 +327,40 @@ Map<String, Object> profile = client.getUserProfile(
327327
328328---
329329
330+ ## MCP (Model Context Protocol)
331+
332+ The Java SDK includes a built-in MCP endpoint client for gateway-hosted MCP sessions.
333+
334+ ``` java
335+ // Initialize an MCP session
336+ Map<String , Object > init = client. mcpInitialize(RequestOptions . defaults());
337+ System . out. println(init. get(" serverInfo" ));
338+
339+ // List available tools
340+ Map<String , Object > tools = client. mcpListTools(RequestOptions . defaults());
341+ List<?> toolList = (List<?> ) tools. get(" tools" );
342+ for (Object tool : toolList) {
343+ Map<?, ?> t = (Map<?, ?> ) tool;
344+ System . out. println(t. get(" name" ));
345+ }
346+
347+ // Call a tool
348+ Map<String , Object > result = client. mcpCallTool(
349+ " create_intent" ,
350+ Map . of(
351+ " intent_type" , " order.fulfillment.v1" ,
352+ " payload" , Map . of(" order_id" , " ord_123" ),
353+ " owner_agent" , " agent://fulfillment-service"
354+ ),
355+ RequestOptions . defaults()
356+ );
357+ System . out. println(result);
358+ ```
359+
360+ By default the SDK posts to ` /mcp ` . Override with ` mcpEndpointPath ` in client options.
361+
362+ ---
363+
330364## Repository Structure
331365
332366```
You can’t perform that action at this time.
0 commit comments