get_company_news
Retrieve company news from Vietnam's stock market by specifying 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.DataFrame
Input 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 logic. It uses TCBSCompany to fetch news for a given symbol with pagination and formats output as JSON or DataFrame. The @server.tool() decorator also registers it as an MCP tool.@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