Skip to main content
Glama

get_news_by_sentiment

Filter news articles by sentiment (positive, negative, or neutral) to analyze market trends and relationships in the Spanish stock exchange.

Instructions

Get news articles filtered by sentiment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sentimentYesNews sentiment
limitNoMaximum number of articles

Implementation Reference

  • src/index.ts:245-264 (registration)
    Tool registration in the list of tools returned by ListToolsRequestSchema, including name, description, and input schema.
    { name: 'get_news_by_sentiment', description: 'Get news articles filtered by sentiment', inputSchema: { type: 'object', properties: { sentiment: { type: 'string', enum: ['positive', 'negative', 'neutral'], description: 'News sentiment', }, limit: { type: 'number', description: 'Maximum number of articles', default: 20, }, }, required: ['sentiment'], }, },
  • Tool execution handler in the CallToolRequestSchema switch statement that delegates to the DatabaseManager's getNewsBySentiment method with parsed input arguments.
    case 'get_news_by_sentiment': result = await this.db.getNewsBySentiment((args as any)?.sentiment, (args as any)?.limit || 20); break;
  • Helper method in DatabaseManager that fetches news articles filtered by sentiment from the backend API endpoint '/api/news/sentiment'.
    async getNewsBySentiment(sentiment: string, limit: number = 20): Promise<any[]> { const data = await this.fetchAPI('/api/news/sentiment', { sentiment: sentiment, limit: limit }); return data.news || []; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/anbrme/ibex35-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server