Skip to main content
Glama
zhenzp

Fund MCP Server

by zhenzp

fund.stock_search

Search for stock information using stock codes, names, or pinyin abbreviations to retrieve financial data from East Money API.

Instructions

搜索股票信息,基于东方财富API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes搜索关键字,如股票代码、股票名称或拼音简称
countNo返回结果数量,默认10,最大50

Implementation Reference

  • The core handler function that parses arguments with Zod schema, constructs URL for EastMoney stock suggest API, fetches data, and returns JSON stringified response.
    async function handleStockSearch(args: unknown) { const { input, count = 10 } = stockSearchSchema.parse(args); const url = new URL(STOCK_SEARCH_API_URL); url.searchParams.set("input", input); url.searchParams.set("type", "14"); url.searchParams.set("status", "1"); url.searchParams.set("count", String(count)); const response = await fetch(url.toString(), { method: "GET", headers: { Accept: "application/json", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", }, }); console.log('response', response) if (!response.ok) { throw new Error( `Stock search API request failed: ${response.status} ${response.statusText}` ); } let data: any; try { data = await response.json(); } catch (e) { throw new Error("Stock search API returned invalid JSON"); } console.log('handleStockSearch', data); return { content: [{ type: "text", text: JSON.stringify(data) }], }; }
  • Zod schema for input validation of the stock_search tool.
    const stockSearchSchema = z.object({ input: z.string().min(1, "搜索关键字不能为空"), count: z.number().int().positive().max(50).optional().default(10), });
  • Dispatch logic in the main handleToolRequest function that routes fund.stock_search calls to the specific handler.
    if (name === "fund.stock_search") { return await handleStockSearch(args); }
  • MCP tool definition including name, description, and input schema for registration in getAllTools().
    { name: 'fund.stock_search', description: '搜索股票信息,基于东方财富API', inputSchema: { type: 'object', properties: { input: { type: 'string', description: '搜索关键字,如股票代码、股票名称或拼音简称', minLength: 1 }, count: { type: 'number', description: '返回结果数量,默认10,最大50', minimum: 1, maximum: 50, default: 10 } }, required: ['input'] } }
  • The getAllTools function that registers all available tools, including fund.stock_search.
    export const getAllTools = () => [ { name: 'fund.echo', description: 'Echo back a message. Example interface for scaffold.', inputSchema: { type: 'object', properties: { message: { type: 'string', description: 'Text to echo back' } }, required: ['message'] } }, { name: 'fund.knoewledge', description: '获取的知识库列表信息', inputSchema: { type: 'object', properties: { kw: { type: 'string', description: '关键词,支持模糊查询' }, pageSize: { type: 'number', description: '每页数量,默认10' }, pageNum: { type: 'number', description: '页码,默认1' } }, } }, { name: 'fund.stock_search', description: '搜索股票信息,基于东方财富API', inputSchema: { type: 'object', properties: { input: { type: 'string', description: '搜索关键字,如股票代码、股票名称或拼音简称', minLength: 1 }, count: { type: 'number', description: '返回结果数量,默认10,最大50', minimum: 1, maximum: 50, default: 10 } }, required: ['input'] } } ];
Install Server

Other Tools

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/zhenzp/fund-mcp-server'

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