get_income_statement
Retrieve company income statements for financial analysis. Specify stock symbol and period (annual/quarterly) to access revenue, expenses, and profitability data.
Instructions
Get company income statement (annual or quarterly)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock ticker symbol | |
| period | No | Period type (annual or quarter) | |
| limit | No | Number of periods to return (default: 5) |
Implementation Reference
- src/tools/financials.ts:51-69 (handler)The handler implementation for get_income_statement, which fetches income statement data from the FMP API using the provided symbol, period, and limit.
server.registerTool( 'get_income_statement', { description: 'Get company income statement (annual or quarterly)', inputSchema: FinancialStatementSchema, }, async (args: z.infer<typeof FinancialStatementSchema>) => { try { const period = args.period || 'annual'; const limit = args.limit || 5; const data = await fetchFMP<IncomeStatement[]>( `/income-statement?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}` ); return jsonResponse(data); } catch (error) { return errorResponse(error); } } ); - src/tools/financials.ts:14-18 (schema)The input schema definition used by get_income_statement.
const FinancialStatementSchema = z.object({ symbol: SymbolSchema.describe('Stock ticker symbol'), period: PeriodSchema.describe('Period type (annual or quarter)'), limit: LimitSchema.describe('Number of periods to return (default: 5)'), }); - src/tools/financials.ts:32-172 (registration)The registration function that defines the get_income_statement tool within the MCP server.
export function registerFinancialsTools(server: any) { // Company Profile server.registerTool( 'get_company_profile', { description: 'Get detailed company profile information including description, industry, sector, CEO, and more', inputSchema: CompanyProfileSchema, }, async (args: z.infer<typeof CompanyProfileSchema>) => { try { const data = await fetchFMP<CompanyProfile[]>(`/profile?symbol=${args.symbol.toUpperCase()}`); return jsonResponse(data); } catch (error) { return errorResponse(error); } } ); // Income Statement server.registerTool( 'get_income_statement', { description: 'Get company income statement (annual or quarterly)', inputSchema: FinancialStatementSchema, }, async (args: z.infer<typeof FinancialStatementSchema>) => { try { const period = args.period || 'annual'; const limit = args.limit || 5; const data = await fetchFMP<IncomeStatement[]>( `/income-statement?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}` ); return jsonResponse(data); } catch (error) { return errorResponse(error); } } ); // Balance Sheet server.registerTool( 'get_balance_sheet', { description: 'Get company balance sheet statement (annual or quarterly)', inputSchema: FinancialStatementSchema, }, async (args: z.infer<typeof FinancialStatementSchema>) => { try { const period = args.period || 'annual'; const limit = args.limit || 5; const data = await fetchFMP<BalanceSheet[]>( `/balance-sheet-statement?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}` ); return jsonResponse(data); } catch (error) { return errorResponse(error); } } ); // Cash Flow server.registerTool( 'get_cash_flow', { description: 'Get company cash flow statement (annual or quarterly)', inputSchema: FinancialStatementSchema, }, async (args: z.infer<typeof FinancialStatementSchema>) => { try { const period = args.period || 'annual'; const limit = args.limit || 5; const data = await fetchFMP<CashFlow[]>( `/cash-flow-statement?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}` ); return jsonResponse(data); } catch (error) { return errorResponse(error); } } ); // Stock News server.registerTool( 'get_stock_news', { description: 'Get latest news articles for a stock symbol', inputSchema: StockNewsSchema, }, async (args: z.infer<typeof StockNewsSchema>) => { try { const limit = args.limit || 10; const data = await fetchFMP(`/news/stock?symbols=${args.symbol.toUpperCase()}&limit=${limit}`); return jsonResponse(data); } catch (error) { return errorResponse(error); } } ); // Key Metrics server.registerTool( 'get_key_metrics', { description: 'Get key financial metrics (P/E, ROE, debt ratios, etc.)', inputSchema: FinancialStatementSchema, }, async (args: z.infer<typeof FinancialStatementSchema>) => { try { const period = args.period || 'annual'; const limit = args.limit || 5; const data = await fetchFMP( `/key-metrics?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}` ); return jsonResponse(data); } catch (error) { return errorResponse(error); } } ); // Financial Ratios server.registerTool( 'get_financial_ratios', { description: 'Get detailed financial ratios (profitability, liquidity, efficiency)', inputSchema: FinancialStatementSchema, }, async (args: z.infer<typeof FinancialStatementSchema>) => { try { const period = args.period || 'annual'; const limit = args.limit || 5; const data = await fetchFMP( `/ratios?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}` ); return jsonResponse(data); } catch (error) { return errorResponse(error); } } ); }