S
StockBud Docs

StockBud.io MCP Server Schema

Schema for Model Context Protocol server structures and communication in StockBud.io

🔌 StockBud.io MCP Server Schema

Version: 1.0.0

Schema for Model Context Protocol server structures and communication in StockBud.io

Overview

This schema defines 14 data structures:


Definitions

MCPTool

MCP tool definition

Properties

PropertyTypeRequiredDescription
namestringTool name identifier
descriptionstringTool description
inputSchemaobjectJSON schema for tool input validation
outputSchemaobjectJSON schema for tool output validation

TypeScript

interface MCPTool {
  /** Tool name identifier */
  name: string;
  /** Tool description */
  description: string;
  /** JSON schema for tool input validation */
  inputSchema: Record<string, unknown>;
  /** JSON schema for tool output validation */
  outputSchema?: Record<string, unknown>;
}

MCPResource

MCP resource definition

Properties

PropertyTypeRequiredDescription
uristringResource URI
namestringResource name
descriptionstringResource description
mimeTypestringResource MIME type

TypeScript

interface MCPResource {
  /** Resource URI */
  uri: string;
  /** Resource name */
  name: string;
  /** Resource description */
  description?: string;
  /** Resource MIME type */
  mimeType: string;
}

MCPRequest

MCP request structure

Properties

PropertyTypeRequiredDescription
jsonrpcstringJSON-RPC version
id`stringnumbernull`
methodstringMethod name
paramsobjectMethod parameters

TypeScript

interface MCPRequest {
  /** JSON-RPC version */
  jsonrpc: string;
  /** Request identifier */
  id: string | number | null;
  /** Method name */
  method: string;
  /** Method parameters */
  params?: Record<string, unknown>;
}

MCPResponse

MCP response structure

Properties

PropertyTypeRequiredDescription
jsonrpcstringJSON-RPC version
id`stringnumbernull`
resultobjectMethod result (success)
errorobjectError information (failure)

TypeScript

interface MCPResponse {
  /** JSON-RPC version */
  jsonrpc: string;
  /** Request identifier */
  id: string | number | null;
  /** Method result (success) */
  result?: Record<string, unknown>;
  /** Error information (failure) */
  error?: Record<string, unknown>;
}

PortfolioAnalysisRequest

Request for portfolio analysis

Properties

PropertyTypeRequiredDescription
portfolio_dataobjectPortfolio data to analyze
analysis_typeenum: 'risk_assessment', 'performance_attribution', 'diversification_analysis', 'sector_allocation', 'correlation_analysis', 'stress_testing', 'optimization_suggestions'Type of analysis to perform
benchmarkstringBenchmark symbol for comparison
time_horizonenum: '1d', '1w', '1m', '3m', '6m', '1y', 'ytd', 'all'Analysis time horizon
include_optionsbooleanInclude options analysis
risk_free_ratenumberRisk-free rate for calculations

TypeScript

interface PortfolioAnalysisRequest {
  /** Portfolio data to analyze */
  portfolio_data: Record<string, unknown>;
  /** Type of analysis to perform */
  analysis_type?: "risk_assessment" | "performance_attribution" | "diversification_analysis" | "sector_allocation" | "correlation_analysis" | "stress_testing" | "optimization_suggestions";
  /** Benchmark symbol for comparison */
  benchmark?: string;
  /** Analysis time horizon */
  time_horizon?: "1d" | "1w" | "1m" | "3m" | "6m" | "1y" | "ytd" | "all";
  /** Include options analysis */
  include_options?: boolean;
  /** Risk-free rate for calculations */
  risk_free_rate?: number;
}

PortfolioAnalysisResponse

Response from portfolio analysis

Properties

PropertyTypeRequiredDescription
analysis_resultsArray<Record<string, unknown>>Analysis results
performance_metricsobjectPerformance metrics
risk_metricsobjectRisk assessment metrics
insightsArray<string>Key insights
timestampstringAnalysis timestamp

TypeScript

interface PortfolioAnalysisResponse {
  /** Analysis results */
  analysis_results: Record<string, unknown>[];
  /** Performance metrics */
  performance_metrics?: Record<string, unknown>;
  /** Risk assessment metrics */
  risk_metrics?: Record<string, unknown>;
  /** Key insights */
  insights?: string[];
  /** Analysis timestamp */
  timestamp: string;
}

MarketDataRequest

Request for market data

