{
  "openapi": "3.1.1",
  "info": {
    "title": "RavingDesk Ethereum EIP-1559 Gas Fee Estimator API",
    "version": "1.0.0",
    "summary": "Estimate an Ethereum transaction fee from gas used, base fee, max fee and priority tip (EIP-1559).",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://ravingdeskethgas.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Estimate an Ethereum transaction fee from gas used, base fee, max fee and priority tip (EIP-1559).",
        "description": "Applies the EIP-1559 fee rules to the numbers you enter: effective gas price (base fee plus a priority tip capped by the max fee), the estimated execution fee for the gas used and the maximum fee you authorise (gas limit × max fee), optionally converted at your own ETH price. It flags a max fee below the base fee. No network data is fetched; it is the gas estimator of the RavingDesk workspace.\n\nMethodology:\n- EIP-1559: the effective gas price is min(max fee, base fee + max priority fee). A transaction whose max fee is below the current base fee cannot be included until the base fee falls.\n- Estimated execution fee = gas used × effective gas price; the base-fee part (gas used × base fee) is burned and the rest is the validator tip.\n- Maximum fee = gas limit × max fee: the most the transaction can cost; unused gas is not charged.\n- 1 ETH = 10⁹ gwei. Quote amounts use the ETH price you enter. Layer-2 data fees, blob fees and the transferred value are not included.\n\nEstimate from your own numbers; base fees change every block and inclusion is not guaranteed. Not financial advice; no transaction is created or sent.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "ravingdesk_eth_gas",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RavingdeskEthGasInput"
              },
              "examples": {
                "example1": {
                  "summary": "Plain ETH transfer: 21,000 gas, base 30, max 50, tip 2 gwei, ETH at 3,000",
                  "value": {
                    "gasUsed": 21000,
                    "gasLimit": 30000,
                    "baseFeeGwei": 30,
                    "maxFeeGwei": 50,
                    "maxPriorityFeeGwei": 2,
                    "ethQuoteRate": 3000
                  }
                },
                "example2": {
                  "summary": "Token swap: 150,000 gas, limit 200,000, base 12 gwei",
                  "value": {
                    "gasUsed": 150000,
                    "gasLimit": 200000,
                    "baseFeeGwei": 12,
                    "maxFeeGwei": 20,
                    "maxPriorityFeeGwei": 1.5
                  }
                },
                "example3": {
                  "summary": "Max fee below the base fee: not includable",
                  "value": {
                    "gasUsed": 21000,
                    "gasLimit": 21000,
                    "baseFeeGwei": 40,
                    "maxFeeGwei": 35,
                    "maxPriorityFeeGwei": 2,
                    "ethQuoteRate": 3000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RavingdeskEthGasResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "RavingdeskEthGasInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "gasUsed": {
            "title": "Gas used",
            "description": "21,000 for a plain ETH transfer; contract calls use more.",
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000000,
            "default": 21000
          },
          "gasLimit": {
            "title": "Gas limit",
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000000,
            "default": 30000
          },
          "baseFeeGwei": {
            "title": "Base fee",
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "default": 30,
            "x-unit": "gwei"
          },
          "maxFeeGwei": {
            "title": "Max fee per gas",
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "default": 50,
            "x-unit": "gwei"
          },
          "maxPriorityFeeGwei": {
            "title": "Max priority fee (tip)",
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "default": 2,
            "x-unit": "gwei"
          },
          "ethQuoteRate": {
            "title": "Your ETH price (optional)",
            "description": "Quote-currency units per 1 ETH, e.g. 3000. Leave empty for ETH only.",
            "type": "number",
            "minimum": 1e-8,
            "maximum": 1000000000000
          }
        },
        "required": [
          "gasUsed",
          "gasLimit",
          "baseFeeGwei",
          "maxFeeGwei",
          "maxPriorityFeeGwei"
        ]
      },
      "RavingdeskEthGasResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "marketable",
              "effectiveGasPriceGwei",
              "estimatedFeeEth",
              "maximumFeeEth",
              "estimatedFeeQuote",
              "maximumFeeQuote",
              "burnedEth",
              "tipEth"
            ],
            "properties": {
              "marketable": {
                "type": "boolean"
              },
              "effectiveGasPriceGwei": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "estimatedFeeEth": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "maximumFeeEth": {
                "type": "number"
              },
              "estimatedFeeQuote": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "maximumFeeQuote": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "burnedEth": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "tipEth": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}