@superagnt/reddit-data 2.0.2
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/README.md +72 -0
- package/index.js +1079 -0
- package/openclaw.plugin.json +16 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Reddit data for OpenClaw — superagnt plugin
|
|
2
|
+
|
|
3
|
+
Use one API key to pull Reddit data (subreddits, posts, and community data) for agents, automations, and analytics. Structured JSON, credit-based pricing, no separate vendor accounts. Unified access to subreddit metadata, post threads, user activity, and search. Built for LLMs and automation — not one-off scraping.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
openclaw plugins install @superagnt/reddit-data
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This package is the official **OpenClaw** plugin for **Reddit** social and public data via [superagnt](https://superagnt.com). Pair it with the [documentation](https://superagnt.com) and your superagnt API key.
|
|
12
|
+
|
|
13
|
+
## Live MCP mode (recommended)
|
|
14
|
+
|
|
15
|
+
Set a workspace MCP token and the plugin upgrades itself at load: it fetches
|
|
16
|
+
the live tool list from the scoped MCP endpoint and proxies calls through it —
|
|
17
|
+
the tool surface then grows with `agnt_tools_enable`, no plugin update needed.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
export SUPERAGNT_MCP_TOKEN=... # from the MCP server card in the dashboard
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Without the token the plugin uses its built-in toolset with your
|
|
24
|
+
`SUPERAGNT_API_KEY` — no behavior change from previous versions.
|
|
25
|
+
|
|
26
|
+
## Overview
|
|
27
|
+
|
|
28
|
+
Unified access to subreddit metadata, post threads, user activity, and search. Built for LLMs and automation — not one-off scraping.
|
|
29
|
+
|
|
30
|
+
### Highlights
|
|
31
|
+
|
|
32
|
+
- Structured JSON responses for Reddit resources
|
|
33
|
+
- Single API key and unified credit balance across superagnt
|
|
34
|
+
- Designed for agent workflows, batch jobs, and real-time tools
|
|
35
|
+
- Composable with other superagnt providers in one stack
|
|
36
|
+
- OpenAPI-documented endpoints for codegen and testing
|
|
37
|
+
|
|
38
|
+
### Example use cases
|
|
39
|
+
|
|
40
|
+
- Social and creator intelligence agents using Reddit
|
|
41
|
+
- Marketing and research teams monitoring accounts and content
|
|
42
|
+
- Product teams building alerts, digests, and dashboards
|
|
43
|
+
- Developers prototyping LLM tools that need live network data
|
|
44
|
+
- Data teams joining Reddit signals with CRM or warehouse data
|
|
45
|
+
|
|
46
|
+
## Authentication
|
|
47
|
+
|
|
48
|
+
Use a single **superagnt API key** (Bearer token). Set `SUPERAGNT_API_KEY` in your environment, or complete browser login when the gateway prompts you. Create and manage keys in the [superagnt dashboard](https://app.superagnt.com/dashboard).
|
|
49
|
+
|
|
50
|
+
## API coverage
|
|
51
|
+
|
|
52
|
+
| | |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| **Platform** | `reddit` |
|
|
55
|
+
| **REST base** | `https://api.superagnt.com/v1/data/reddit` |
|
|
56
|
+
| **OpenAPI operations** | 29 |
|
|
57
|
+
| **OpenClaw tools** | 29 |
|
|
58
|
+
|
|
59
|
+
## Documentation
|
|
60
|
+
|
|
61
|
+
- [Documentation](https://superagnt.com) — getting started and concepts
|
|
62
|
+
- [API reference (Reddit)](https://superagnt.com/apis/social/reddit) — endpoints and schemas
|
|
63
|
+
- [Dashboard](https://app.superagnt.com/dashboard) — API keys and usage
|
|
64
|
+
|
|
65
|
+
## Related
|
|
66
|
+
|
|
67
|
+
- **Skill (curl-oriented):** `clawhub install reddit-data` on [ClawHub](https://clawhub.ai/superagnt/skills/reddit-data)
|
|
68
|
+
- **All platforms plugin:** `@superagnt/openclaw-agnt-data` if you need LinkedIn, YouTube, TikTok, X, Instagram, Reddit, and Facebook in one package.
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
MIT
|
package/index.js
ADDED
|
@@ -0,0 +1,1079 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reddit Data — OpenClaw plugin
|
|
3
|
+
* Auto-generated by @superagnt/clawhub. Do not edit by hand.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { homedir as _homedir } from 'node:os'
|
|
7
|
+
import { join as _join } from 'node:path'
|
|
8
|
+
import { existsSync as _existsSync, readFileSync as _readFileSync } from 'node:fs'
|
|
9
|
+
|
|
10
|
+
const BASE_URL = 'https://api.superagnt.com/v1/data/reddit'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// ── Auth Module (inlined) ────────────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
function getConfigPath() {
|
|
16
|
+
return _join(_homedir(), '.superagnt', 'config.json')
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function readAgntConfig() {
|
|
20
|
+
const configFile = getConfigPath()
|
|
21
|
+
if (!_existsSync(configFile)) return null
|
|
22
|
+
try {
|
|
23
|
+
return JSON.parse(_readFileSync(configFile, 'utf-8'))
|
|
24
|
+
} catch {
|
|
25
|
+
return null
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ── End Auth Module ──────────────────────────────────────────────────────────
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// ── CLI Module (inlined) ─────────────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
function maskApiKey(key) {
|
|
35
|
+
if (!key || typeof key !== 'string') return '(none)'
|
|
36
|
+
const k = key.trim()
|
|
37
|
+
if (k.length <= 8) return k.slice(0, 2) + '…'
|
|
38
|
+
return k.slice(0, 6) + '…' + k.slice(-4)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function registerAgntCli(api) {
|
|
42
|
+
api.registerCli(
|
|
43
|
+
({ program }) => {
|
|
44
|
+
const cmd = program
|
|
45
|
+
.command('superagnt')
|
|
46
|
+
.description('superagnt social data API (status, doctor)')
|
|
47
|
+
|
|
48
|
+
cmd
|
|
49
|
+
.command('status')
|
|
50
|
+
.description('Show whether an API key is configured (masked)')
|
|
51
|
+
.action(async () => {
|
|
52
|
+
const cfg = readAgntConfig()
|
|
53
|
+
const key = cfg?.apiKey
|
|
54
|
+
|
|
55
|
+
console.log('\nsuperagnt status\n')
|
|
56
|
+
if (!key) {
|
|
57
|
+
console.log(' API key: not configured')
|
|
58
|
+
console.log(' Workspace: —')
|
|
59
|
+
console.log('\n Get your API key at: https://app.superagnt.com/dashboard\n')
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
console.log(' API key: ' + maskApiKey(key) + ' (from ~/.superagnt/config.json)')
|
|
63
|
+
console.log(' Workspace: ' + (cfg?.workspaceId ?? '—'))
|
|
64
|
+
console.log('')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
cmd
|
|
68
|
+
.command('doctor')
|
|
69
|
+
.description('Check connectivity and validate API key against api.superagnt.dev')
|
|
70
|
+
.action(async () => {
|
|
71
|
+
console.log('\nsuperagnt doctor\n')
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
const publicRes = await fetch('https://api.superagnt.com/v1/platforms')
|
|
75
|
+
console.log(' Public API: ' + (publicRes.ok ? 'OK (' + publicRes.status + ')' : 'HTTP ' + publicRes.status))
|
|
76
|
+
} catch (err) {
|
|
77
|
+
const msg = err instanceof Error ? err.message : String(err)
|
|
78
|
+
console.log(' Public API: failed — ' + msg)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const cfg = readAgntConfig()
|
|
82
|
+
const key = cfg?.apiKey
|
|
83
|
+
|
|
84
|
+
if (!key) {
|
|
85
|
+
console.log('\n Authenticated: skipped (no API key)')
|
|
86
|
+
console.log(' Get your API key at: https://app.superagnt.com/dashboard\n')
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
const res = await fetch('https://api.superagnt.com/v1/platforms', {
|
|
92
|
+
headers: { Authorization: 'Bearer ' + key },
|
|
93
|
+
})
|
|
94
|
+
const text = await res.text()
|
|
95
|
+
let summary = 'HTTP ' + res.status
|
|
96
|
+
if (res.ok) {
|
|
97
|
+
try {
|
|
98
|
+
const json = JSON.parse(text)
|
|
99
|
+
const n = Array.isArray(json?.data) ? json.data.length : (json?.data ? Object.keys(json.data).length : 'ok')
|
|
100
|
+
summary = 'OK — platforms payload received (' + (typeof n === 'number' ? n + ' entries' : String(n)) + ')'
|
|
101
|
+
} catch {
|
|
102
|
+
summary = 'OK (' + res.status + ')'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
console.log(' Authenticated: ' + summary)
|
|
106
|
+
if (!res.ok) {
|
|
107
|
+
console.log(' If 401, get a new key at: https://app.superagnt.com/dashboard')
|
|
108
|
+
}
|
|
109
|
+
} catch (err) {
|
|
110
|
+
const msg = err instanceof Error ? err.message : String(err)
|
|
111
|
+
console.log(' Authenticated: failed — ' + msg)
|
|
112
|
+
}
|
|
113
|
+
console.log('')
|
|
114
|
+
})
|
|
115
|
+
},
|
|
116
|
+
{ commands: ['superagnt'] },
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ── End CLI Module ───────────────────────────────────────────────────────────
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
// ── System prompt (inlined) ─────────────────────────────────────────────────
|
|
124
|
+
|
|
125
|
+
function getSystemPrompt(state) {
|
|
126
|
+
const scope = "Only the Reddit API (reddit)."
|
|
127
|
+
if (state.ready && state.toolCount > 0) {
|
|
128
|
+
return (
|
|
129
|
+
'<superagnt>\n' +
|
|
130
|
+
'Ignore pretrained knowledge about superagnt tool names — use only tools that exist in this session.\n' +
|
|
131
|
+
'\n' +
|
|
132
|
+
'## What superagnt is\n' +
|
|
133
|
+
'superagnt exposes **structured social-data HTTP APIs** behind OpenClaw tools. Scope for this plugin: **' + scope + '**.\n' +
|
|
134
|
+
'\n' +
|
|
135
|
+
'## When to use superagnt tools\n' +
|
|
136
|
+
'- Use superagnt when the user needs **live social/network data** (profiles, posts, companies, comments, etc.) from supported platforms.\n' +
|
|
137
|
+
'- Prefer **discovery** when unsure which endpoint fits: call public discovery (GET /v1/platforms and GET /v1/platforms/{slug}) or read tool descriptions; do not invent endpoints or parameters.\n' +
|
|
138
|
+
'\n' +
|
|
139
|
+
'## Platform selection (high level)\n' +
|
|
140
|
+
'- **linkedin** — B2B enrichment, org/person research, hiring/sales workflows\n' +
|
|
141
|
+
'- **youtube** / **tiktok** — video/creator/channel metadata and content signals\n' +
|
|
142
|
+
'- **x** / **reddit** — short-form social and community threads\n' +
|
|
143
|
+
'- **instagram** — visual/creator discovery where Instagram is the source of truth\n' +
|
|
144
|
+
'- **facebook** — pages/groups/marketplace/adjacent Facebook surface areas exposed by the API\n' +
|
|
145
|
+
'\n' +
|
|
146
|
+
'## Rules\n' +
|
|
147
|
+
'- Do **not** fabricate tool names — pick from the registered superagnt_* tools only.\n' +
|
|
148
|
+
'- If authentication fails (401), tell the user to get a new key at https://app.superagnt.com/dashboard\n' +
|
|
149
|
+
'</superagnt>'
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (state.ready && state.toolCount === 0) {
|
|
154
|
+
return (
|
|
155
|
+
'<superagnt>\n' +
|
|
156
|
+
'The superagnt plugin loaded but registered **zero** API tools. Check your OpenClaw plugin packaging and regenerate the plugin from @superagnt/clawhub.\n' +
|
|
157
|
+
'</superagnt>'
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (state.error) {
|
|
162
|
+
return (
|
|
163
|
+
'<superagnt>\n' +
|
|
164
|
+
'superagnt plugin diagnostic: ' + state.error + '\n' +
|
|
165
|
+
'Do not pretend superagnt tools exist. Ask the user to fix configuration and restart the gateway.\n' +
|
|
166
|
+
'</superagnt>'
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
'<superagnt>\n' +
|
|
172
|
+
'superagnt tools are still loading. If the user asks for social data right now, ask them to wait a moment and retry.\n' +
|
|
173
|
+
'</superagnt>'
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// ── End System prompt ────────────────────────────────────────────────────────
|
|
178
|
+
|
|
179
|
+
const MCP_URL = 'https://mcp.superagnt.com/mcp/reddit'
|
|
180
|
+
|
|
181
|
+
async function mcpRpc(token, method, params) {
|
|
182
|
+
const res = await fetch(MCP_URL, {
|
|
183
|
+
method: 'POST',
|
|
184
|
+
headers: {
|
|
185
|
+
Authorization: `Bearer ${token}`,
|
|
186
|
+
'Content-Type': 'application/json',
|
|
187
|
+
Accept: 'application/json, text/event-stream',
|
|
188
|
+
},
|
|
189
|
+
body: JSON.stringify({ jsonrpc: '2.0', id: Date.now(), method, params }),
|
|
190
|
+
})
|
|
191
|
+
if (!res.ok) throw new Error(`MCP ${method} failed: HTTP ${res.status}`)
|
|
192
|
+
const data = await res.json()
|
|
193
|
+
if (data.error) throw new Error(`MCP ${method} error: ${data.error.message}`)
|
|
194
|
+
return data.result
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async function registerLiveMcpTools(api, token) {
|
|
198
|
+
const result = await mcpRpc(token, 'tools/list', {})
|
|
199
|
+
const tools = Array.isArray(result?.tools) ? result.tools : []
|
|
200
|
+
if (tools.length === 0) throw new Error('MCP tools/list returned no tools')
|
|
201
|
+
for (const t of tools) {
|
|
202
|
+
api.registerTool({
|
|
203
|
+
name: t.name,
|
|
204
|
+
description: t.description,
|
|
205
|
+
inputSchema: t.inputSchema,
|
|
206
|
+
execute: async (input) => {
|
|
207
|
+
const args = parseToolInput(input)
|
|
208
|
+
const r = await mcpRpc(token, 'tools/call', { name: t.name, arguments: args })
|
|
209
|
+
if (r && r.structuredContent !== undefined) return r.structuredContent
|
|
210
|
+
const text = Array.isArray(r?.content) ? r.content.find((c) => c.type === 'text')?.text : undefined
|
|
211
|
+
if (text === undefined) return r
|
|
212
|
+
try { return JSON.parse(text) } catch { return text }
|
|
213
|
+
},
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
return tools.length
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function parseToolInput(input) {
|
|
220
|
+
if (input == null) return {}
|
|
221
|
+
if (typeof input === 'object' && !Array.isArray(input)) return input
|
|
222
|
+
if (typeof input === 'string') {
|
|
223
|
+
const trimmed = input.trim()
|
|
224
|
+
if (trimmed.startsWith('{')) {
|
|
225
|
+
try { const parsed = JSON.parse(trimmed); if (typeof parsed === 'object' && parsed && !Array.isArray(parsed)) return parsed } catch {}
|
|
226
|
+
}
|
|
227
|
+
throw new Error('Invalid tool input: expected a JSON object with named parameters, got string: ' + trimmed.slice(0, 80))
|
|
228
|
+
}
|
|
229
|
+
throw new Error('Invalid tool input: expected a JSON object, got ' + typeof input)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function substitutePathParams(path, source) {
|
|
233
|
+
if (!source || typeof source !== 'object' || Array.isArray(source)) {
|
|
234
|
+
return { path, consumed: new Set() }
|
|
235
|
+
}
|
|
236
|
+
const consumed = new Set()
|
|
237
|
+
const next = path.replace(/\{([^/{}]+)\}/g, (_, name) => {
|
|
238
|
+
const v = source[name]
|
|
239
|
+
if (v === undefined || v === null || v === '') return `{${name}}`
|
|
240
|
+
consumed.add(name)
|
|
241
|
+
return encodeURIComponent(String(v))
|
|
242
|
+
})
|
|
243
|
+
return { path: next, consumed }
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
async function callSuperagnt(apiKey, method, path, query, body) {
|
|
247
|
+
const params = (query && typeof query === 'object' && !Array.isArray(query)) ? query : body
|
|
248
|
+
const { path: resolvedPath, consumed } = substitutePathParams(path, params)
|
|
249
|
+
const url = new URL(`${BASE_URL}${resolvedPath}`)
|
|
250
|
+
if (query && typeof query === 'object' && !Array.isArray(query)) {
|
|
251
|
+
for (const [k, v] of Object.entries(query)) {
|
|
252
|
+
if (consumed.has(k)) continue
|
|
253
|
+
if (v !== undefined && v !== '') url.searchParams.set(k, String(v))
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const filteredBody = body && typeof body === 'object' && !Array.isArray(body)
|
|
257
|
+
? Object.fromEntries(Object.entries(body).filter(([k]) => !consumed.has(k)))
|
|
258
|
+
: body
|
|
259
|
+
const res = await fetch(url.toString(), {
|
|
260
|
+
method,
|
|
261
|
+
headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
|
|
262
|
+
body: filteredBody ? JSON.stringify(filteredBody) : undefined,
|
|
263
|
+
})
|
|
264
|
+
if (res.status === 401) {
|
|
265
|
+
return { error: 'Invalid or expired API key. Get a new key at https://app.superagnt.com/dashboard' }
|
|
266
|
+
}
|
|
267
|
+
return res.json()
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export default async function register(api) {
|
|
271
|
+
const apiKey = api.pluginConfig.apiKey || process.env.SUPERAGNT_API_KEY || readAgntConfig()?.apiKey
|
|
272
|
+
const mcpToken = api.pluginConfig.mcpToken || process.env.SUPERAGNT_MCP_TOKEN
|
|
273
|
+
|
|
274
|
+
function ensureApiKey() {
|
|
275
|
+
if (apiKey) return apiKey
|
|
276
|
+
throw new Error(
|
|
277
|
+
'[reddit-data] No API key configured. ' +
|
|
278
|
+
'Get your key at https://app.superagnt.com/dashboard and either:\n' +
|
|
279
|
+
' 1. Export it as SUPERAGNT_API_KEY, or\n' +
|
|
280
|
+
' 2. Add apiKey to your plugin config'
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
registerAgntCli(api)
|
|
285
|
+
|
|
286
|
+
const promptState = { toolCount: 0, error: '', ready: false }
|
|
287
|
+
api.on('before_prompt_build', () => ({
|
|
288
|
+
prependSystemContext: getSystemPrompt(promptState),
|
|
289
|
+
}))
|
|
290
|
+
|
|
291
|
+
// Live MCP mode: a workspace MCP token upgrades this plugin to the server's
|
|
292
|
+
// own tool surface, fetched fresh at load — it grows with agnt_tools_enable
|
|
293
|
+
// and never goes stale. Any failure falls back to the baked toolset below.
|
|
294
|
+
if (mcpToken) {
|
|
295
|
+
try {
|
|
296
|
+
promptState.toolCount = await registerLiveMcpTools(api, mcpToken)
|
|
297
|
+
promptState.ready = true
|
|
298
|
+
return
|
|
299
|
+
} catch (err) {
|
|
300
|
+
promptState.error = 'Live MCP connect failed (' + (err && err.message ? err.message : err) + '); using the built-in toolset.'
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
api.registerTool({
|
|
305
|
+
name: 'superagnt_reddit_Similar_Subreddits',
|
|
306
|
+
description: "Similar Subreddits",
|
|
307
|
+
inputSchema: {
|
|
308
|
+
"type": "object",
|
|
309
|
+
"properties": {
|
|
310
|
+
"cursor": {
|
|
311
|
+
"type": "string",
|
|
312
|
+
"description": "Pagination cursor from previous response"
|
|
313
|
+
},
|
|
314
|
+
"subreddit": {
|
|
315
|
+
"type": "string",
|
|
316
|
+
"description": "Name of the subreddit (e.g. python)"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
"required": [
|
|
320
|
+
"subreddit"
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
execute: async (input) => {
|
|
324
|
+
const key = await ensureApiKey()
|
|
325
|
+
const params = parseToolInput(input)
|
|
326
|
+
return callSuperagnt(key, 'GET', '/getSimilarSubreddits', params)
|
|
327
|
+
},
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
api.registerTool({
|
|
331
|
+
name: 'superagnt_reddit_Post_Duplicates',
|
|
332
|
+
description: "Post Duplicates",
|
|
333
|
+
inputSchema: {
|
|
334
|
+
"type": "object",
|
|
335
|
+
"properties": {
|
|
336
|
+
"cursor": {
|
|
337
|
+
"type": "string",
|
|
338
|
+
"description": "Pagination cursor from previous response"
|
|
339
|
+
},
|
|
340
|
+
"post_url": {
|
|
341
|
+
"type": "string",
|
|
342
|
+
"description": "Full Reddit post URL (e.g."
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
"required": [
|
|
346
|
+
"post_url"
|
|
347
|
+
]
|
|
348
|
+
},
|
|
349
|
+
execute: async (input) => {
|
|
350
|
+
const key = await ensureApiKey()
|
|
351
|
+
const params = parseToolInput(input)
|
|
352
|
+
return callSuperagnt(key, 'GET', '/getPostDuplicates', params)
|
|
353
|
+
},
|
|
354
|
+
})
|
|
355
|
+
|
|
356
|
+
api.registerTool({
|
|
357
|
+
name: 'superagnt_reddit_Subreddit_Moderators',
|
|
358
|
+
description: "Subreddit Moderators",
|
|
359
|
+
inputSchema: {
|
|
360
|
+
"type": "object",
|
|
361
|
+
"properties": {
|
|
362
|
+
"subreddit": {
|
|
363
|
+
"type": "string",
|
|
364
|
+
"description": "Name of the subreddit (e.g. askreddit)"
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
"required": [
|
|
368
|
+
"subreddit"
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
execute: async (input) => {
|
|
372
|
+
const key = await ensureApiKey()
|
|
373
|
+
const params = parseToolInput(input)
|
|
374
|
+
return callSuperagnt(key, 'GET', '/getSubredditModerators', params)
|
|
375
|
+
},
|
|
376
|
+
})
|
|
377
|
+
|
|
378
|
+
api.registerTool({
|
|
379
|
+
name: 'superagnt_reddit_Subreddit_Rules',
|
|
380
|
+
description: "Subreddit Rules",
|
|
381
|
+
inputSchema: {
|
|
382
|
+
"type": "object",
|
|
383
|
+
"properties": {
|
|
384
|
+
"subreddit": {
|
|
385
|
+
"type": "string",
|
|
386
|
+
"description": "Name of the subreddit (e.g. askreddit)"
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
"required": [
|
|
390
|
+
"subreddit"
|
|
391
|
+
]
|
|
392
|
+
},
|
|
393
|
+
execute: async (input) => {
|
|
394
|
+
const key = await ensureApiKey()
|
|
395
|
+
const params = parseToolInput(input)
|
|
396
|
+
return callSuperagnt(key, 'GET', '/getSubredditRules', params)
|
|
397
|
+
},
|
|
398
|
+
})
|
|
399
|
+
|
|
400
|
+
api.registerTool({
|
|
401
|
+
name: 'superagnt_reddit_User_Overview',
|
|
402
|
+
description: "User Overview",
|
|
403
|
+
inputSchema: {
|
|
404
|
+
"type": "object",
|
|
405
|
+
"properties": {
|
|
406
|
+
"sort": {
|
|
407
|
+
"type": "string",
|
|
408
|
+
"description": "Sort order: hot, new, top, controversial"
|
|
409
|
+
},
|
|
410
|
+
"time": {
|
|
411
|
+
"type": "string",
|
|
412
|
+
"description": "Required when sort is top or controversial: hour, day, week, month, year, all"
|
|
413
|
+
},
|
|
414
|
+
"cursor": {
|
|
415
|
+
"type": "string",
|
|
416
|
+
"description": "Pagination cursor from previous response"
|
|
417
|
+
},
|
|
418
|
+
"username": {
|
|
419
|
+
"type": "string",
|
|
420
|
+
"description": "Reddit username (e.g. spez)"
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
"required": [
|
|
424
|
+
"sort",
|
|
425
|
+
"username"
|
|
426
|
+
]
|
|
427
|
+
},
|
|
428
|
+
execute: async (input) => {
|
|
429
|
+
const key = await ensureApiKey()
|
|
430
|
+
const params = parseToolInput(input)
|
|
431
|
+
return callSuperagnt(key, 'GET', '/getUserOverview', params)
|
|
432
|
+
},
|
|
433
|
+
})
|
|
434
|
+
|
|
435
|
+
api.registerTool({
|
|
436
|
+
name: 'superagnt_reddit_Search_Users',
|
|
437
|
+
description: "Search Users",
|
|
438
|
+
inputSchema: {
|
|
439
|
+
"type": "object",
|
|
440
|
+
"properties": {
|
|
441
|
+
"query": {
|
|
442
|
+
"type": "string",
|
|
443
|
+
"description": "Search keyword (e.g. spez)"
|
|
444
|
+
},
|
|
445
|
+
"cursor": {
|
|
446
|
+
"type": "string",
|
|
447
|
+
"description": "Pagination cursor from previous response"
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
"required": [
|
|
451
|
+
"query"
|
|
452
|
+
]
|
|
453
|
+
},
|
|
454
|
+
execute: async (input) => {
|
|
455
|
+
const key = await ensureApiKey()
|
|
456
|
+
const params = parseToolInput(input)
|
|
457
|
+
return callSuperagnt(key, 'GET', '/getSearchUsers', params)
|
|
458
|
+
},
|
|
459
|
+
})
|
|
460
|
+
|
|
461
|
+
api.registerTool({
|
|
462
|
+
name: 'superagnt_reddit_Best_Popular_Posts',
|
|
463
|
+
description: "Best Popular Posts",
|
|
464
|
+
inputSchema: {
|
|
465
|
+
"type": "object",
|
|
466
|
+
"properties": {
|
|
467
|
+
"cursor": {
|
|
468
|
+
"type": "string",
|
|
469
|
+
"description": "Pagination cursor from previous response"
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
execute: async (input) => {
|
|
474
|
+
const key = await ensureApiKey()
|
|
475
|
+
const params = parseToolInput(input)
|
|
476
|
+
return callSuperagnt(key, 'GET', '/getBestPopularPosts', params)
|
|
477
|
+
},
|
|
478
|
+
})
|
|
479
|
+
|
|
480
|
+
api.registerTool({
|
|
481
|
+
name: 'superagnt_reddit_Controversial_Posts_By_Subreddit',
|
|
482
|
+
description: "Controversial Posts By Subreddit",
|
|
483
|
+
inputSchema: {
|
|
484
|
+
"type": "object",
|
|
485
|
+
"properties": {
|
|
486
|
+
"cursor": {
|
|
487
|
+
"type": "string",
|
|
488
|
+
"description": "Pagination cursor from previous response"
|
|
489
|
+
},
|
|
490
|
+
"subreddit": {
|
|
491
|
+
"type": "string",
|
|
492
|
+
"description": "Name of the subreddit (e.g. askreddit)"
|
|
493
|
+
},
|
|
494
|
+
"time": {
|
|
495
|
+
"type": "string",
|
|
496
|
+
"description": "Time filter: hour, day, week, month, year, all"
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
"required": [
|
|
500
|
+
"subreddit",
|
|
501
|
+
"time"
|
|
502
|
+
]
|
|
503
|
+
},
|
|
504
|
+
execute: async (input) => {
|
|
505
|
+
const key = await ensureApiKey()
|
|
506
|
+
const params = parseToolInput(input)
|
|
507
|
+
return callSuperagnt(key, 'GET', '/getControversialPostsBySubreddit', params)
|
|
508
|
+
},
|
|
509
|
+
})
|
|
510
|
+
|
|
511
|
+
api.registerTool({
|
|
512
|
+
name: 'superagnt_reddit_User_Post_Rank_In_Subreddit',
|
|
513
|
+
description: "User Post Rank In Subreddit",
|
|
514
|
+
inputSchema: {
|
|
515
|
+
"type": "object",
|
|
516
|
+
"properties": {
|
|
517
|
+
"sort": {
|
|
518
|
+
"type": "string",
|
|
519
|
+
"description": "Sort order: hot, new, rising, top"
|
|
520
|
+
},
|
|
521
|
+
"username": {
|
|
522
|
+
"type": "string",
|
|
523
|
+
"description": "Reddit username (e.g. spez)"
|
|
524
|
+
},
|
|
525
|
+
"time": {
|
|
526
|
+
"type": "string",
|
|
527
|
+
"description": "Required when sort is top: hour, day, week, month, year, all"
|
|
528
|
+
},
|
|
529
|
+
"subreddit": {
|
|
530
|
+
"type": "string",
|
|
531
|
+
"description": "Name of the subreddit (e.g. reddit)"
|
|
532
|
+
},
|
|
533
|
+
"max_pages": {
|
|
534
|
+
"type": "number",
|
|
535
|
+
"description": "Maximum pages to scan (1-10, default: 4)"
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
"required": [
|
|
539
|
+
"sort",
|
|
540
|
+
"username",
|
|
541
|
+
"subreddit"
|
|
542
|
+
]
|
|
543
|
+
},
|
|
544
|
+
execute: async (input) => {
|
|
545
|
+
const key = await ensureApiKey()
|
|
546
|
+
const params = parseToolInput(input)
|
|
547
|
+
return callSuperagnt(key, 'GET', '/getUserPostRankInSubreddit', params)
|
|
548
|
+
},
|
|
549
|
+
})
|
|
550
|
+
|
|
551
|
+
api.registerTool({
|
|
552
|
+
name: 'superagnt_reddit_Subreddit_Info',
|
|
553
|
+
description: "Subreddit Info",
|
|
554
|
+
inputSchema: {
|
|
555
|
+
"type": "object",
|
|
556
|
+
"properties": {
|
|
557
|
+
"subreddit": {
|
|
558
|
+
"type": "string",
|
|
559
|
+
"description": "subreddit"
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
"required": [
|
|
563
|
+
"subreddit"
|
|
564
|
+
]
|
|
565
|
+
},
|
|
566
|
+
execute: async (input) => {
|
|
567
|
+
const key = await ensureApiKey()
|
|
568
|
+
const params = parseToolInput(input)
|
|
569
|
+
return callSuperagnt(key, 'GET', '/getSubredditInfo', params)
|
|
570
|
+
},
|
|
571
|
+
})
|
|
572
|
+
|
|
573
|
+
api.registerTool({
|
|
574
|
+
name: 'superagnt_reddit_Comments_By_Subreddit',
|
|
575
|
+
description: "Comments By Subreddit",
|
|
576
|
+
inputSchema: {
|
|
577
|
+
"type": "object",
|
|
578
|
+
"properties": {
|
|
579
|
+
"subreddit": {
|
|
580
|
+
"type": "string",
|
|
581
|
+
"description": "subreddit"
|
|
582
|
+
},
|
|
583
|
+
"cursor": {
|
|
584
|
+
"type": "string",
|
|
585
|
+
"description": "cursor"
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
"required": [
|
|
589
|
+
"subreddit"
|
|
590
|
+
]
|
|
591
|
+
},
|
|
592
|
+
execute: async (input) => {
|
|
593
|
+
const key = await ensureApiKey()
|
|
594
|
+
const params = parseToolInput(input)
|
|
595
|
+
return callSuperagnt(key, 'GET', '/getCommentsBySubreddit', params)
|
|
596
|
+
},
|
|
597
|
+
})
|
|
598
|
+
|
|
599
|
+
api.registerTool({
|
|
600
|
+
name: 'superagnt_reddit_Post_Comments_With_Sort',
|
|
601
|
+
description: "Post Comments With Sort",
|
|
602
|
+
inputSchema: {
|
|
603
|
+
"type": "object",
|
|
604
|
+
"properties": {
|
|
605
|
+
"sort": {
|
|
606
|
+
"type": "string",
|
|
607
|
+
"description": "Valid options are: confidence, top, new, controversial, old, qa"
|
|
608
|
+
},
|
|
609
|
+
"cursor": {
|
|
610
|
+
"type": "string",
|
|
611
|
+
"description": "cursor"
|
|
612
|
+
},
|
|
613
|
+
"post_url": {
|
|
614
|
+
"type": "string",
|
|
615
|
+
"description": "post_url"
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
"required": [
|
|
619
|
+
"sort",
|
|
620
|
+
"post_url"
|
|
621
|
+
]
|
|
622
|
+
},
|
|
623
|
+
execute: async (input) => {
|
|
624
|
+
const key = await ensureApiKey()
|
|
625
|
+
const params = parseToolInput(input)
|
|
626
|
+
return callSuperagnt(key, 'GET', '/getPostCommentsWithSort', params)
|
|
627
|
+
},
|
|
628
|
+
})
|
|
629
|
+
|
|
630
|
+
api.registerTool({
|
|
631
|
+
name: 'superagnt_reddit_Profile',
|
|
632
|
+
description: "Profile",
|
|
633
|
+
inputSchema: {
|
|
634
|
+
"type": "object",
|
|
635
|
+
"properties": {
|
|
636
|
+
"username": {
|
|
637
|
+
"type": "string",
|
|
638
|
+
"description": "username"
|
|
639
|
+
}
|
|
640
|
+
},
|
|
641
|
+
"required": [
|
|
642
|
+
"username"
|
|
643
|
+
]
|
|
644
|
+
},
|
|
645
|
+
execute: async (input) => {
|
|
646
|
+
const key = await ensureApiKey()
|
|
647
|
+
const params = parseToolInput(input)
|
|
648
|
+
return callSuperagnt(key, 'GET', '/getProfile', params)
|
|
649
|
+
},
|
|
650
|
+
})
|
|
651
|
+
|
|
652
|
+
api.registerTool({
|
|
653
|
+
name: 'superagnt_reddit_Post_Comments',
|
|
654
|
+
description: "Post Comments",
|
|
655
|
+
inputSchema: {
|
|
656
|
+
"type": "object",
|
|
657
|
+
"properties": {
|
|
658
|
+
"post_url": {
|
|
659
|
+
"type": "string",
|
|
660
|
+
"description": "post_url"
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
"required": [
|
|
664
|
+
"post_url"
|
|
665
|
+
]
|
|
666
|
+
},
|
|
667
|
+
execute: async (input) => {
|
|
668
|
+
const key = await ensureApiKey()
|
|
669
|
+
const params = parseToolInput(input)
|
|
670
|
+
return callSuperagnt(key, 'GET', '/getPostComments', params)
|
|
671
|
+
},
|
|
672
|
+
})
|
|
673
|
+
|
|
674
|
+
api.registerTool({
|
|
675
|
+
name: 'superagnt_reddit_User_Stats',
|
|
676
|
+
description: "User Stats",
|
|
677
|
+
inputSchema: {
|
|
678
|
+
"type": "object",
|
|
679
|
+
"properties": {
|
|
680
|
+
"username": {
|
|
681
|
+
"type": "string",
|
|
682
|
+
"description": "username"
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
"required": [
|
|
686
|
+
"username"
|
|
687
|
+
]
|
|
688
|
+
},
|
|
689
|
+
execute: async (input) => {
|
|
690
|
+
const key = await ensureApiKey()
|
|
691
|
+
const params = parseToolInput(input)
|
|
692
|
+
return callSuperagnt(key, 'GET', '/getUserStats', params)
|
|
693
|
+
},
|
|
694
|
+
})
|
|
695
|
+
|
|
696
|
+
api.registerTool({
|
|
697
|
+
name: 'superagnt_reddit_Search_Posts',
|
|
698
|
+
description: "Search Posts",
|
|
699
|
+
inputSchema: {
|
|
700
|
+
"type": "object",
|
|
701
|
+
"properties": {
|
|
702
|
+
"query": {
|
|
703
|
+
"type": "string",
|
|
704
|
+
"description": "query"
|
|
705
|
+
},
|
|
706
|
+
"cursor": {
|
|
707
|
+
"type": "string",
|
|
708
|
+
"description": "cursor"
|
|
709
|
+
},
|
|
710
|
+
"sort": {
|
|
711
|
+
"type": "string",
|
|
712
|
+
"description": "you can just select one item from below:\n`relevance`\n`hot`\n`top`\n`new`\n`comments`"
|
|
713
|
+
},
|
|
714
|
+
"subreddit": {
|
|
715
|
+
"type": "string",
|
|
716
|
+
"description": "subreddit"
|
|
717
|
+
},
|
|
718
|
+
"time": {
|
|
719
|
+
"type": "string",
|
|
720
|
+
"description": "you can just select one item from below:\n`hour`\n`day`\n`week`\n`month`\n`year`\n`all`"
|
|
721
|
+
}
|
|
722
|
+
},
|
|
723
|
+
"required": [
|
|
724
|
+
"query"
|
|
725
|
+
]
|
|
726
|
+
},
|
|
727
|
+
execute: async (input) => {
|
|
728
|
+
const key = await ensureApiKey()
|
|
729
|
+
const params = parseToolInput(input)
|
|
730
|
+
return callSuperagnt(key, 'GET', '/getSearchPosts', params)
|
|
731
|
+
},
|
|
732
|
+
})
|
|
733
|
+
|
|
734
|
+
api.registerTool({
|
|
735
|
+
name: 'superagnt_reddit_Search_Subreddits',
|
|
736
|
+
description: "Search Subreddits",
|
|
737
|
+
inputSchema: {
|
|
738
|
+
"type": "object",
|
|
739
|
+
"properties": {
|
|
740
|
+
"cursor": {
|
|
741
|
+
"type": "string",
|
|
742
|
+
"description": "cursor"
|
|
743
|
+
},
|
|
744
|
+
"query": {
|
|
745
|
+
"type": "string",
|
|
746
|
+
"description": "query"
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
"required": [
|
|
750
|
+
"query"
|
|
751
|
+
]
|
|
752
|
+
},
|
|
753
|
+
execute: async (input) => {
|
|
754
|
+
const key = await ensureApiKey()
|
|
755
|
+
const params = parseToolInput(input)
|
|
756
|
+
return callSuperagnt(key, 'GET', '/getSearchSubreddits', params)
|
|
757
|
+
},
|
|
758
|
+
})
|
|
759
|
+
|
|
760
|
+
api.registerTool({
|
|
761
|
+
name: 'superagnt_reddit_New_Subreddits',
|
|
762
|
+
description: "New Subreddits",
|
|
763
|
+
inputSchema: {
|
|
764
|
+
"type": "object",
|
|
765
|
+
"properties": {
|
|
766
|
+
"cursor": {
|
|
767
|
+
"type": "string",
|
|
768
|
+
"description": "cursor"
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
execute: async (input) => {
|
|
773
|
+
const key = await ensureApiKey()
|
|
774
|
+
const params = parseToolInput(input)
|
|
775
|
+
return callSuperagnt(key, 'GET', '/getNewSubreddits', params)
|
|
776
|
+
},
|
|
777
|
+
})
|
|
778
|
+
|
|
779
|
+
api.registerTool({
|
|
780
|
+
name: 'superagnt_reddit_Popular_Subreddits',
|
|
781
|
+
description: "Popular Subreddits",
|
|
782
|
+
inputSchema: {
|
|
783
|
+
"type": "object",
|
|
784
|
+
"properties": {
|
|
785
|
+
"cursor": {
|
|
786
|
+
"type": "string",
|
|
787
|
+
"description": "cursor"
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
},
|
|
791
|
+
execute: async (input) => {
|
|
792
|
+
const key = await ensureApiKey()
|
|
793
|
+
const params = parseToolInput(input)
|
|
794
|
+
return callSuperagnt(key, 'GET', '/getPopularSubreddits', params)
|
|
795
|
+
},
|
|
796
|
+
})
|
|
797
|
+
|
|
798
|
+
api.registerTool({
|
|
799
|
+
name: 'superagnt_reddit_Post_Details',
|
|
800
|
+
description: "Post Details",
|
|
801
|
+
inputSchema: {
|
|
802
|
+
"type": "object",
|
|
803
|
+
"properties": {
|
|
804
|
+
"post_url": {
|
|
805
|
+
"type": "string",
|
|
806
|
+
"description": "post_url"
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
"required": [
|
|
810
|
+
"post_url"
|
|
811
|
+
]
|
|
812
|
+
},
|
|
813
|
+
execute: async (input) => {
|
|
814
|
+
const key = await ensureApiKey()
|
|
815
|
+
const params = parseToolInput(input)
|
|
816
|
+
return callSuperagnt(key, 'GET', '/getPostDetails', params)
|
|
817
|
+
},
|
|
818
|
+
})
|
|
819
|
+
|
|
820
|
+
api.registerTool({
|
|
821
|
+
name: 'superagnt_reddit_Posts_By_Subreddit',
|
|
822
|
+
description: "Posts By Subreddit",
|
|
823
|
+
inputSchema: {
|
|
824
|
+
"type": "object",
|
|
825
|
+
"properties": {
|
|
826
|
+
"subreddit": {
|
|
827
|
+
"type": "string",
|
|
828
|
+
"description": "example: reddit.com/r/`memes`"
|
|
829
|
+
},
|
|
830
|
+
"sort": {
|
|
831
|
+
"type": "string",
|
|
832
|
+
"description": "you can just select one item from below:\n`new`\n`hot`\n`rising`"
|
|
833
|
+
},
|
|
834
|
+
"cursor": {
|
|
835
|
+
"type": "string",
|
|
836
|
+
"description": "cursor"
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
"required": [
|
|
840
|
+
"subreddit",
|
|
841
|
+
"sort"
|
|
842
|
+
]
|
|
843
|
+
},
|
|
844
|
+
execute: async (input) => {
|
|
845
|
+
const key = await ensureApiKey()
|
|
846
|
+
const params = parseToolInput(input)
|
|
847
|
+
return callSuperagnt(key, 'GET', '/getPostsBySubreddit', params)
|
|
848
|
+
},
|
|
849
|
+
})
|
|
850
|
+
|
|
851
|
+
api.registerTool({
|
|
852
|
+
name: 'superagnt_reddit_Top_Comments_By_Username',
|
|
853
|
+
description: "Top Comments By Username",
|
|
854
|
+
inputSchema: {
|
|
855
|
+
"type": "object",
|
|
856
|
+
"properties": {
|
|
857
|
+
"time": {
|
|
858
|
+
"type": "string",
|
|
859
|
+
"description": "you can just select one item from below:\n`hour`\n`day`\n`week`\n`month`\n`year`\n`all`"
|
|
860
|
+
},
|
|
861
|
+
"username": {
|
|
862
|
+
"type": "string",
|
|
863
|
+
"description": "username"
|
|
864
|
+
},
|
|
865
|
+
"cursor": {
|
|
866
|
+
"type": "string",
|
|
867
|
+
"description": "cursor"
|
|
868
|
+
}
|
|
869
|
+
},
|
|
870
|
+
"required": [
|
|
871
|
+
"time",
|
|
872
|
+
"username"
|
|
873
|
+
]
|
|
874
|
+
},
|
|
875
|
+
execute: async (input) => {
|
|
876
|
+
const key = await ensureApiKey()
|
|
877
|
+
const params = parseToolInput(input)
|
|
878
|
+
return callSuperagnt(key, 'GET', '/getTopCommentsByUsername', params)
|
|
879
|
+
},
|
|
880
|
+
})
|
|
881
|
+
|
|
882
|
+
api.registerTool({
|
|
883
|
+
name: 'superagnt_reddit_Popular_Posts',
|
|
884
|
+
description: "Popular Posts",
|
|
885
|
+
inputSchema: {
|
|
886
|
+
"type": "object",
|
|
887
|
+
"properties": {
|
|
888
|
+
"cursor": {
|
|
889
|
+
"type": "string",
|
|
890
|
+
"description": "cursor"
|
|
891
|
+
},
|
|
892
|
+
"sort": {
|
|
893
|
+
"type": "string",
|
|
894
|
+
"description": "you can just send `new `or `hot`"
|
|
895
|
+
}
|
|
896
|
+
},
|
|
897
|
+
"required": [
|
|
898
|
+
"sort"
|
|
899
|
+
]
|
|
900
|
+
},
|
|
901
|
+
execute: async (input) => {
|
|
902
|
+
const key = await ensureApiKey()
|
|
903
|
+
const params = parseToolInput(input)
|
|
904
|
+
return callSuperagnt(key, 'GET', '/getPopularPosts', params)
|
|
905
|
+
},
|
|
906
|
+
})
|
|
907
|
+
|
|
908
|
+
api.registerTool({
|
|
909
|
+
name: 'superagnt_reddit_Top_Posts_By_Subreddit',
|
|
910
|
+
description: "Top Posts By Subreddit",
|
|
911
|
+
inputSchema: {
|
|
912
|
+
"type": "object",
|
|
913
|
+
"properties": {
|
|
914
|
+
"time": {
|
|
915
|
+
"type": "string",
|
|
916
|
+
"description": "you can just select one item from below:\n`hour`\n`day`\n`week`\n`month`\n`year`\n`all`"
|
|
917
|
+
},
|
|
918
|
+
"subreddit": {
|
|
919
|
+
"type": "string",
|
|
920
|
+
"description": "example: reddit.com/r/`memes`"
|
|
921
|
+
},
|
|
922
|
+
"cursor": {
|
|
923
|
+
"type": "string",
|
|
924
|
+
"description": "cursor"
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
"required": [
|
|
928
|
+
"time",
|
|
929
|
+
"subreddit"
|
|
930
|
+
]
|
|
931
|
+
},
|
|
932
|
+
execute: async (input) => {
|
|
933
|
+
const key = await ensureApiKey()
|
|
934
|
+
const params = parseToolInput(input)
|
|
935
|
+
return callSuperagnt(key, 'GET', '/getTopPostsBySubreddit', params)
|
|
936
|
+
},
|
|
937
|
+
})
|
|
938
|
+
|
|
939
|
+
api.registerTool({
|
|
940
|
+
name: 'superagnt_reddit_Comments_By_Username',
|
|
941
|
+
description: "Comments By Username",
|
|
942
|
+
inputSchema: {
|
|
943
|
+
"type": "object",
|
|
944
|
+
"properties": {
|
|
945
|
+
"sort": {
|
|
946
|
+
"type": "string",
|
|
947
|
+
"description": "you can just send `new `or `hot`"
|
|
948
|
+
},
|
|
949
|
+
"username": {
|
|
950
|
+
"type": "string",
|
|
951
|
+
"description": "username"
|
|
952
|
+
},
|
|
953
|
+
"cursor": {
|
|
954
|
+
"type": "string",
|
|
955
|
+
"description": "cursor"
|
|
956
|
+
}
|
|
957
|
+
},
|
|
958
|
+
"required": [
|
|
959
|
+
"sort",
|
|
960
|
+
"username"
|
|
961
|
+
]
|
|
962
|
+
},
|
|
963
|
+
execute: async (input) => {
|
|
964
|
+
const key = await ensureApiKey()
|
|
965
|
+
const params = parseToolInput(input)
|
|
966
|
+
return callSuperagnt(key, 'GET', '/getCommentsByUsername', params)
|
|
967
|
+
},
|
|
968
|
+
})
|
|
969
|
+
|
|
970
|
+
api.registerTool({
|
|
971
|
+
name: 'superagnt_reddit_Top_Posts_By_Username',
|
|
972
|
+
description: "Top Posts By Username",
|
|
973
|
+
inputSchema: {
|
|
974
|
+
"type": "object",
|
|
975
|
+
"properties": {
|
|
976
|
+
"cursor": {
|
|
977
|
+
"type": "string",
|
|
978
|
+
"description": "cursor"
|
|
979
|
+
},
|
|
980
|
+
"username": {
|
|
981
|
+
"type": "string",
|
|
982
|
+
"description": "username"
|
|
983
|
+
},
|
|
984
|
+
"time": {
|
|
985
|
+
"type": "string",
|
|
986
|
+
"description": "you can just select one item from below:\n`hour`\n`day`\n`week`\n`month`\n`year`\n`all`"
|
|
987
|
+
}
|
|
988
|
+
},
|
|
989
|
+
"required": [
|
|
990
|
+
"username",
|
|
991
|
+
"time"
|
|
992
|
+
]
|
|
993
|
+
},
|
|
994
|
+
execute: async (input) => {
|
|
995
|
+
const key = await ensureApiKey()
|
|
996
|
+
const params = parseToolInput(input)
|
|
997
|
+
return callSuperagnt(key, 'GET', '/getTopPostsByUsername', params)
|
|
998
|
+
},
|
|
999
|
+
})
|
|
1000
|
+
|
|
1001
|
+
api.registerTool({
|
|
1002
|
+
name: 'superagnt_reddit_Posts_By_Username',
|
|
1003
|
+
description: "Posts By Username",
|
|
1004
|
+
inputSchema: {
|
|
1005
|
+
"type": "object",
|
|
1006
|
+
"properties": {
|
|
1007
|
+
"username": {
|
|
1008
|
+
"type": "string",
|
|
1009
|
+
"description": "username"
|
|
1010
|
+
},
|
|
1011
|
+
"cursor": {
|
|
1012
|
+
"type": "string",
|
|
1013
|
+
"description": "cursor"
|
|
1014
|
+
},
|
|
1015
|
+
"sort": {
|
|
1016
|
+
"type": "string",
|
|
1017
|
+
"description": "you can just send `new `or `hot`"
|
|
1018
|
+
}
|
|
1019
|
+
},
|
|
1020
|
+
"required": [
|
|
1021
|
+
"username",
|
|
1022
|
+
"sort"
|
|
1023
|
+
]
|
|
1024
|
+
},
|
|
1025
|
+
execute: async (input) => {
|
|
1026
|
+
const key = await ensureApiKey()
|
|
1027
|
+
const params = parseToolInput(input)
|
|
1028
|
+
return callSuperagnt(key, 'GET', '/getPostsByUsername', params)
|
|
1029
|
+
},
|
|
1030
|
+
})
|
|
1031
|
+
|
|
1032
|
+
api.registerTool({
|
|
1033
|
+
name: 'superagnt_reddit_Rising_Popular_Posts',
|
|
1034
|
+
description: "Rising Popular Posts",
|
|
1035
|
+
inputSchema: {
|
|
1036
|
+
"type": "object",
|
|
1037
|
+
"properties": {
|
|
1038
|
+
"cursor": {
|
|
1039
|
+
"type": "string",
|
|
1040
|
+
"description": "cursor"
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
execute: async (input) => {
|
|
1045
|
+
const key = await ensureApiKey()
|
|
1046
|
+
const params = parseToolInput(input)
|
|
1047
|
+
return callSuperagnt(key, 'GET', '/getRisingPopularPosts', params)
|
|
1048
|
+
},
|
|
1049
|
+
})
|
|
1050
|
+
|
|
1051
|
+
api.registerTool({
|
|
1052
|
+
name: 'superagnt_reddit_Top_Popular_Posts',
|
|
1053
|
+
description: "Top Popular Posts",
|
|
1054
|
+
inputSchema: {
|
|
1055
|
+
"type": "object",
|
|
1056
|
+
"properties": {
|
|
1057
|
+
"time": {
|
|
1058
|
+
"type": "string",
|
|
1059
|
+
"description": "you can just select one item from below:\n`hour`\n`day`\n`week`\n`month`\n`year`\n`all`"
|
|
1060
|
+
},
|
|
1061
|
+
"cursor": {
|
|
1062
|
+
"type": "string",
|
|
1063
|
+
"description": "cursor"
|
|
1064
|
+
}
|
|
1065
|
+
},
|
|
1066
|
+
"required": [
|
|
1067
|
+
"time"
|
|
1068
|
+
]
|
|
1069
|
+
},
|
|
1070
|
+
execute: async (input) => {
|
|
1071
|
+
const key = await ensureApiKey()
|
|
1072
|
+
const params = parseToolInput(input)
|
|
1073
|
+
return callSuperagnt(key, 'GET', '/getTopPopularPosts', params)
|
|
1074
|
+
},
|
|
1075
|
+
})
|
|
1076
|
+
|
|
1077
|
+
promptState.toolCount = 29
|
|
1078
|
+
promptState.ready = true
|
|
1079
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "reddit-data",
|
|
3
|
+
"name": "Reddit Data",
|
|
4
|
+
"description": "Unified access to subreddit metadata, post threads, user activity, and search. Built for LLMs and automation — not one-off scraping.",
|
|
5
|
+
"version": "2.0.2",
|
|
6
|
+
"configSchema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"apiKey": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Your superagnt API key. Get one at https://app.superagnt.com/dashboard or store in ~/.superagnt/config.json via CLI login."
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"additionalProperties": false
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@superagnt/reddit-data",
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Unified access to subreddit metadata, post threads, user activity, and search. Built for LLMs and automation — not one-off scraping.",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://superagnt.com/r/npm-reddit-data-docs",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"openclaw",
|
|
11
|
+
"openclaw-plugin",
|
|
12
|
+
"superagnt",
|
|
13
|
+
"mcp",
|
|
14
|
+
"reddit",
|
|
15
|
+
"social-data",
|
|
16
|
+
"api",
|
|
17
|
+
"ai-agent",
|
|
18
|
+
"reddit api",
|
|
19
|
+
"reddit data api",
|
|
20
|
+
"reddit for ai agents",
|
|
21
|
+
"unified social data api",
|
|
22
|
+
"agent-ready api",
|
|
23
|
+
"mcp data source",
|
|
24
|
+
"structured json api"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"index.js",
|
|
31
|
+
"openclaw.plugin.json",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"openclaw": {
|
|
35
|
+
"extensions": [
|
|
36
|
+
"./index.js"
|
|
37
|
+
],
|
|
38
|
+
"compat": {
|
|
39
|
+
"pluginApi": ">=2026.3.24-beta.2",
|
|
40
|
+
"minGatewayVersion": "2026.3.24-beta.2"
|
|
41
|
+
},
|
|
42
|
+
"build": {
|
|
43
|
+
"openclawVersion": "2026.3.24-beta.2",
|
|
44
|
+
"pluginSdkVersion": "2026.3.24-beta.2"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|