Skip to main content
Glama

get_news_by_sentiment

Filter news articles by sentiment to analyze market trends and relationships in the Spanish stock exchange.

Instructions

Get news articles filtered by sentiment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of articles
sentimentYesNews sentiment

Implementation Reference

  • Core implementation of the get_news_by_sentiment tool. Fetches news articles filtered by specified sentiment from the backend API endpoint.
    async getNewsBySentiment(sentiment: string, limit: number = 20): Promise<any[]> { const data = await this.fetchAPI('/api/news/sentiment', { sentiment: sentiment, limit: limit }); return data.news || []; }
  • src/index.ts:245-264 (registration)
    Registers the 'get_news_by_sentiment' tool in the MCP tools array, including name, description, and input schema definition.
    { 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'], }, },
  • MCP request handler switch case that processes the tool call, parses arguments, and delegates execution to the database layer.
    case 'get_news_by_sentiment': result = await this.db.getNewsBySentiment((args as any)?.sentiment, (args as any)?.limit || 20); break;

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