{
  "openapi": "3.1.0",
  "info": {
    "title": "FinViz Financial Intelligence API",
    "description": "AI-powered financial intelligence from YouTube video analysis. Provides morning reports, video analyses, ticker sentiment, market intelligence, and trending topics.\n\n## Authentication\n\nAll data endpoints require a Bearer token. Obtain one by registering and creating a token.\n\n### For AI Agents\n```\nPOST /api/v1/agent/register\n{\"agent_name\": \"your-agent\", \"contact_email\": \"you@example.com\"}\n```\nAfter admin approval, you'll receive an API token.\n\n### For Humans\nRegister at https://finviz.fetch.markets, then generate a token from the API Settings page.\n\n## MCP Server\n\nThis service also provides a Model Context Protocol (MCP) server at `/mcp` for direct AI assistant integration. Use an MCP token (`fv_mcp_*`) with Streamable HTTP transport. See the `x-mcp-server` extension for tool details.\n\n## Rate Limits\n\n| Tier | API Requests/hr | MCP Requests/hr | Price |\n|------|----------------|-----------------|-------|\n| Free | 100 | 50 | $0 |\n| Paid | 1,000 | 500 | $9/mo |\n| Admin | Unlimited | Unlimited | — |\n\n## Tier Data Filtering\n\nFree tier responses have truncated executive summaries, limited top stories, and partial market intelligence. Upgrade to paid for full data.",
    "version": "1.0.0",
    "contact": {
      "name": "FinViz Support",
      "url": "https://finviz.fetch.markets",
      "email": "finvizadmin@levidehaan.com"
    }
  },
  "servers": [
    {
      "url": "https://finviz.fetch.markets",
      "description": "Production"
    }
  ],
  "security": [
    { "BearerToken": [] }
  ],
  "components": {
    "securitySchemes": {
      "BearerToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "API token (prefix fv_api_) or MCP token (prefix fv_mcp_). Obtain via POST /api/v1/tokens after authentication."
      },
      "CookieSession": {
        "type": "apiKey",
        "in": "cookie",
        "name": "token",
        "description": "JWT session cookie set after login via POST /api/auth/login."
      }
    },
    "schemas": {
      "SuccessResponse": {
        "type": "object",
        "properties": {
          "success": { "type": "boolean", "const": true },
          "data": {}
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "success": { "type": "boolean", "const": false },
          "error": { "type": "string" }
        }
      },
      "PaginatedResponse": {
        "type": "object",
        "properties": {
          "success": { "type": "boolean", "const": true },
          "data": { "type": "array" },
          "pagination": {
            "type": "object",
            "properties": {
              "limit": { "type": "integer" },
              "offset": { "type": "integer" },
              "count": { "type": "integer" },
              "total": { "type": "integer" }
            }
          }
        }
      },
      "MorningReport": {
        "type": "object",
        "properties": {
          "date": { "type": "string", "format": "date" },
          "total_videos": { "type": "integer" },
          "executive_summary": { "type": "string" },
          "high_priority_count": { "type": "integer" },
          "avg_priority_score": { "type": "number" },
          "avg_market_impact": { "type": "number" },
          "avg_confidence": { "type": "number" },
          "unique_tickers_count": { "type": "integer" },
          "top_stories": { "type": "array", "items": { "type": "object" } },
          "market_themes": { "type": "array", "items": { "type": "object" } },
          "risk_alerts": { "type": "array", "items": { "type": "object" } },
          "generated_at": { "type": "string", "format": "date-time" }
        }
      },
      "VideoAnalysis": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "video_title": { "type": "string" },
          "channel_name": { "type": "string" },
          "priority_score": { "type": "number" },
          "sentiment_score": { "type": "number" },
          "market_impact_score": { "type": "number" },
          "tickers_mentioned": { "type": "array", "items": { "type": "string" } },
          "topics_identified": { "type": "array", "items": { "type": "string" } },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "MarketIntelligence": {
        "type": "object",
        "description": "Structured market intelligence including sentiment distribution, ticker heatmap, sector rotation, risk dashboard, momentum signals, contrarian signals, trade ideas, and market mood.",
        "properties": {
          "sentimentDistribution": { "type": "object" },
          "tickerSentimentMap": { "type": "object" },
          "sectorPerformance": { "type": "object" },
          "topicFrequency": { "type": "object" },
          "riskMatrix": { "type": "object" },
          "tradeIdeas": { "type": "array" },
          "marketMood": { "type": "object" },
          "consensusView": { "type": "object" }
        }
      },
      "TickerMention": {
        "type": "object",
        "properties": {
          "videoTitle": { "type": "string" },
          "channelName": { "type": "string" },
          "date": { "type": "string" },
          "tickerSentiment": { "type": "string" },
          "tickerReason": { "type": "string" },
          "priorityScore": { "type": "number" }
        }
      },
      "Token": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "tokenPrefix": { "type": "string" },
          "tokenType": { "type": "string", "enum": ["api", "mcp"] },
          "name": { "type": "string" },
          "isActive": { "type": "boolean" },
          "lastUsedAt": { "type": "string", "format": "date-time", "nullable": true },
          "createdAt": { "type": "string", "format": "date-time" },
          "usage": {
            "type": "object",
            "properties": {
              "today": { "type": "integer" },
              "total": { "type": "integer" }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/api/v1/morning-reports": {
      "get": {
        "operationId": "listMorningReports",
        "summary": "List morning reports",
        "description": "Returns paginated morning reports with executive summaries, top stories, and market data. Free tier gets truncated summaries.",
        "tags": ["Morning Reports"],
        "parameters": [
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 10 } },
          { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 } },
          { "name": "dateFrom", "in": "query", "schema": { "type": "string", "format": "date" }, "description": "Filter start date (YYYY-MM-DD)" },
          { "name": "dateTo", "in": "query", "schema": { "type": "string", "format": "date" }, "description": "Filter end date (YYYY-MM-DD)" }
        ],
        "responses": {
          "200": { "description": "Paginated list of morning reports", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaginatedResponse" } } } },
          "401": { "description": "Authentication required" },
          "429": { "description": "Rate limit exceeded" }
        }
      }
    },
    "/api/v1/morning-reports/today": {
      "get": {
        "operationId": "getTodayMorningReport",
        "summary": "Get today's morning report",
        "description": "Returns the morning report for today (Mountain Time). Most commonly used endpoint.",
        "tags": ["Morning Reports"],
        "responses": {
          "200": { "description": "Today's morning report", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuccessResponse" } } } },
          "404": { "description": "No report available for today" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/morning-reports/latest": {
      "get": {
        "operationId": "getLatestMorningReport",
        "summary": "Get the most recent morning report",
        "description": "Returns the latest available morning report regardless of date. Useful when today's report hasn't been generated yet.",
        "tags": ["Morning Reports"],
        "responses": {
          "200": { "description": "Latest morning report" },
          "404": { "description": "No reports available" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/morning-reports/{date}": {
      "get": {
        "operationId": "getMorningReportByDate",
        "summary": "Get morning report for a specific date",
        "tags": ["Morning Reports"],
        "parameters": [
          { "name": "date", "in": "path", "required": true, "schema": { "type": "string", "format": "date" }, "description": "Date in YYYY-MM-DD format" }
        ],
        "responses": {
          "200": { "description": "Morning report for the requested date" },
          "400": { "description": "Invalid date format" },
          "404": { "description": "No report for this date" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/morning-reports/{date}/intelligence": {
      "get": {
        "operationId": "getMarketIntelligence",
        "summary": "Get market intelligence for a date",
        "description": "Returns structured market intelligence including sentiment distribution, ticker heatmap, sector rotation, risk dashboard, momentum signals, trade ideas, and market mood. Free tier gets limited data.",
        "tags": ["Morning Reports"],
        "parameters": [
          { "name": "date", "in": "path", "required": true, "schema": { "type": "string", "format": "date" } }
        ],
        "responses": {
          "200": { "description": "Market intelligence data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuccessResponse" } } } },
          "404": { "description": "No intelligence available" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/analyses": {
      "get": {
        "operationId": "listAnalyses",
        "summary": "List video analyses",
        "description": "Returns video analyses for a date range. Defaults to today. Each analysis includes priority score, sentiment, tickers mentioned, and topics.",
        "tags": ["Video Analyses"],
        "parameters": [
          { "name": "dateFrom", "in": "query", "schema": { "type": "string", "format": "date" }, "description": "Start date (defaults to today)" },
          { "name": "dateTo", "in": "query", "schema": { "type": "string", "format": "date" }, "description": "End date (defaults to dateFrom)" },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 } },
          { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 } }
        ],
        "responses": {
          "200": { "description": "Paginated list of analyses" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/analyses/search": {
      "get": {
        "operationId": "searchAnalyses",
        "summary": "Search analyses by ticker or topic",
        "description": "Search video analyses by stock ticker symbol, financial topic, or date range. At least one of ticker or topic is required.",
        "tags": ["Video Analyses"],
        "parameters": [
          { "name": "ticker", "in": "query", "schema": { "type": "string" }, "description": "Stock ticker symbol (e.g., AAPL, TSLA, NVDA)" },
          { "name": "topic", "in": "query", "schema": { "type": "string", "maxLength": 200 }, "description": "Topic to search for (e.g., 'tariffs', 'fed rate')" },
          { "name": "dateFrom", "in": "query", "schema": { "type": "string", "format": "date" } },
          { "name": "dateTo", "in": "query", "schema": { "type": "string", "format": "date" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 20 } },
          { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 } }
        ],
        "responses": {
          "200": { "description": "Search results" },
          "400": { "description": "Must provide ticker or topic" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/analyses/report/{reportId}": {
      "get": {
        "operationId": "getAnalysesForReport",
        "summary": "Get analyses for a specific report",
        "tags": ["Video Analyses"],
        "parameters": [
          { "name": "reportId", "in": "path", "required": true, "schema": { "type": "integer" } }
        ],
        "responses": {
          "200": { "description": "Analyses for the report" },
          "400": { "description": "Invalid report ID" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/reports": {
      "get": {
        "operationId": "listReports",
        "summary": "List analysis run reports",
        "description": "Returns reports of analysis runs with type, status, and date filtering.",
        "tags": ["Reports"],
        "parameters": [
          { "name": "type", "in": "query", "schema": { "type": "string", "enum": ["scheduled", "manual", "channel_check", "morning_report", "intelligence"] } },
          { "name": "status", "in": "query", "schema": { "type": "string", "enum": ["completed", "running", "failed", "pending"] } },
          { "name": "dateFrom", "in": "query", "schema": { "type": "string", "format": "date" } },
          { "name": "dateTo", "in": "query", "schema": { "type": "string", "format": "date" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 20 } },
          { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 } }
        ],
        "responses": {
          "200": { "description": "List of reports" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/reports/{id}": {
      "get": {
        "operationId": "getReportById",
        "summary": "Get a specific report with details",
        "tags": ["Reports"],
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } }
        ],
        "responses": {
          "200": { "description": "Report details" },
          "404": { "description": "Report not found" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/tickers/{symbol}": {
      "get": {
        "operationId": "getTickerAnalysis",
        "summary": "Get analysis for a stock ticker across recent videos",
        "description": "Returns all mentions of a ticker symbol across video analyses for the past N days, including sentiment, context, and source videos.",
        "tags": ["Tickers & Trending"],
        "parameters": [
          { "name": "symbol", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^[A-Z][A-Z0-9.]{0,9}$" }, "description": "Stock ticker (e.g., AAPL, NVDA, BRK.B)" },
          { "name": "days", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 30, "default": 7 }, "description": "Lookback days" }
        ],
        "responses": {
          "200": {
            "description": "Ticker analysis with mentions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "symbol": { "type": "string" },
                        "mentionCount": { "type": "integer" },
                        "dateRange": { "type": "object", "properties": { "from": { "type": "string" }, "to": { "type": "string" } } },
                        "mentions": { "type": "array", "items": { "$ref": "#/components/schemas/TickerMention" } }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": { "description": "Invalid ticker symbol" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/trending": {
      "get": {
        "operationId": "getTrendingTopics",
        "summary": "Get trending financial topics",
        "description": "Returns currently trending financial topics with mention counts, sentiment scores, and trend directions.",
        "tags": ["Tickers & Trending"],
        "parameters": [
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 20 } },
          { "name": "category", "in": "query", "schema": { "type": "string" }, "description": "Filter by category" }
        ],
        "responses": {
          "200": { "description": "Trending topics" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/tokens": {
      "get": {
        "operationId": "listTokens",
        "summary": "List your API/MCP tokens",
        "description": "Returns your active and revoked tokens with usage statistics. Authenticated via Bearer token or cookie session.",
        "tags": ["Token Management"],
        "responses": {
          "200": {
            "description": "List of tokens",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tokens": { "type": "array", "items": { "$ref": "#/components/schemas/Token" } }
                  }
                }
              }
            }
          },
          "401": { "description": "Authentication required" }
        }
      },
      "post": {
        "operationId": "createToken",
        "summary": "Create a new API or MCP token",
        "description": "Generates a new Bearer token. The raw token is returned ONCE in the response — store it securely. Creating a new token of the same type revokes the previous one. Rate limited to 10/hour.",
        "tags": ["Token Management"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["type"],
                "properties": {
                  "type": { "type": "string", "enum": ["api", "mcp"], "description": "Token type. 'api' for REST API, 'mcp' for MCP server." },
                  "name": { "type": "string", "maxLength": 100, "description": "Optional name for the token" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token created. Raw token shown once.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": { "type": "string", "description": "Raw Bearer token (shown once). Store securely." },
                    "warning": { "type": "string" }
                  }
                }
              }
            }
          },
          "400": { "description": "Invalid token type" },
          "401": { "description": "Authentication required" },
          "429": { "description": "Rate limit exceeded" }
        }
      }
    },
    "/api/v1/tokens/{id}": {
      "delete": {
        "operationId": "revokeToken",
        "summary": "Revoke a token",
        "description": "Immediately revokes a token. It can no longer be used for authentication.",
        "tags": ["Token Management"],
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } }
        ],
        "responses": {
          "200": { "description": "Token revoked" },
          "404": { "description": "Token not found or already revoked" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/tokens/{id}/usage": {
      "get": {
        "operationId": "getTokenUsage",
        "summary": "Get usage history for a token",
        "tags": ["Token Management"],
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } },
          { "name": "days", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 90, "default": 30 } }
        ],
        "responses": {
          "200": { "description": "Daily usage history" },
          "404": { "description": "Token not found" },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/status": {
      "get": {
        "operationId": "getStatus",
        "summary": "Get API status and your usage/limits",
        "description": "Returns authentication status, current usage, and rate limits for your account.",
        "tags": ["Status"],
        "responses": {
          "200": {
            "description": "Status info",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "authenticated": { "type": "boolean" },
                        "user": {
                          "type": "object",
                          "properties": {
                            "id": { "type": "integer" },
                            "email": { "type": "string" },
                            "role": { "type": "string", "enum": ["free", "paid", "admin", "support"] }
                          }
                        },
                        "authMethod": { "type": "string", "enum": ["bearer_token", "cookie_session"] },
                        "usage": { "type": "object" },
                        "limits": { "type": "object" },
                        "version": { "type": "string" }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": { "description": "Authentication required" }
        }
      }
    },
    "/api/v1/agent/register": {
      "post": {
        "operationId": "registerAgent",
        "summary": "Register an AI agent for API access",
        "description": "Submit a registration request for an AI agent. No authentication required. After admin approval, you'll receive API credentials to authenticate with. Rate limited to 3 requests per hour per IP.",
        "tags": ["Agent Registration"],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["agent_name", "contact_email"],
                "properties": {
                  "agent_name": { "type": "string", "maxLength": 100, "description": "Name of your AI agent or service" },
                  "contact_email": { "type": "string", "format": "email", "description": "Email for the agent operator (for account setup and billing)" },
                  "callback_url": { "type": "string", "format": "uri", "description": "Optional HTTPS URL to receive approval notification" }
                }
              },
              "example": {
                "agent_name": "my-financial-bot",
                "contact_email": "developer@example.com"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Registration received, pending admin review",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "message": { "type": "string" },
                    "next_steps": { "type": "array", "items": { "type": "string" } },
                    "documentation": { "type": "string", "format": "uri" }
                  }
                }
              }
            }
          },
          "400": { "description": "Invalid input" },
          "409": { "description": "Registration already pending for this email" },
          "429": { "description": "Rate limit exceeded" }
        }
      }
    },
    "/api/auth/register": {
      "post": {
        "operationId": "registerHuman",
        "summary": "Register a human user account",
        "description": "Create a user account with email and password. May require admin approval depending on system configuration.",
        "tags": ["Authentication"],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email", "password"],
                "properties": {
                  "email": { "type": "string", "format": "email" },
                  "password": { "type": "string", "minLength": 8, "maxLength": 128 }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Registration successful (auto-approved)" },
          "202": { "description": "Registration pending admin approval" },
          "400": { "description": "Invalid input" },
          "429": { "description": "Rate limit exceeded" }
        }
      }
    },
    "/api/auth/login": {
      "post": {
        "operationId": "login",
        "summary": "Login with email and password",
        "description": "Authenticates and sets a JWT session cookie. Use for browser-based access. For API access, use Bearer tokens instead.",
        "tags": ["Authentication"],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email", "password"],
                "properties": {
                  "email": { "type": "string", "format": "email" },
                  "password": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Login successful, session cookie set" },
          "401": { "description": "Invalid credentials" },
          "429": { "description": "Rate limit exceeded" }
        }
      }
    },
    "/api/auth/me": {
      "get": {
        "operationId": "checkSession",
        "summary": "Check current session",
        "description": "Returns the currently authenticated user, or 401 if not logged in.",
        "tags": ["Authentication"],
        "responses": {
          "200": { "description": "Authenticated user info" },
          "401": { "description": "Not authenticated" }
        }
      }
    },
    "/api/morning-reports/free/today": {
      "get": {
        "operationId": "getFreeTodayReport",
        "summary": "Get today's morning report (free, no auth)",
        "description": "Returns a truncated version of today's morning report. No authentication required. Good for previewing data before signing up.",
        "tags": ["Morning Reports"],
        "security": [],
        "responses": {
          "200": { "description": "Truncated morning report" },
          "404": { "description": "No report available" }
        }
      }
    },
    "/api/access-request": {
      "post": {
        "operationId": "requestAccess",
        "summary": "Request access to the platform",
        "description": "Submit an access request for human users. No authentication required.",
        "tags": ["Authentication"],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email", "traderType"],
                "properties": {
                  "email": { "type": "string", "format": "email" },
                  "traderType": { "type": "string", "description": "Type of trader (e.g., 'day_trader', 'swing_trader', 'institutional')" },
                  "company": { "type": "string", "description": "Optional company name" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Request received" },
          "429": { "description": "Rate limit exceeded" }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcpPost",
        "summary": "MCP Protocol — send messages",
        "description": "Model Context Protocol endpoint. Use Streamable HTTP transport. Authenticate with Bearer fv_mcp_* token. Supports session management via Mcp-Session-Id header.",
        "tags": ["MCP Server"],
        "security": [{ "BearerToken": [] }],
        "responses": {
          "200": { "description": "MCP response" },
          "401": { "description": "MCP authentication required" },
          "429": { "description": "Rate limit exceeded" }
        }
      }
    }
  },
  "x-mcp-server": {
    "description": "MCP (Model Context Protocol) server for AI assistant integration. Connect via Streamable HTTP at /mcp with a Bearer fv_mcp_* token.",
    "endpoint": "https://finviz.fetch.markets/mcp",
    "transport": "streamable-http",
    "authentication": "Bearer token (fv_mcp_* prefix)",
    "configuration_example": {
      "mcpServers": {
        "finviz-financial-analyzer": {
          "url": "https://finviz.fetch.markets/mcp",
          "headers": {
            "Authorization": "Bearer fv_mcp_YOUR_TOKEN_HERE"
          }
        }
      }
    },
    "tools": [
      {
        "name": "get_morning_report",
        "description": "Get the morning financial report for a specific date. Returns executive summary, top stories, market themes, risk alerts, and key metrics.",
        "parameters": {
          "date": { "type": "string", "description": "Date in YYYY-MM-DD format. Defaults to today.", "required": false }
        }
      },
      {
        "name": "search_analyses",
        "description": "Search video analyses by ticker symbol, topic, or date range. Returns matching analyses with sentiment scores, priority ratings, and key insights.",
        "parameters": {
          "ticker": { "type": "string", "description": "Stock ticker symbol (e.g., AAPL, TSLA)", "required": false },
          "topic": { "type": "string", "description": "Financial topic to search for", "required": false },
          "date_from": { "type": "string", "description": "Start date YYYY-MM-DD", "required": false },
          "date_to": { "type": "string", "description": "End date YYYY-MM-DD", "required": false },
          "limit": { "type": "number", "description": "Max results (default 10, max 50)", "required": false }
        }
      },
      {
        "name": "get_market_intelligence",
        "description": "Get market intelligence data including sentiment distribution, ticker sentiment map, sector performance, risk matrix, and trade ideas for a specific date.",
        "parameters": {
          "date": { "type": "string", "description": "Date in YYYY-MM-DD format. Defaults to today.", "required": false }
        }
      },
      {
        "name": "get_ticker_analysis",
        "description": "Get comprehensive analysis for a specific stock ticker across all recent video analyses. Includes sentiment history, mention contexts, and source videos.",
        "parameters": {
          "symbol": { "type": "string", "description": "Stock ticker symbol (e.g., AAPL)", "required": true },
          "days": { "type": "number", "description": "Number of days to look back (default 7, max 30)", "required": false }
        }
      },
      {
        "name": "get_trending_topics",
        "description": "Get currently trending financial topics with mention counts, sentiment scores, and trend directions.",
        "parameters": {
          "limit": { "type": "number", "description": "Max results (default 20)", "required": false },
          "category": { "type": "string", "description": "Filter by category", "required": false }
        }
      },
      {
        "name": "list_reports",
        "description": "List available morning reports with dates and summary statistics.",
        "parameters": {
          "limit": { "type": "number", "description": "Max results (default 10)", "required": false },
          "date_from": { "type": "string", "description": "Start date YYYY-MM-DD", "required": false },
          "date_to": { "type": "string", "description": "End date YYYY-MM-DD", "required": false }
        }
      }
    ],
    "resources": [
      {
        "name": "Today's Morning Report",
        "uri": "report://today",
        "description": "Today's morning report as JSON"
      },
      {
        "name": "Latest Morning Report",
        "uri": "report://latest",
        "description": "Most recent available morning report"
      }
    ]
  },
  "tags": [
    { "name": "Morning Reports", "description": "Daily financial intelligence reports compiled from video analysis" },
    { "name": "Video Analyses", "description": "Individual video analysis results with tickers, sentiment, and priority scores" },
    { "name": "Reports", "description": "Analysis run metadata (scheduled, manual, etc.)" },
    { "name": "Tickers & Trending", "description": "Stock ticker mentions and trending financial topics" },
    { "name": "Token Management", "description": "Create, list, and revoke API/MCP tokens" },
    { "name": "Agent Registration", "description": "Programmatic registration for AI agents" },
    { "name": "Authentication", "description": "User registration, login, and session management" },
    { "name": "Status", "description": "API health and usage information" },
    { "name": "MCP Server", "description": "Model Context Protocol endpoint for AI assistant integration" }
  ]
}
