Skip to main content
Glama
yakir-Yang

AI Customer Service MCP Server

by yakir-Yang
store-tool.js1.64 kB
export class StoreTool { static async execute(args, dataManager) { const { latitude, longitude, limit = 10 } = args; if (latitude === undefined || longitude === undefined) { throw new Error('经纬度参数不能为空'); } // 验证经纬度范围 if (latitude < -90 || latitude > 90) { throw new Error('纬度必须在-90到90之间'); } if (longitude < -180 || longitude > 180) { throw new Error('经度必须在-180到180之间'); } const stores = dataManager.queryStoresByLocation(latitude, longitude, limit); if (stores.length === 0) { return { content: [ { type: 'text', text: `在坐标 (${latitude}, ${longitude}) 附近未找到任何网点。`, }, ], }; } // 格式化门店信息 const storeDetails = stores.map(store => ({ 网点名称: store.name, 状态: store.status, 经纬度: `${store.longitude},${store.latitude}`, 详细地址: store.address, 距离: `${store.distance.toFixed(2)}公里`, 营业时间: store.businessHours, 评分: store.rating, 联系电话: store.phone, 门店类型: store.type })); const resultText = `找到 ${stores.length} 个附近网点:\n\n` + storeDetails.map((store, index) => `网点 ${index + 1}:\n` + Object.entries(store) .map(([key, value]) => ` ${key}: ${value}`) .join('\n') ).join('\n\n'); return { content: [ { type: 'text', text: resultText, }, ], }; } }

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/yakir-Yang/mcp_demo'

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