Properties

PropertyTypeRequiredDescription
symbolsArray<string>List of symbols to retrieve
data_typeenum: 'quote', 'bars', 'trades', 'news', 'options', 'fundamentals'Type of market data
timeframeenum: '1min', '5min', '15min', '1hour', '1day'Data timeframe
start_datestringStart date for historical data
end_datestringEnd date for historical data
limitintegerMaximum number of records
include_extended_hoursbooleanInclude extended hours data

TypeScript

interface MarketDataRequest {
  /** List of symbols to retrieve */
  symbols: string[];
  /** Type of market data */
  data_type?: "quote" | "bars" | "trades" | "news" | "options" | "fundamentals";
  /** Data timeframe */
  timeframe?: "1min" | "5min" | "15min" | "1hour" | "1day";
  /** Start date for historical data */
  start_date?: string;
  /** End date for historical data */
  end_date?: string;
  /** Maximum number of records */
  limit?: number;
  /** Include extended hours data */
  include_extended_hours?: boolean;
}

MarketDataResponse

Response containing market data

Properties

PropertyTypeRequiredDescription
dataobjectMarket data by symbol
metadataobjectData metadata
timestampstringData timestamp

TypeScript

interface MarketDataResponse {
  /** Market data by symbol */
  data: Record<string, unknown>;
  /** Data metadata */
  metadata?: Record<string, unknown>;
  /** Data timestamp */
  timestamp: string;
}

TradingRequest

Request for trading operations

Properties

PropertyTypeRequiredDescription
actionenum: 'place_order', 'cancel_order', 'modify_order', 'get_positions', 'get_orders', 'get_account', 'close_position'Trading action to perform
order_detailsobjectOrder details (for order actions)
order_idstringOrder ID (for cancel/modify actions)
symbolstringSymbol (for position actions)

TypeScript

interface TradingRequest {
  /** Trading action to perform */
  action: "place_order" | "cancel_order" | "modify_order" | "get_positions" | "get_orders" | "get_account" | "close_position";
  /** Order details (for order actions) */
  order_details?: Record<string, unknown>;
  /** Order ID (for cancel/modify actions) */
  order_id?: string;
  /** Symbol (for position actions) */
  symbol?: string;
}

TradingResponse

Response from trading operations

Properties

PropertyTypeRequiredDescription
successbooleanWhether operation was successful
dataobjectResponse data
order_idstringOrder ID (for order operations)
messagestringResponse message
errorstringError message (if failed)
timestampstringResponse timestamp

TypeScript

interface TradingResponse {
  /** Whether operation was successful */
  success: boolean;
  /** Response data */
  data?: Record<string, unknown>;
  /** Order ID (for order operations) */
  order_id?: string;
  /** Response message */
  message?: string;
  /** Error message (if failed) */
  error?: string;
  /** Response timestamp */
  timestamp: string;
}

AIAnalysisRequest

Request for AI-powered analysis

Properties

PropertyTypeRequiredDescription
analysis_typeenum: 'sentiment_analysis', 'technical_analysis', 'fundamental_analysis', 'news_analysis', 'market_regime_detection', 'anomaly_detection', 'correlation_analysis', 'predictive_modeling'Type of AI analysis
dataobjectInput data for analysis
symbolsArray<string>Symbols to analyze
time_horizonenum: '1d', '1w', '1m', '3m', '6m', '1y'Analysis time horizon
confidence_thresholdnumberMinimum confidence threshold
model_parametersobjectModel-specific parameters

TypeScript

interface AIAnalysisRequest {
  /** Type of AI analysis */
  analysis_type: "sentiment_analysis" | "technical_analysis" | "fundamental_analysis" | "news_analysis" | "market_regime_detection" | "anomaly_detection" | "correlation_analysis" | "predictive_modeling";
  /** Input data for analysis */
  data?: Record<string, unknown>;
  /** Symbols to analyze */
  symbols?: string[];
  /** Analysis time horizon */
  time_horizon?: "1d" | "1w" | "1m" | "3m" | "6m" | "1y";
  /** Minimum confidence threshold */
  confidence_threshold?: number;
  /** Model-specific parameters */
  model_parameters?: Record<string, unknown>;
}

AIAnalysisResponse

Response from AI analysis

Properties

