get_company_news
Retrieve company news from Vietnam's stock market by providing a stock symbol, with options to paginate results and choose output format.
Instructions
Get company news from stock market
Args:
symbol: str
page_size: int = 10
page: int = 0
output_format: Literal['json', 'dataframe'] = 'json'
Returns:
pd.DataFrameInput Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | ||
| page_size | No | ||
| page | No | ||
| output_format | No | json |
Implementation Reference
- src/vnstock_mcp/server.py:43-65 (handler)The handler function implementing the 'get_company_news' tool. It is registered via the @server.tool() decorator. Fetches news data for a given company symbol using the TCBSCompany class from the vnstock library, supports JSON or DataFrame output.
@server.tool() def get_company_news( symbol: str, page_size: int = 10, page: int = 0, output_format: Literal["json", "dataframe"] = "json", ): """ Get company news from stock market Args: symbol: str page_size: int = 10 page: int = 0 output_format: Literal['json', 'dataframe'] = 'json' Returns: pd.DataFrame """ equity = TCBSCompany(symbol=symbol) df = equity.news(page_size=page_size, page=page) if output_format == "json": return df.to_json(orient="records", force_ascii=False) else: return df