/* tslint:disable */
/* eslint-disable */
/**
 * RMI Backend
 * Rug Munch Intelligence — institutional-grade crypto intelligence API. 13+ chains, 96 data providers, 8 MCP tools, x402 paid tier, sovereign-first FOSS.
 *
 * The version of the OpenAPI document: 2026.06.21
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import * as runtime from '../runtime';
import {
    type HTTPValidationError,
    HTTPValidationErrorFromJSON,
    HTTPValidationErrorToJSON,
} from '../models/HTTPValidationError';
import {
    type JsonRpcRequest,
    JsonRpcRequestFromJSON,
    JsonRpcRequestToJSON,
} from '../models/JsonRpcRequest';

export interface DirectCallMcpCallToolIdPostRequest {
    toolId: string;
}

export interface JsonrpcHandlerMcpPostRequest {
    jsonRpcRequest: JsonRpcRequest;
}

/**
 * 
 */
export class McpApi extends runtime.BaseAPI {

    /**
     * Creates request options for directCallMcpCallToolIdPost without sending the request
     */
    async directCallMcpCallToolIdPostRequestOpts(requestParameters: DirectCallMcpCallToolIdPostRequest): Promise<runtime.RequestOpts> {
        if (requestParameters['toolId'] == null) {
            throw new runtime.RequiredError(
                'toolId',
                'Required parameter "toolId" was null or undefined when calling directCallMcpCallToolIdPost().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};


        let urlPath = `/mcp/call/{tool_id}`;
        urlPath = urlPath.replace('{tool_id}', encodeURIComponent(String(requestParameters['toolId'])));

        return {
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        };
    }

    /**
     * Direct tool execution (no JSON-RPC). For curl/scripts.
     * Direct Call
     */
    async directCallMcpCallToolIdPostRaw(requestParameters: DirectCallMcpCallToolIdPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: any; }>> {
        const requestOptions = await this.directCallMcpCallToolIdPostRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse<any>(response);
    }

    /**
     * Direct tool execution (no JSON-RPC). For curl/scripts.
     * Direct Call
     */
    async directCallMcpCallToolIdPost(requestParameters: DirectCallMcpCallToolIdPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: any; }> {
        const response = await this.directCallMcpCallToolIdPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for jsonrpcHandlerMcpPost without sending the request
     */
    async jsonrpcHandlerMcpPostRequestOpts(requestParameters: JsonrpcHandlerMcpPostRequest): Promise<runtime.RequestOpts> {
        if (requestParameters['jsonRpcRequest'] == null) {
            throw new runtime.RequiredError(
                'jsonRpcRequest',
                'Required parameter "jsonRpcRequest" was null or undefined when calling jsonrpcHandlerMcpPost().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';


        let urlPath = `/mcp`;

        return {
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: JsonRpcRequestToJSON(requestParameters['jsonRpcRequest']),
        };
    }

    /**
     * JSON-RPC 2.0 endpoint for MCP clients.  Methods:   - initialize           → returns server info   - tools/list            → returns tool catalog   - tools/call            → dispatches to backend   - resources/list        → empty   - prompts/list          → empty
     * Jsonrpc Handler
     */
    async jsonrpcHandlerMcpPostRaw(requestParameters: JsonrpcHandlerMcpPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: any; }>> {
        const requestOptions = await this.jsonrpcHandlerMcpPostRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse<any>(response);
    }

    /**
     * JSON-RPC 2.0 endpoint for MCP clients.  Methods:   - initialize           → returns server info   - tools/list            → returns tool catalog   - tools/call            → dispatches to backend   - resources/list        → empty   - prompts/list          → empty
     * Jsonrpc Handler
     */
    async jsonrpcHandlerMcpPost(requestParameters: JsonrpcHandlerMcpPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: any; }> {
        const response = await this.jsonrpcHandlerMcpPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for listToolsMcpToolsGet without sending the request
     */
    async listToolsMcpToolsGetRequestOpts(): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};


        let urlPath = `/mcp/tools`;

        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }

    /**
     * Plain JSON endpoint (for direct integration, no JSON-RPC).
     * List Tools
     */
    async listToolsMcpToolsGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: any; }>> {
        const requestOptions = await this.listToolsMcpToolsGetRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse<any>(response);
    }

    /**
     * Plain JSON endpoint (for direct integration, no JSON-RPC).
     * List Tools
     */
    async listToolsMcpToolsGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: any; }> {
        const response = await this.listToolsMcpToolsGetRaw(initOverrides);
        return await response.value();
    }

}