PropertyTypeRequiredDescription
analysis_typestringType of analysis performed
resultsobjectAnalysis results
confidencenumberOverall confidence in results
insightsArray<string>Key insights from analysis
recommendationsArray<string>Actionable recommendations
model_infoobjectModel information
timestampstringAnalysis timestamp

TypeScript

interface AIAnalysisResponse {
  /** Type of analysis performed */
  analysis_type: string;
  /** Analysis results */
  results: Record<string, unknown>;
  /** Overall confidence in results */
  confidence?: number;
  /** Key insights from analysis */
  insights?: string[];
  /** Actionable recommendations */
  recommendations?: string[];
  /** Model information */
  model_info?: Record<string, unknown>;
  /** Analysis timestamp */
  timestamp: string;
}

ServerCapabilities

MCP server capabilities

Properties

PropertyTypeRequiredDescription
toolsArray<MCPTool>Available tools
resourcesArray<MCPResource>Available resources
promptsArray<Record<string, unknown>>Available prompts
experimentalobjectExperimental features

TypeScript

interface ServerCapabilities {
  /** Available tools */
  tools?: MCPTool[];
  /** Available resources */
  resources?: MCPResource[];
  /** Available prompts */
  prompts?: Record<string, unknown>[];
  /** Experimental features */
  experimental?: Record<string, unknown>;
}

ServerInfo

MCP server information

Properties

PropertyTypeRequiredDescription
namestringServer name
versionstringServer version
descriptionstringServer description
authorstringServer author
licensestringServer license
homepagestringServer homepage URL
capabilitiesServerCapabilities

TypeScript

interface ServerInfo {
  /** Server name */
  name: string;
  /** Server version */
  version: string;
  /** Server description */
  description?: string;
  /** Server author */
  author?: string;
  /** Server license */
  license?: string;
  /** Server homepage URL */
  homepage?: string;
  capabilities?: ServerCapabilities;
}

Usage Example

import type { MCPTool, MCPResource, MCPRequest, MCPResponse, PortfolioAnalysisRequest, PortfolioAnalysisResponse, MarketDataRequest, MarketDataResponse, TradingRequest, TradingResponse, AIAnalysisRequest, AIAnalysisResponse, ServerCapabilities, ServerInfo } from '@stockbud/schemas';
 
// Create a new MCPTool
const example: MCPTool = {
  name: "example-value",
  description: "example-value",
  inputSchema: {},
};

Full JSON Schema

