Class ToolResults
java.lang.Object
eu.mrapik.minecraftservermcp.util.ToolResults
JSON envelopes for MCP
McpSchema.CallToolResult payloads and for resource bodies that reuse the same shape.
Each tool result uses one text part whose body is UTF-8 JSON with schemaVersion, success,
and either data or error.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intVersion number incremented when the envelope fields or semantics change. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringenvelopeErr(String message) JSON string for an error envelope.static StringenvelopeOk(Object data) JSON string for a successful envelope (e.g.static io.modelcontextprotocol.spec.McpSchema.CallToolResultError tool result: JSON text body withisError(true).static io.modelcontextprotocol.spec.McpSchema.CallToolResultSuccessful tool result: JSON text body withisError(false).
-
Field Details
-
SCHEMA_VERSION
public static final int SCHEMA_VERSIONVersion number incremented when the envelope fields or semantics change.- See Also:
-
-
Method Details
-
ok
Successful tool result: JSON text body withisError(false).- Parameters:
data- JSON-serializable value (map, list, string, etc.)- Returns:
- MCP call result
-
err
Error tool result: JSON text body withisError(true).- Parameters:
message- human-readable error- Returns:
- MCP call result
-
envelopeOk
JSON string for a successful envelope (e.g. MCP resource bodies).- Parameters:
data- payload underdata- Returns:
- UTF-8 JSON text
-
envelopeErr
JSON string for an error envelope.- Parameters:
message- error description- Returns:
- UTF-8 JSON text
-