search_fund
Search for mutual funds in the Vietnam stock market by name using partial matching and retrieve results in JSON or DataFrame format.
Instructions
Search fund by name from stock market
Args:
keyword: str (partial match for fund name to search)
output_format: Literal['json', 'dataframe'] = 'json'
Returns:
pd.DataFrame
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keyword | Yes | ||
| output_format | No | json |
Implementation Reference
- src/vnstock_mcp/server.py:520-536 (handler)The main handler function for the 'search_fund' tool, decorated with @server.tool() for registration in FastMCP. It searches funds using FMarketFund.filter and returns data in JSON or DataFrame format.@server.tool() def search_fund(keyword: str, output_format: Literal["json", "dataframe"] = "json"): """ Search fund by name from stock market Args: keyword: str (partial match for fund name to search) output_format: Literal['json', 'dataframe'] = 'json' Returns: pd.DataFrame """ fund = FMarketFund() df = fund.filter(symbol=keyword) if output_format == "json": return df.to_json(orient="records", force_ascii=False) else: return df
- src/vnstock_mcp/server.py:520-520 (registration)The @server.tool() decorator registers the search_fund function as an MCP tool named 'search_fund'.@server.tool()
- src/vnstock_mcp/server.py:522-528 (schema)Docstring and type hints define the input schema (keyword: str, output_format: Literal) and output (pd.DataFrame or JSON).""" Search fund by name from stock market Args: keyword: str (partial match for fund name to search) output_format: Literal['json', 'dataframe'] = 'json' Returns: pd.DataFrame