analyze_fund
Evaluate investment fund performance in Turkey by inputting fund code, start date, initial investment, and optional monthly contributions with yearly growth adjustments.
Instructions
Fon için yatırım analizi yapar
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Fon kodu | |
| includeMonthlyDetails | No | Aylık detayları getir (varsayılan: true) | |
| initialInvestment | Yes | Başlangıç yatırımı (TL) | |
| monthlyInvestment | No | Aylık yatırım tutarı (TL, opsiyonel) | |
| startDate | Yes | Başlangıç tarihi | |
| yearlyIncreaseType | No | Yıllık artış tipi (opsiyonel) | |
| yearlyIncreaseValue | No | Yıllık artış değeri (opsiyonel) |
Input Schema (JSON Schema)
{
"properties": {
"code": {
"description": "Fon kodu",
"type": "string"
},
"includeMonthlyDetails": {
"description": "Aylık detayları getir (varsayılan: true)",
"type": "boolean"
},
"initialInvestment": {
"description": "Başlangıç yatırımı (TL)",
"minimum": 0,
"type": "number"
},
"monthlyInvestment": {
"description": "Aylık yatırım tutarı (TL, opsiyonel)",
"minimum": 0,
"type": "number"
},
"startDate": {
"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"
],
"type": "string"
},
"yearlyIncreaseType": {
"description": "Yıllık artış tipi (opsiyonel)",
"enum": [
"percentage",
"amount"
],
"type": "string"
},
"yearlyIncreaseValue": {
"description": "Yıllık artış değeri (opsiyonel)",
"minimum": 0,
"type": "number"
}
},
"required": [
"code",
"startDate",
"initialInvestment"
],
"type": "object"
}
Implementation Reference
- src/tools.ts:489-502 (handler)The handler logic in handleToolCall method that validates input parameters using AnalyzeFundSchema and calls the apiClient.analyzeFund method to execute the tool.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-31 (schema)Zod schema used for input validation in the analyze_fund tool handler.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 definition including name, description, and JSON input schema.{ 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'] } },
- src/api-client.ts:85-99 (helper)Supporting API client method that makes the HTTP GET request to the external API endpoint for fund analysis.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/types.ts:158-167 (schema)TypeScript interface defining the input parameters for fund analysis, matching the Zod schema.export interface FundAnalysisParams { code: string; startDate: '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: number; monthlyInvestment?: number; yearlyIncrease?: { type: 'percentage' | 'amount'; value: number; }; includeMonthlyDetails?: boolean;