Click to expand raw JSON Schema
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "StockBud.io MCP Server Schema",
  "description": "Schema for Model Context Protocol server structures and communication in StockBud.io",
  "version": "1.0.0",
  "type": "object",
  "definitions": {
    "MCPTool": {
      "type": "object",
      "description": "MCP tool definition",
      "required": [
        "name",
        "description",
        "inputSchema"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Tool name identifier"
        },
        "description": {
          "type": "string",
          "description": "Tool description"
        },
        "inputSchema": {
          "type": "object",
          "description": "JSON schema for tool input validation"
        },
        "outputSchema": {
          "type": "object",
          "description": "JSON schema for tool output validation"
        }
      }
    },
    "MCPResource": {
      "type": "object",
      "description": "MCP resource definition",
      "required": [
        "uri",
        "name",
        "mimeType"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "uri",
          "description": "Resource URI"
        },
        "name": {
          "type": "string",
          "description": "Resource name"
        },
        "description": {
          "type": "string",
          "description": "Resource description"
        },
        "mimeType": {
          "type": "string",
          "description": "Resource MIME type"
        }
      }
    },
    "MCPRequest": {
      "type": "object",
      "description": "MCP request structure",
      "required": [
        "jsonrpc",
        "id",
        "method"
      ],
      "properties": {
        "jsonrpc": {
          "type": "string",
          "const": "2.0",
          "description": "JSON-RPC version"
        },
        "id": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Request identifier"
        },
        "method": {
          "type": "string",
          "description": "Method name"
        },
        "params": {
          "type": "object",
          "description": "Method parameters"
        }
      }
    },
    "MCPResponse": {
      "type": "object",
      "description": "MCP response structure",
      "required": [
        "jsonrpc",
        "id"
      ],
      "properties": {
        "jsonrpc": {
          "type": "string",
          "const": "2.0",
          "description": "JSON-RPC version"
        },
        "id": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Request identifier"
        },
        "result": {
          "type": "object",
          "description": "Method result (success)"
        },
        "error": {
          "type": "object",
          "properties": {
            "code": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "data": {
              "type": "object"
            }
          },
          "description": "Error information (failure)"
        }
      }
    },
    "PortfolioAnalysisRequest": {
      "type": "object",
      "description": "Request for portfolio analysis",
      "required": [
        "portfolio_data"
      ],
      "properties": {
        "portfolio_data": {
          "type": "object",
          "description": "Portfolio data to analyze"
        },
        "analysis_type": {
          "type": "string",
          "enum": [
            "risk_assessment",
            "performance_attribution",
            "diversification_analysis",
            "sector_allocation",
            "correlation_analysis",
            "stress_testing",
            "optimization_suggestions"
          ],
          "description": "Type of analysis to perform"
        },
        "benchmark": {
          "type": "string",
          "description": "Benchmark symbol for comparison"
        },
        "time_horizon": {
          "type": "string",
          "enum": [
            "1d",
            "1w",
            "1m",
            "3m",
            "6m",
            "1y",
            "ytd",
            "all"
          ],
          "description": "Analysis time horizon"
        },
        "include_options": {
          "type": "boolean",
          "default": false,
          "description": "Include options analysis"
        },
        "risk_free_rate": {
          "type": "number",
          "description": "Risk-free rate for calculations"
        }
      }
    },
    "PortfolioAnalysisResponse": {
      "type": "object",
      "description": "Response from portfolio analysis",
      "required": [
        "analysis_results",
        "timestamp"
      ],
      "properties": {
        "analysis_results": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "analysis_type": {
                "type": "string"
              },
              "severity": {
                "type": "string",
                "enum": [
                  "low",
                  "medium",
                  "high",
                  "critical"
                ]
              },
              "confidence": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "title": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "recommendations": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "data": {
                "type": "object"
              }
            }
          },
          "description": "Analysis results"
        },
        "performance_metrics": {
          "type": "object",
          "description": "Performance metrics"
        },
        "risk_metrics": {
          "type": "object",
          "description": "Risk assessment metrics"
        },
        "insights": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Key insights"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Analysis timestamp"
        }
      }
    },
    "MarketDataRequest": {
      "type": "object",
      "description": "Request for market data",
      "required": [
        "symbols"
      ],
      "properties": {
        "symbols": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of symbols to retrieve"
        },
        "data_type": {
          "type": "string",
          "enum": [
            "quote",
            "bars",
            "trades",
            "news",
            "options",
            "fundamentals"
          ],
          "description": "Type of market data"
        },
        "timeframe": {
          "type": "string",
          "enum": [
            "1min",
            "5min",
            "15min",
            "1hour",
            "1day"
          ],
          "description": "Data timeframe"
        },
        "start_date": {
          "type": "string",
          "format": "date-time",
          "description": "Start date for historical data"
        },
        "end_date": {
          "type": "string",
          "format": "date-time",
          "description": "End date for historical data"
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10000,
          "description": "Maximum number of records"
        },
        "include_extended_hours": {
          "type": "boolean",
          "default": false,
          "description": "Include extended hours data"
        }
      }
    },
    "MarketDataResponse": {
      "type": "object",
      "description": "Response containing market data",
      "required": [
        "data",
        "timestamp"
      ],
      "properties": {
        "data": {
          "type": "object",
          "patternProperties": {
            "^[A-Z]{1,5}$": {
              "type": "object",
              "description": "Market data for each symbol"
            }
          },
          "description": "Market data by symbol"
        },
        "metadata": {
          "type": "object",
          "properties": {
            "data_source": {
              "type": "string"
            },
            "delay_minutes": {
              "type": "integer"
            },
            "currency": {
              "type": "string"
            }
          },
          "description": "Data metadata"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Data timestamp"
        }
      }
    },
    "TradingRequest": {
      "type": "object",
      "description": "Request for trading operations",
      "required": [
        "action"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "place_order",
            "cancel_order",
            "modify_order",
            "get_positions",
            "get_orders",
            "get_account",
            "close_position"
          ],
          "description": "Trading action to perform"
        },
        "order_details": {
          "type": "object",
          "properties": {
            "symbol": {
              "type": "string"
            },
            "quantity": {
              "type": "number"
            },
            "side": {
              "type": "string",
              "enum": [
                "buy",
                "sell"
              ]
            },
            "order_type": {
              "type": "string",
              "enum": [
                "market",
                "limit",
                "stop",
                "stop_limit"
              ]
            },
            "time_in_force": {
              "type": "string",
              "enum": [
                "day",
                "gtc",
                "ioc",
                "fok"
              ]
            },
            "limit_price": {
              "type": "number"
            },
            "stop_price": {
              "type": "number"
            }
          },
          "description": "Order details (for order actions)"
        },
        "order_id": {
          "type": "string",
          "description": "Order ID (for cancel/modify actions)"
        },
        "symbol": {
          "type": "string",
          "description": "Symbol (for position actions)"
        }
      }
    },
    "TradingResponse": {
      "type": "object",
      "description": "Response from trading operations",
      "required": [
        "success",
        "timestamp"
      ],
      "properties": {
        "success": {
          "type": "boolean",
          "description": "Whether operation was successful"
        },
        "data": {
          "type": "object",
          "description": "Response data"
        },
        "order_id": {
          "type": "string",
          "description": "Order ID (for order operations)"
        },
        "message": {
          "type": "string",
          "description": "Response message"
        },
        "error": {
          "type": "string",
          "description": "Error message (if failed)"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Response timestamp"
        }
      }
    },
    "AIAnalysisRequest": {
      "type": "object",
      "description": "Request for AI-powered analysis",
      "required": [
        "analysis_type"
      ],
      "properties": {
        "analysis_type": {
          "type": "string",
          "enum": [
            "sentiment_analysis",
            "technical_analysis",
            "fundamental_analysis",
            "news_analysis",
            "market_regime_detection",
            "anomaly_detection",
            "correlation_analysis",
            "predictive_modeling"
          ],
          "description": "Type of AI analysis"
        },
        "data": {
          "type": "object",
          "description": "Input data for analysis"
        },
        "symbols": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Symbols to analyze"
        },
        "time_horizon": {
          "type": "string",
          "enum": [
            "1d",
            "1w",
            "1m",
            "3m",
            "6m",
            "1y"
          ],
          "description": "Analysis time horizon"
        },
        "confidence_threshold": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "default": 0.6,
          "description": "Minimum confidence threshold"
        },
        "model_parameters": {
          "type": "object",
          "description": "Model-specific parameters"
        }
      }
    },
    "AIAnalysisResponse": {
      "type": "object",
      "description": "Response from AI analysis",
      "required": [
        "analysis_type",
        "results",
        "timestamp"
      ],
      "properties": {
        "analysis_type": {
          "type": "string",
          "description": "Type of analysis performed"
        },
        "results": {
          "type": "object",
          "description": "Analysis results"
        },
        "confidence": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Overall confidence in results"
        },
        "insights": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Key insights from analysis"
        },
        "recommendations": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Actionable recommendations"
        },
        "model_info": {
          "type": "object",
          "properties": {
            "model_name": {
              "type": "string"
            },
            "model_version": {
              "type": "string"
            },
            "training_date": {
              "type": "string",
              "format": "date-time"
            }
          },
          "description": "Model information"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Analysis timestamp"
        }
      }
    },
    "ServerCapabilities": {
      "type": "object",
      "description": "MCP server capabilities",
      "properties": {
        "tools": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/MCPTool"
          },
          "description": "Available tools"
        },
        "resources": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/MCPResource"
          },
          "description": "Available resources"
        },
        "prompts": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "arguments": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          },
          "description": "Available prompts"
        },
        "experimental": {
          "type": "object",
          "description": "Experimental features"
        }
      }
    },
    "ServerInfo": {
      "type": "object",
      "description": "MCP server information",
      "required": [
        "name",
        "version"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Server name"
        },
        "version": {
          "type": "string",
          "description": "Server version"
        },
        "description": {
          "type": "string",
          "description": "Server description"
        },
        "author": {
          "type": "string",
          "description": "Server author"
        },
        "license": {
          "type": "string",
          "description": "Server license"
        },
        "homepage": {
          "type": "string",
          "format": "uri",
          "description": "Server homepage URL"
        },
        "capabilities": {
          "$ref": "#/definitions/ServerCapabilities"
        }
      }
    }
  },
  "properties": {
    "server_info": {
      "$ref": "#/definitions/ServerInfo"
    },
    "tools": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/MCPTool"
      }
    },
    "resources": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/MCPResource"
      }
    },
    "requests": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/MCPRequest"
      }
    },
    "responses": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/MCPResponse"
      }
    }
  }
}