{
  "openapi": "3.0.0",
  "info": {
    "title": "Mock Petstore API",
    "version": "4.0.0",
    "description": "Comprehensive Petstore API with Durable Objects + SQLite storage. Data persists across requests and resets every hour. Supports full CRUD operations for pets, orders, and users. Includes 20+ endpoints for testing MCP conversions."
  },
  "servers": [
    {
      "url": "https://petstore-mock.fastserve.dev"
    }
  ],
  "paths": {
    "/pets": {
      "get": {
        "operationId": "listAllPets",
        "summary": "List all pets",
        "tags": [
          "pet"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Pet"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "addPet",
        "summary": "Add a new pet to the store",
        "tags": [
          "pet"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Pet"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Pet created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pet"
                }
              }
            }
          }
        }
      }
    },
    "/pets/findByStatus": {
      "get": {
        "operationId": "findPetsByStatus",
        "summary": "Finds Pets by status",
        "tags": [
          "pet"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "available",
                "pending",
                "sold"
              ],
              "default": "available"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Pet"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/pets/findByTags": {
      "get": {
        "operationId": "findPetsByTags",
        "summary": "Finds Pets by tags",
        "tags": [
          "pet"
        ],
        "parameters": [
          {
            "name": "tags",
            "in": "query",
            "description": "Tags to filter by (comma-separated)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Pet"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/pets/search": {
      "get": {
        "operationId": "searchPets",
        "summary": "Search pets by name",
        "tags": [
          "pet"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Search query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Pet"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/pets/category/{categoryName}": {
      "get": {
        "operationId": "findPetsByCategory",
        "summary": "Find pets by category",
        "tags": [
          "pet"
        ],
        "parameters": [
          {
            "name": "categoryName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Pet"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/pets/random": {
      "get": {
        "operationId": "getRandomPet",
        "summary": "Get a random available pet",
        "tags": [
          "pet"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pet"
                }
              }
            }
          },
          "404": {
            "description": "No available pets"
          }
        }
      }
    },
    "/pets/surprise": {
      "get": {
        "operationId": "getSurprisePet",
        "summary": "Get a surprise random pet",
        "description": "Returns a randomly selected pet as a fun surprise! Perfect for discovering new pets in our store.",
        "tags": [
          "pet"
        ],
        "responses": {
          "200": {
            "description": "A random pet selected just for you",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pet"
                }
              }
            }
          }
        }
      }
    },
    "/pets/{petId}": {
      "get": {
        "operationId": "getPetById",
        "summary": "Find pet by ID",
        "tags": [
          "pet"
        ],
        "parameters": [
          {
            "name": "petId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pet"
                }
              }
            }
          },
          "404": {
            "description": "Pet not found"
          }
        }
      },
      "put": {
        "operationId": "updatePet",
        "summary": "Update an existing pet",
        "tags": [
          "pet"
        ],
        "parameters": [
          {
            "name": "petId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Pet"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pet updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pet"
                }
              }
            }
          },
          "404": {
            "description": "Pet not found"
          }
        }
      },
      "delete": {
        "operationId": "deletePet",
        "summary": "Deletes a pet",
        "tags": [
          "pet"
        ],
        "parameters": [
          {
            "name": "petId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pet deleted successfully"
          },
          "404": {
            "description": "Pet not found"
          }
        }
      }
    },
    "/analytics/inventory": {
      "get": {
        "operationId": "getInventory",
        "summary": "Returns pet inventories by status",
        "tags": [
          "store"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/orders": {
      "get": {
        "operationId": "getOrders",
        "summary": "Get all orders with optional status filter",
        "tags": [
          "store"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "placed",
                "approved",
                "delivered"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Order"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "placeOrder",
        "summary": "Place an order for a pet",
        "tags": [
          "store"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Order"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Order placed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          }
        }
      }
    },
    "/orders/{orderId}": {
      "get": {
        "operationId": "getOrderById",
        "summary": "Find purchase order by ID",
        "tags": [
          "store"
        ],
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "404": {
            "description": "Order not found"
          }
        }
      },
      "delete": {
        "operationId": "deleteOrder",
        "summary": "Delete purchase order by ID",
        "tags": [
          "store"
        ],
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Order deleted successfully"
          },
          "404": {
            "description": "Order not found"
          }
        }
      }
    },
    "/users": {
      "post": {
        "operationId": "createUser",
        "summary": "Create user",
        "tags": [
          "user"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/User"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "User created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          }
        }
      }
    },
    "/users/{username}": {
      "get": {
        "operationId": "getUserByName",
        "summary": "Get user by username",
        "tags": [
          "user"
        ],
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "404": {
            "description": "User not found"
          }
        }
      }
    },
    "/analytics/stats": {
      "get": {
        "operationId": "getStatistics",
        "summary": "Get overall statistics including reset info",
        "tags": [
          "analytics"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "totalPets": {
                      "type": "integer"
                    },
                    "totalOrders": {
                      "type": "integer"
                    },
                    "totalUsers": {
                      "type": "integer"
                    },
                    "availablePets": {
                      "type": "integer"
                    },
                    "resetInfo": {
                      "type": "object",
                      "properties": {
                        "lastReset": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "nextReset": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/errors/bad-request": {
      "get": {
        "operationId": "testBadRequest",
        "summary": "Test 400 Bad Request error",
        "tags": [
          "errors"
        ],
        "description": "Returns a 400 error to test parameter validation handling",
        "responses": {
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/errors/unauthorized": {
      "get": {
        "operationId": "testUnauthorized",
        "summary": "Test 401 Unauthorized error",
        "tags": [
          "errors"
        ],
        "description": "Returns a 401 error to test authentication handling",
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/errors/forbidden": {
      "get": {
        "operationId": "testForbidden",
        "summary": "Test 403 Forbidden error",
        "tags": [
          "errors"
        ],
        "description": "Returns a 403 error to test authorization handling",
        "responses": {
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/errors/not-found": {
      "get": {
        "operationId": "testNotFound",
        "summary": "Test 404 Not Found error",
        "tags": [
          "errors"
        ],
        "description": "Returns a 404 error to test resource not found handling",
        "responses": {
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/errors/rate-limit": {
      "get": {
        "operationId": "testRateLimit",
        "summary": "Test 429 Rate Limit error",
        "tags": [
          "errors"
        ],
        "description": "Returns a 429 error with Retry-After header",
        "parameters": [
          {
            "name": "retry_after",
            "in": "query",
            "description": "Seconds until retry (default: 60)",
            "schema": {
              "type": "integer",
              "default": 60
            }
          }
        ],
        "responses": {
          "429": {
            "description": "Too Many Requests",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/errors/server-error": {
      "get": {
        "operationId": "testServerError",
        "summary": "Test 500 Internal Server Error",
        "tags": [
          "errors"
        ],
        "description": "Returns a 500 error to test server error handling",
        "responses": {
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/errors/custom": {
      "get": {
        "operationId": "testCustomError",
        "summary": "Test custom error with any status code",
        "tags": [
          "errors"
        ],
        "description": "Returns a custom error with specified status code and message",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "HTTP status code to return (default: 500)",
            "schema": {
              "type": "integer",
              "default": 500
            }
          },
          {
            "name": "message",
            "in": "query",
            "description": "Error message to return",
            "schema": {
              "type": "string",
              "default": "Custom error message"
            }
          },
          {
            "name": "retry_after",
            "in": "query",
            "description": "Optional Retry-After header value (in seconds)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "default": {
            "description": "Custom error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/widgets/pet-counter": {
      "get": {
        "operationId": "getPetCounterWidget",
        "summary": "Get interactive pet counter React widget",
        "tags": [
          "widgets"
        ],
        "description": "Returns a React component with interactive elements including pet statistics, a toggle button to show/hide details, and an interactive counter. This tests if Claude can render React widgets directly in the chat interface.",
        "responses": {
          "200": {
            "description": "React widget with pet statistics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "description": "Widget type identifier",
                      "example": "react_widget"
                    },
                    "widget": {
                      "type": "string",
                      "description": "React component source code"
                    },
                    "data": {
                      "type": "object",
                      "description": "Widget data",
                      "properties": {
                        "totalPets": {
                          "type": "integer"
                        },
                        "availablePets": {
                          "type": "integer"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "Tag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "Pet": {
        "type": "object",
        "required": [
          "name",
          "photoUrls"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "$ref": "#/components/schemas/Category"
          },
          "photoUrls": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tag"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "available",
              "pending",
              "sold"
            ]
          }
        }
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "petId": {
            "type": "integer",
            "format": "int64"
          },
          "quantity": {
            "type": "integer",
            "format": "int32"
          },
          "shipDate": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "placed",
              "approved",
              "delivered"
            ]
          },
          "complete": {
            "type": "boolean"
          }
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "username": {
            "type": "string"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "userStatus": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message",
          "code"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Error type"
          },
          "message": {
            "type": "string",
            "description": "Human-readable error message"
          },
          "code": {
            "type": "string",
            "description": "Error code for programmatic handling"
          },
          "status": {
            "type": "integer",
            "description": "HTTP status code (for custom errors)"
          }
        }
      }
    }
  }
}