analyze_fund
Analyzes investment fund performance in Turkey by calculating returns based on initial investment, time periods, and optional monthly contributions with growth adjustments.
Instructions
Fon için yatırım analizi yapar
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Fon kodu | |
| startDate | Yes | Başlangıç tarihi | |
| initialInvestment | Yes | Başlangıç yatırımı (TL) | |
| monthlyInvestment | No | Aylık yatırım tutarı (TL, opsiyonel) | |
| yearlyIncreaseType | No | Yıllık artış tipi (opsiyonel) | |
| yearlyIncreaseValue | No | Yıllık artış değeri (opsiyonel) | |
| includeMonthlyDetails | No | Aylık detayları getir (varsayılan: true) |
Implementation Reference
- src/api-client.ts:85-99 (handler)Core handler function that executes the analysis by making an API call to the /funds/{code}/analyze endpoint with prepared query parameters.async analyzeFund(params: FundAnalysisParams): Promise<FundAnalysisResult> { const { code, ...queryParams } = params; // Nested object'i düzleştir const flatParams: Record<string, any> = { ...queryParams, 'yearlyIncrease.type': params.yearlyIncrease?.type, 'yearlyIncrease.value': params.yearlyIncrease?.value }; const response: AxiosResponse<FundAnalysisResult> = await this.client.get(`/funds/${code}/analyze`, { params: flatParams }); return response.data; }
- src/tools.ts:489-502 (handler)Tool dispatch handler in handleToolCall that validates input with AnalyzeFundSchema and invokes apiClient.analyzeFund.case 'analyze_fund': const analyzeParams = AnalyzeFundSchema.parse(args); const yearlyIncrease = analyzeParams.yearlyIncreaseType && analyzeParams.yearlyIncreaseValue ? { type: analyzeParams.yearlyIncreaseType, value: analyzeParams.yearlyIncreaseValue } : undefined; return await this.apiClient.analyzeFund({ code: analyzeParams.code, startDate: analyzeParams.startDate, initialInvestment: analyzeParams.initialInvestment, monthlyInvestment: analyzeParams.monthlyInvestment, yearlyIncrease, includeMonthlyDetails: analyzeParams.includeMonthlyDetails });
- src/tools.ts:24-32 (schema)Zod schema definition for input validation of analyze_fund tool parameters.const AnalyzeFundSchema = z.object({ code: z.string(), startDate: z.enum(['last_1_day', 'last_1_week', 'last_1_month', 'last_3_months', 'last_6_months', 'year_start', 'last_1_year', 'last_3_years', 'last_5_years']), initialInvestment: z.number().min(0), monthlyInvestment: z.number().min(0).optional(), yearlyIncreaseType: z.enum(['percentage', 'amount']).optional(), yearlyIncreaseValue: z.number().min(0).optional(), includeMonthlyDetails: z.boolean().optional() });
- src/tools.ts:183-225 (registration)MCP tool registration entry in getTools() array, defining name, description, and input schema for analyze_fund.{ name: 'analyze_fund', description: 'Fon için yatırım analizi yapar', inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'Fon kodu' }, startDate: { type: 'string', description: 'Başlangıç tarihi', enum: ['last_1_day', 'last_1_week', 'last_1_month', 'last_3_months', 'last_6_months', 'year_start', 'last_1_year', 'last_3_years', 'last_5_years'] }, initialInvestment: { type: 'number', description: 'Başlangıç yatırımı (TL)', minimum: 0 }, monthlyInvestment: { type: 'number', description: 'Aylık yatırım tutarı (TL, opsiyonel)', minimum: 0 }, yearlyIncreaseType: { type: 'string', description: 'Yıllık artış tipi (opsiyonel)', enum: ['percentage', 'amount'] }, yearlyIncreaseValue: { type: 'number', description: 'Yıllık artış değeri (opsiyonel)', minimum: 0 }, includeMonthlyDetails: { type: 'boolean', description: 'Aylık detayları getir (varsayılan: true)' } }, required: ['code', 'startDate', 'initialInvestment'] } },