@solworks/poll-mcp 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ function jsonPropToZod(prop) {
23
23
  }
24
24
  }
25
25
  export function createServer(config, clientOverride) {
26
- const server = new McpServer({ name: 'poll-fun', version: '0.1.0' }, { capabilities: { tools: {}, resources: {}, prompts: {} } });
26
+ const server = new McpServer({ name: 'poll-fun', version: '0.1.18' }, { capabilities: { tools: {}, resources: {}, prompts: {} } });
27
27
  const client = clientOverride ??
28
28
  new PollClient({
29
29
  apiUrl: config?.apiUrl ?? 'https://api.poll.fun',
@@ -187,7 +187,15 @@ export const TOOL_DEFINITIONS = {
187
187
  async handler(args, client) {
188
188
  try {
189
189
  const active = args.active;
190
- const wagers = await client.getMyWagers({ active });
190
+ let wagers = await client.getMyWagers();
191
+ if (active) {
192
+ const activeStatuses = new Set(['EMPTY', 'PLACED']);
193
+ wagers = wagers.filter((w) => {
194
+ const bet = w.ProgramBet;
195
+ const betStatus = bet?.status;
196
+ return activeStatuses.has(w.status) && betStatus === 'OPEN';
197
+ });
198
+ }
191
199
  if (wagers.length === 0)
192
200
  return textResult('No wagers found.');
193
201
  const lines = wagers.map((w, i) => {
@@ -294,13 +302,10 @@ export const TOOL_DEFINITIONS = {
294
302
  try {
295
303
  const page = args.page;
296
304
  const notifications = await client.getNotifications({ page });
297
- const display = notifications.slice(0, 20);
298
- if (display.length === 0)
305
+ if (notifications.length === 0)
299
306
  return textResult('No notifications found.');
300
- const lines = display.map((n, i) => `${i + 1}. [${n.read ? 'Read' : 'Unread'}] ${n.title}${n.body ? ` — ${n.body}` : ''} (${n.createdAt})`);
307
+ const lines = notifications.map((n, i) => `${i + 1}. [${n.readAt ? 'Read' : 'Unread'}] ${n.title}${n.description ? ` — ${n.description}` : ''} (${n.createdAt})`);
301
308
  let text = `Notifications:\n${lines.join('\n')}`;
302
- if (notifications.length > 20)
303
- text += `\n\n(Showing 20 of ${notifications.length})`;
304
309
  return textResult(text);
305
310
  }
306
311
  catch (err) {
@@ -365,7 +370,7 @@ export const TOOL_DEFINITIONS = {
365
370
  const history = await client.getProbabilityHistory(betAddress);
366
371
  if (history.length === 0)
367
372
  return textResult('No probability history available.');
368
- const lines = history.map((p) => ` ${p.timestamp}: ${(p.probability * 100).toFixed(1)}%`);
373
+ const lines = history.map((p) => ` ${p.timestamp}: For ${p.probability.toFixed(1)}% / Against ${(p.againstProbability ?? (100 - p.probability)).toFixed(1)}%`);
369
374
  return textResult(`Probability History for ${betAddress}:\n${lines.join('\n')}`);
370
375
  }
371
376
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solworks/poll-mcp",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "MCP server for Poll.fun. See documentation at https://dev.poll.fun",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",