{
  "openapi": "3.1.1",
  "info": {
    "title": "Error Message Translator API",
    "version": "1.0.0",
    "summary": "Paste a technical error and get the plain-English cause and troubleshooting steps.",
    "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://errormessagetranslator.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Paste a technical error and get the plain-English cause and troubleshooting steps.",
        "description": "Matches your error message against a database of over 120 known errors (HTTP status codes, TLS/certificate, DNS, network, filesystem, Node.js, Python, Java, npm, pip, git, Docker, SQL and Windows codes), explains the cause in plain English and fills the concrete file, host, port or package from your message into the steps.\n\nMethodology:\n- Every pattern is a regular expression with a specificity score from 1 (generic, e.g. \"permission denied\") to 10 (one exact error code).\n- All matching patterns are ranked by specificity, then by how early in the message they match; the top one is explained, the rest are listed.\n- If you pick a context, patterns from matching categories get +2 specificity when ranking.\n- Concrete values (URL, host, port, path, module, package, status/error code) are extracted from the message and inserted into the steps.\n- No match → generic triage steps; nothing is guessed.",
        "tags": [
          "internet"
        ],
        "x-mcp-tool": "error_message_translator",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ErrorMessageTranslatorInput"
              },
              "examples": {
                "example1": {
                  "summary": "Database refused connection",
                  "value": {
                    "message": "Error: connect ECONNREFUSED 127.0.0.1:5432\n    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)",
                    "context": "code"
                  }
                },
                "example2": {
                  "summary": "Python missing module",
                  "value": {
                    "message": "Traceback (most recent call last):\n  File \"app.py\", line 1, in <module>\n    import requests\nModuleNotFoundError: No module named 'requests'",
                    "context": "terminal"
                  }
                },
                "example3": {
                  "summary": "Browser 502",
                  "value": {
                    "message": "502 Bad Gateway nginx/1.24.0",
                    "context": "browser"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorMessageTranslatorResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "ErrorMessageTranslatorInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "message": {
            "title": "Error message",
            "type": "string",
            "maxLength": 20000
          },
          "context": {
            "title": "Where did you see it?",
            "type": "string",
            "enum": [
              "any",
              "browser",
              "terminal",
              "windows",
              "code"
            ],
            "default": "any"
          }
        },
        "required": [
          "message"
        ]
      },
      "ErrorMessageTranslatorResult": {
        "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": [
              "matched",
              "primary",
              "otherMatches",
              "variables",
              "patternCount"
            ],
            "properties": {
              "matched": {
                "type": "boolean"
              },
              "patternCount": {
                "type": "integer"
              },
              "variables": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "primary": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "id",
                  "title",
                  "category",
                  "severity",
                  "specificity",
                  "matchedText",
                  "cause",
                  "likelyCauses",
                  "steps"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "category": {
                    "type": "string"
                  },
                  "severity": {
                    "type": "string",
                    "enum": [
                      "low",
                      "medium",
                      "high",
                      "critical"
                    ]
                  },
                  "specificity": {
                    "type": "integer"
                  },
                  "matchedText": {
                    "type": "string"
                  },
                  "cause": {
                    "type": "string"
                  },
                  "likelyCauses": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "steps": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "otherMatches": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "id",
                    "title",
                    "category",
                    "specificity",
                    "matchedText"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "category": {
                      "type": "string"
                    },
                    "specificity": {
                      "type": "integer"
                    },
                    "matchedText": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}