MCP Client SDK

MCP Server SDK

Misc

Working with Tools

The tool system in AJ MCP provides a structured way to define callable functions that clients can discover and invoke. Each tool has a name, description, and a JSON Schema that defines its expected input parameters. The tool system is designed to make it easy for LLMs to understand what tools are available and how to use them.

Listing Tools

To list available tools:

List<ToolItem> tools = mcpClient.listTools();
assertEquals(7, tools.size());

Calling Tools

To call a tool:

String toolExecutionResultString = mcpClient.callTool("echoString", "{\"input\": \"hi\"}");
assertEquals("hi", toolExecutionResultString);

The callTool() method returns a CallToolResult containing the tool's response, which may include text, images, or other content types.