{
  "openapi": "3.1.0",
  "info": {
    "title": "Geoapify MCP Geocode Address Tool",
    "version": "0.1.0",
    "description": "OpenAPI specification for calling the Geoapify MCP geocode_address tool through the JSON-RPC endpoint."
  },
  "servers": [
    {
      "url": "https://api.geoapify.com/v1"
    }
  ],
  "tags": [
    {
      "name": "MCP Geocode Address",
      "description": "OpenAPI specification for calling the Geoapify MCP geocode_address tool through the JSON-RPC endpoint."
    }
  ],
  "paths": {
    "/mcp": {
      "post": {
        "tags": [
          "MCP Geocode Address"
        ],
        "operationId": "callMcpGeocodeAddress",
        "summary": "Call the geocode_address MCP tool",
        "description": "Call the geocode_address MCP tool with a JSON-RPC tools/call request.",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "description": "Your Geoapify API key. You can sign up and obtain an API key for free at https://myprojects.geoapify.com/.",
            "schema": {
              "type": "string",
              "example": "YOUR_API_KEY"
            }
          }
        ],
        "requestBody": {
          "description": "JSON-RPC request body for the geocode_address MCP tool.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeocodeAddressToolCallRequest"
              },
              "example": {
                "jsonrpc": "2.0",
                "id": 2,
                "method": "tools/call",
                "params": {
                  "name": "geocode_address",
                  "arguments": {
                    "query": "Berlin",
                    "limit": 1,
                    "lang": "en"
                  }
                }
              },
              "examples": {
                "geocodeAddress": {
                  "summary": "Geocode address",
                  "description": "Converts a street address or free-text location query into coordinates and structured address data.",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 2,
                    "method": "tools/call",
                    "params": {
                      "name": "geocode_address",
                      "arguments": {
                        "query": "Berlin",
                        "limit": 1,
                        "lang": "en"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response for the MCP tool call.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ToolCallResponse"
                    },
                    {
                      "$ref": "#/components/schemas/JsonRpcErrorResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload or tool arguments."
          },
          "401": {
            "description": "Missing or invalid Geoapify API key."
          },
          "429": {
            "description": "Rate limit or quota exceeded."
          },
          "500": {
            "description": "Internal gateway error."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "GeocodeAddressToolCallRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "jsonrpc",
          "id",
          "method",
          "params"
        ],
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "$ref": "#/components/schemas/JsonRpcId"
          },
          "method": {
            "const": "tools/call"
          },
          "params": {
            "$ref": "#/components/schemas/GeocodeAddressToolCallParams"
          }
        },
        "examples": [
          {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "tools/call",
            "params": {
              "name": "geocode_address",
              "arguments": {
                "query": "Berlin"
              }
            }
          }
        ],
        "x-geoapify-mcp-tool": "geocode_address",
        "x-geoapify-mcp-category": "Geocoding",
        "x-geoapify-mcp-input-schema": "#/components/schemas/GeocodeAddressInput"
      },
      "JsonRpcId": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ]
      },
      "GeocodeAddressToolCallParams": {
        "title": "Geocode address tool call params",
        "description": "Parameters for calling the `geocode_address` MCP tool.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "arguments"
        ],
        "properties": {
          "name": {
            "description": "MCP tool name.",
            "const": "geocode_address"
          },
          "arguments": {
            "description": "Arguments accepted by the `geocode_address` tool.",
            "$ref": "#/components/schemas/GeocodeAddressInput"
          }
        }
      },
      "GeocodeAddressInput": {
        "title": "Geocode address arguments",
        "description": "Arguments for the `geocode_address` MCP tool.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "query"
        ],
        "properties": {
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "Street address or free-text location query to geocode."
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 5,
            "description": "Maximum number of results to return."
          },
          "lang": {
            "type": "string",
            "default": "en",
            "description": "Result language as a supported two-letter language code."
          },
          "country_codes": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "type": "string",
              "enum": [
                "ad",
                "ae",
                "af",
                "ag",
                "ai",
                "al",
                "am",
                "an",
                "ao",
                "ap",
                "aq",
                "ar",
                "as",
                "at",
                "au",
                "aw",
                "az",
                "ba",
                "bb",
                "bd",
                "be",
                "bf",
                "bg",
                "bh",
                "bi",
                "bj",
                "bm",
                "bn",
                "bo",
                "br",
                "bs",
                "bt",
                "bv",
                "bw",
                "by",
                "bz",
                "ca",
                "cc",
                "cd",
                "cf",
                "cg",
                "ch",
                "ci",
                "ck",
                "cl",
                "cm",
                "cn",
                "co",
                "cr",
                "cu",
                "cv",
                "cx",
                "cy",
                "cz",
                "de",
                "dj",
                "dk",
                "dm",
                "do",
                "dz",
                "ec",
                "ee",
                "eg",
                "eh",
                "er",
                "es",
                "et",
                "eu",
                "fi",
                "fj",
                "fk",
                "fm",
                "fo",
                "fr",
                "ga",
                "gb",
                "gd",
                "ge",
                "gf",
                "gg",
                "gh",
                "gi",
                "gl",
                "gm",
                "gn",
                "gp",
                "gq",
                "gr",
                "gs",
                "gt",
                "gu",
                "gw",
                "gy",
                "hk",
                "hm",
                "hn",
                "hr",
                "ht",
                "hu",
                "id",
                "ie",
                "im",
                "il",
                "in",
                "io",
                "iq",
                "ir",
                "is",
                "it",
                "je",
                "jm",
                "jo",
                "jp",
                "ke",
                "kg",
                "kh",
                "ki",
                "km",
                "kn",
                "kp",
                "kr",
                "kw",
                "ky",
                "kz",
                "la",
                "lb",
                "lc",
                "li",
                "lk",
                "lr",
                "ls",
                "lt",
                "lu",
                "lv",
                "ly",
                "ma",
                "mc",
                "md",
                "me",
                "mg",
                "mh",
                "mk",
                "ml",
                "mm",
                "mn",
                "mo",
                "mp",
                "mq",
                "mr",
                "ms",
                "mt",
                "mu",
                "mv",
                "mw",
                "mx",
                "my",
                "mz",
                "na",
                "nc",
                "ne",
                "nf",
                "ng",
                "ni",
                "nl",
                "no",
                "np",
                "nr",
                "nu",
                "nz",
                "om",
                "pa",
                "pe",
                "pf",
                "pg",
                "ph",
                "pk",
                "pl",
                "pm",
                "pr",
                "ps",
                "pt",
                "pw",
                "py",
                "qa",
                "re",
                "ro",
                "rs",
                "ru",
                "rw",
                "sa",
                "sb",
                "sc",
                "sd",
                "se",
                "sg",
                "sh",
                "si",
                "sj",
                "sk",
                "sl",
                "sm",
                "sn",
                "so",
                "sr",
                "st",
                "sv",
                "sy",
                "sz",
                "tc",
                "td",
                "tf",
                "tg",
                "th",
                "tj",
                "tk",
                "tm",
                "tn",
                "to",
                "tr",
                "tt",
                "tv",
                "tw",
                "tz",
                "ua",
                "ug",
                "um",
                "us",
                "uy",
                "uz",
                "va",
                "vc",
                "ve",
                "vg",
                "vi",
                "vn",
                "vu",
                "wf",
                "ws",
                "ye",
                "yt",
                "za",
                "zm",
                "zw"
              ]
            },
            "description": "Optional ISO 3166-1 alpha-2 country code filters."
          }
        }
      },
      "ToolCallResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "jsonrpc",
          "id",
          "result"
        ],
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "$ref": "#/components/schemas/JsonRpcId"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "content",
              "structuredContent",
              "isError"
            ],
            "properties": {
              "content": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "type",
                    "text"
                  ],
                  "properties": {
                    "type": {
                      "const": "text"
                    },
                    "text": {
                      "type": "string"
                    }
                  }
                }
              },
              "structuredContent": true,
              "isError": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "JsonRpcErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "jsonrpc",
          "id",
          "error"
        ],
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "$ref": "#/components/schemas/JsonRpcId"
          },
          "error": {
            "$ref": "#/components/schemas/JsonRpcError"
          }
        }
      },
      "JsonRpcError": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "data": true
        }
      }
    }
  }
}
