get_recent_news
Retrieve recent news articles about Spanish stock exchange companies, with optional filtering by specific company to analyze market relationships.
Instructions
Get recent news articles, optionally filtered by company
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| companyId | No | Optional: Company ID to filter by | |
| limit | No | Maximum number of articles |
Implementation Reference
- src/database.ts:250-265 (handler)Core handler function that implements the get_recent_news tool logic by fetching recent news from the API, optionally filtered by company ID.async getRecentNews(companyId?: string, limit: number = 20): Promise<any[]> { if (companyId) { const companies = await this.getAllCompanies(); const company = companies.find(c => c.id === companyId); if (!company) return []; const data = await this.fetchAPI('/api/news/company', { symbol: company.symbol, limit: limit }); return data.news || []; } else { const data = await this.fetchAPI('/api/news', { limit: limit }); return data.news || []; } }
- src/index.ts:625-627 (handler)MCP tool dispatcher handler for 'get_recent_news' that extracts parameters and calls the database method.case 'get_recent_news': result = await this.db.getRecentNews((args as any)?.companyId, (args as any)?.limit || 20); break;
- src/index.ts:227-244 (registration)Tool registration in the ListToolsRequestSchema handler, including name, description, and input schema definition.{ name: 'get_recent_news', description: 'Get recent news articles, optionally filtered by company', inputSchema: { type: 'object', properties: { companyId: { type: 'string', description: 'Optional: Company ID to filter by', }, limit: { type: 'number', description: 'Maximum number of articles', default: 20, }, }, }, },
- src/index.ts:230-243 (schema)Input schema definition for the get_recent_news tool parameters.inputSchema: { type: 'object', properties: { companyId: { type: 'string', description: 'Optional: Company ID to filter by', }, limit: { type: 'number', description: 'Maximum number of articles', default: 20, }, }, },