get_coins
Retrieve a customizable list of coins from the Pump Fun Data MCP Server. Specify offset, limit, sorting, and filters to fetch data tailored to your needs.
Instructions
Get a list of coins
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeNsfw | No | Include NSFW coins (default: true) | |
| limit | No | The number of coins to return (default: 24) | |
| offset | No | The offset to start from (default: 0) | |
| order | No | The order to sort by (ASC, DESC) | DESC |
| sort | No | The field to sort by (market_cap, last_trade_timestamp, created_timestamp, last_reply) | market_cap |
Implementation Reference
- index.ts:93-101 (handler)The switch case that handles the execution of the 'get_coins' tool by constructing the API URL and calling fetchPumpFunData with the provided arguments.case "get_coins": url = PUMP_FUN_API_URL+'/coins'; return { content: [{ type: "text", text: JSON.stringify((await fetchPumpFunData(url, args))) }], isError: false, };
- index.ts:27-42 (schema)The schema definition for the 'get_coins' tool, specifying input parameters such as offset, limit, sort, includeNsfw, and order.{ name: "get_coins", description: "Get a list of coins", inputSchema: { type: "object", properties: { offset: { type: "number", description: "The offset to start from (default: 0)", default: 0 }, limit: { type: "number", description: "The number of coins to return (default: 24)", default: 24 }, sort: { type: "string", description: "The field to sort by (market_cap, last_trade_timestamp, created_timestamp, last_reply)", default: "market_cap" }, includeNsfw: { type: "boolean", description: "Include NSFW coins (default: true)", default: true }, order: { type: "string", description: "The order to sort by (ASC, DESC)", default: "DESC"}, }, required: [], }, },
- index.ts:148-150 (registration)Registration of the ListToolsRequestSchema handler, which returns the TOOLS array including the 'get_coins' tool.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));
- index.ts:152-154 (registration)Registration of the CallToolRequestSchema handler, which invokes handleToolCall for tool execution including 'get_coins'.server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}) );
- index.ts:56-74 (helper)Helper function used by the 'get_coins' handler to perform HTTP GET requests to the pump.fun API with specific headers.async function fetchPumpFunData(url: string, params: any) { const headers = { 'accept': '*/*', 'accept-language': 'en-US,en;q=0.9', 'content-type': 'application/json', 'origin': 'https://pump.fun', 'priority': 'u=1, i', 'referer': 'https://pump.fun/', 'sec-ch-ua': '"Chromium";v="134", "Not:A-Brand";v="24", "Google Chrome";v="134"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"macOS"', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36' }; const response = await axios.get(url, { params, headers }); if (response.status !== 200 || !response.data) { throw new Error(`Failed to fetch data: ${response.status}`); } return response.data; }