postMcp method
The agent endpoint: every subsystem's operations as MCP tools
Model Context Protocol over JSON-RPC 2.0 — one POST per message, stateless, protocol revision 2026-07-28. tools/list answers without a credential with one tool per subsystem (its operations in the "op" enum) plus "describe", which returns one operation's input schema. tools/call names a subsystem tool and carries {"op":
Parameters:
- MCPRequest mCPRequest:
Implementation
Future<MCPResponse?> postMcp({ MCPRequest? mCPRequest, }) async {
final response = await postMcpWithHttpInfo( mCPRequest: mCPRequest, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MCPResponse',) as MCPResponse;
}
return null;
}