@dobbyai/mcp-external 1.0.3 → 1.1.0

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.
Files changed (163) hide show
  1. package/dist/__tests__/agent-mail-tools.test.d.ts +8 -0
  2. package/dist/__tests__/agent-mail-tools.test.d.ts.map +1 -0
  3. package/dist/__tests__/agent-mail-tools.test.js +262 -0
  4. package/dist/__tests__/agent-mail-tools.test.js.map +1 -0
  5. package/dist/__tests__/annotations.test.d.ts +8 -0
  6. package/dist/__tests__/annotations.test.d.ts.map +1 -0
  7. package/dist/__tests__/annotations.test.js +108 -0
  8. package/dist/__tests__/annotations.test.js.map +1 -0
  9. package/dist/__tests__/auth.test.d.ts +7 -0
  10. package/dist/__tests__/auth.test.d.ts.map +1 -0
  11. package/dist/__tests__/auth.test.js +116 -0
  12. package/dist/__tests__/auth.test.js.map +1 -0
  13. package/dist/__tests__/integration/protocol.test.d.ts +8 -0
  14. package/dist/__tests__/integration/protocol.test.d.ts.map +1 -0
  15. package/dist/__tests__/integration/protocol.test.js +104 -0
  16. package/dist/__tests__/integration/protocol.test.js.map +1 -0
  17. package/dist/__tests__/mcp-integrations.test.d.ts +8 -0
  18. package/dist/__tests__/mcp-integrations.test.d.ts.map +1 -0
  19. package/dist/__tests__/mcp-integrations.test.js +375 -0
  20. package/dist/__tests__/mcp-integrations.test.js.map +1 -0
  21. package/dist/__tests__/memory-graph-tools.test.d.ts +8 -0
  22. package/dist/__tests__/memory-graph-tools.test.d.ts.map +1 -0
  23. package/dist/__tests__/memory-graph-tools.test.js +265 -0
  24. package/dist/__tests__/memory-graph-tools.test.js.map +1 -0
  25. package/dist/__tests__/schedule-tools.test.d.ts +8 -0
  26. package/dist/__tests__/schedule-tools.test.d.ts.map +1 -0
  27. package/dist/__tests__/schedule-tools.test.js +290 -0
  28. package/dist/__tests__/schedule-tools.test.js.map +1 -0
  29. package/dist/__tests__/tiers.test.d.ts +7 -0
  30. package/dist/__tests__/tiers.test.d.ts.map +1 -0
  31. package/dist/__tests__/tiers.test.js +103 -0
  32. package/dist/__tests__/tiers.test.js.map +1 -0
  33. package/dist/__tests__/tools.test.d.ts +7 -0
  34. package/dist/__tests__/tools.test.d.ts.map +1 -0
  35. package/dist/__tests__/tools.test.js +143 -0
  36. package/dist/__tests__/tools.test.js.map +1 -0
  37. package/dist/__tests__/transport.test.d.ts +7 -0
  38. package/dist/__tests__/transport.test.d.ts.map +1 -0
  39. package/dist/__tests__/transport.test.js +55 -0
  40. package/dist/__tests__/transport.test.js.map +1 -0
  41. package/dist/__tests__/web-eval-tools.test.d.ts +8 -0
  42. package/dist/__tests__/web-eval-tools.test.d.ts.map +1 -0
  43. package/dist/__tests__/web-eval-tools.test.js +252 -0
  44. package/dist/__tests__/web-eval-tools.test.js.map +1 -0
  45. package/dist/__tests__/workflow-tools.test.d.ts +8 -0
  46. package/dist/__tests__/workflow-tools.test.d.ts.map +1 -0
  47. package/dist/__tests__/workflow-tools.test.js +268 -0
  48. package/dist/__tests__/workflow-tools.test.js.map +1 -0
  49. package/dist/auth/oauth-provider.d.ts +34 -0
  50. package/dist/auth/oauth-provider.d.ts.map +1 -0
  51. package/dist/auth/oauth-provider.js +75 -0
  52. package/dist/auth/oauth-provider.js.map +1 -0
  53. package/dist/auth/token-verifier.d.ts +40 -0
  54. package/dist/auth/token-verifier.d.ts.map +1 -0
  55. package/dist/auth/token-verifier.js +138 -0
  56. package/dist/auth/token-verifier.js.map +1 -0
  57. package/dist/http-server.d.ts +35 -0
  58. package/dist/http-server.d.ts.map +1 -0
  59. package/dist/http-server.js +175 -0
  60. package/dist/http-server.js.map +1 -0
  61. package/dist/index.js +131 -36
  62. package/dist/index.js.map +1 -1
  63. package/dist/lib/dobby-client.d.ts +50 -20
  64. package/dist/lib/dobby-client.d.ts.map +1 -1
  65. package/dist/lib/dobby-client.js +50 -0
  66. package/dist/lib/dobby-client.js.map +1 -1
  67. package/dist/tools/agent-mail.d.ts +153 -0
  68. package/dist/tools/agent-mail.d.ts.map +1 -0
  69. package/dist/tools/agent-mail.js +340 -0
  70. package/dist/tools/agent-mail.js.map +1 -0
  71. package/dist/tools/approvals.d.ts +24 -0
  72. package/dist/tools/approvals.d.ts.map +1 -1
  73. package/dist/tools/approvals.js +24 -0
  74. package/dist/tools/approvals.js.map +1 -1
  75. package/dist/tools/crew-builder.d.ts +24 -0
  76. package/dist/tools/crew-builder.d.ts.map +1 -1
  77. package/dist/tools/crew-builder.js +24 -0
  78. package/dist/tools/crew-builder.js.map +1 -1
  79. package/dist/tools/crewai.d.ts +24 -0
  80. package/dist/tools/crewai.d.ts.map +1 -1
  81. package/dist/tools/crewai.js +24 -0
  82. package/dist/tools/crewai.js.map +1 -1
  83. package/dist/tools/exa.d.ts +161 -0
  84. package/dist/tools/exa.d.ts.map +1 -0
  85. package/dist/tools/exa.js +228 -0
  86. package/dist/tools/exa.js.map +1 -0
  87. package/dist/tools/github-mcp.d.ts +303 -0
  88. package/dist/tools/github-mcp.d.ts.map +1 -0
  89. package/dist/tools/github-mcp.js +397 -0
  90. package/dist/tools/github-mcp.js.map +1 -0
  91. package/dist/tools/governance.d.ts +129 -0
  92. package/dist/tools/governance.d.ts.map +1 -0
  93. package/dist/tools/governance.js +171 -0
  94. package/dist/tools/governance.js.map +1 -0
  95. package/dist/tools/index.d.ts +3589 -159
  96. package/dist/tools/index.d.ts.map +1 -1
  97. package/dist/tools/index.js +250 -0
  98. package/dist/tools/index.js.map +1 -1
  99. package/dist/tools/jira.d.ts +60 -0
  100. package/dist/tools/jira.d.ts.map +1 -1
  101. package/dist/tools/jira.js +60 -0
  102. package/dist/tools/jira.js.map +1 -1
  103. package/dist/tools/knowledge-base.d.ts +144 -0
  104. package/dist/tools/knowledge-base.d.ts.map +1 -0
  105. package/dist/tools/knowledge-base.js +179 -0
  106. package/dist/tools/knowledge-base.js.map +1 -0
  107. package/dist/tools/mcp-metrics.d.ts +62 -0
  108. package/dist/tools/mcp-metrics.d.ts.map +1 -0
  109. package/dist/tools/mcp-metrics.js +270 -0
  110. package/dist/tools/mcp-metrics.js.map +1 -0
  111. package/dist/tools/mcp-tools.d.ts +12 -0
  112. package/dist/tools/mcp-tools.d.ts.map +1 -1
  113. package/dist/tools/mcp-tools.js +12 -0
  114. package/dist/tools/mcp-tools.js.map +1 -1
  115. package/dist/tools/mem0.d.ts +168 -0
  116. package/dist/tools/mem0.d.ts.map +1 -0
  117. package/dist/tools/mem0.js +255 -0
  118. package/dist/tools/mem0.js.map +1 -0
  119. package/dist/tools/memory-graph.d.ts +197 -0
  120. package/dist/tools/memory-graph.d.ts.map +1 -0
  121. package/dist/tools/memory-graph.js +545 -0
  122. package/dist/tools/memory-graph.js.map +1 -0
  123. package/dist/tools/messages.d.ts +12 -0
  124. package/dist/tools/messages.d.ts.map +1 -1
  125. package/dist/tools/messages.js +12 -0
  126. package/dist/tools/messages.js.map +1 -1
  127. package/dist/tools/moltbook.d.ts +564 -0
  128. package/dist/tools/moltbook.d.ts.map +1 -0
  129. package/dist/tools/moltbook.js +792 -0
  130. package/dist/tools/moltbook.js.map +1 -0
  131. package/dist/tools/ops.d.ts +219 -0
  132. package/dist/tools/ops.d.ts.map +1 -0
  133. package/dist/tools/ops.js +360 -0
  134. package/dist/tools/ops.js.map +1 -0
  135. package/dist/tools/schedules.d.ts +196 -0
  136. package/dist/tools/schedules.d.ts.map +1 -0
  137. package/dist/tools/schedules.js +264 -0
  138. package/dist/tools/schedules.js.map +1 -0
  139. package/dist/tools/services.d.ts +6 -0
  140. package/dist/tools/services.d.ts.map +1 -1
  141. package/dist/tools/services.js +6 -0
  142. package/dist/tools/services.js.map +1 -1
  143. package/dist/tools/tasks.d.ts +45 -0
  144. package/dist/tools/tasks.d.ts.map +1 -1
  145. package/dist/tools/tasks.js +49 -4
  146. package/dist/tools/tasks.js.map +1 -1
  147. package/dist/tools/tiers.d.ts +39 -0
  148. package/dist/tools/tiers.d.ts.map +1 -0
  149. package/dist/tools/tiers.js +138 -0
  150. package/dist/tools/tiers.js.map +1 -0
  151. package/dist/tools/unified-agents.d.ts +62 -0
  152. package/dist/tools/unified-agents.d.ts.map +1 -0
  153. package/dist/tools/unified-agents.js +147 -0
  154. package/dist/tools/unified-agents.js.map +1 -0
  155. package/dist/tools/web-eval.d.ts +172 -0
  156. package/dist/tools/web-eval.d.ts.map +1 -0
  157. package/dist/tools/web-eval.js +347 -0
  158. package/dist/tools/web-eval.js.map +1 -0
  159. package/dist/tools/workflow.d.ts +171 -0
  160. package/dist/tools/workflow.d.ts.map +1 -0
  161. package/dist/tools/workflow.js +518 -0
  162. package/dist/tools/workflow.js.map +1 -0
  163. package/package.json +8 -3
@@ -0,0 +1,792 @@
1
+ /**
2
+ * MCP Tools — Moltbook (Social Network for AI Agents)
3
+ *
4
+ * 12 core tools for interacting with Moltbook (moltbook.com).
5
+ * All requests go through the gateway agent proxy which handles
6
+ * auth, anti-spam verification auto-solving, and audit logging.
7
+ *
8
+ * Tools: moltbook_get_profile, moltbook_update_profile,
9
+ * moltbook_get_home_feed, moltbook_get_posts, moltbook_get_post,
10
+ * moltbook_create_post, moltbook_get_comments, moltbook_create_comment,
11
+ * moltbook_upvote_post, moltbook_downvote_post,
12
+ * moltbook_search, moltbook_get_notifications
13
+ */
14
+ // ============================================
15
+ // Tool Definitions
16
+ // ============================================
17
+ export const moltbookTools = {
18
+ moltbook_get_profile: {
19
+ name: 'moltbook_get_profile',
20
+ annotations: {
21
+ title: 'Get Profile',
22
+ readOnlyHint: true,
23
+ destructiveHint: false,
24
+ openWorldHint: false,
25
+ },
26
+ description: 'Get the authenticated Moltbook agent\'s profile. Returns agent name, description, karma, follower/following counts, and account status.',
27
+ inputSchema: {
28
+ type: 'object',
29
+ properties: {
30
+ connection_id: {
31
+ type: 'string',
32
+ description: 'Optional: specific Moltbook connection ID. If omitted, uses the first active Moltbook connection.',
33
+ },
34
+ },
35
+ },
36
+ },
37
+ moltbook_update_profile: {
38
+ name: 'moltbook_update_profile',
39
+ annotations: {
40
+ title: 'Update Profile',
41
+ readOnlyHint: false,
42
+ destructiveHint: true,
43
+ openWorldHint: false,
44
+ },
45
+ description: 'Update the authenticated Moltbook agent\'s profile fields (description, bio, etc.).',
46
+ inputSchema: {
47
+ type: 'object',
48
+ properties: {
49
+ profile_fields: {
50
+ type: 'object',
51
+ description: 'Fields to update on the agent profile (e.g., { "description": "New bio text" }).',
52
+ },
53
+ connection_id: {
54
+ type: 'string',
55
+ description: 'Optional: specific Moltbook connection ID.',
56
+ },
57
+ },
58
+ required: ['profile_fields'],
59
+ },
60
+ },
61
+ moltbook_get_home_feed: {
62
+ name: 'moltbook_get_home_feed',
63
+ annotations: {
64
+ title: 'Get Home Feed',
65
+ readOnlyHint: true,
66
+ destructiveHint: false,
67
+ openWorldHint: false,
68
+ },
69
+ description: 'Get the authenticated agent\'s personalized home feed. Shows posts from followed agents and subscribed submolts (communities).',
70
+ inputSchema: {
71
+ type: 'object',
72
+ properties: {
73
+ limit: {
74
+ type: 'number',
75
+ description: 'Maximum number of posts to return (default: 20).',
76
+ },
77
+ connection_id: {
78
+ type: 'string',
79
+ description: 'Optional: specific Moltbook connection ID.',
80
+ },
81
+ },
82
+ },
83
+ },
84
+ moltbook_get_posts: {
85
+ name: 'moltbook_get_posts',
86
+ annotations: {
87
+ title: 'Get Posts',
88
+ readOnlyHint: true,
89
+ destructiveHint: false,
90
+ openWorldHint: false,
91
+ },
92
+ description: 'Get posts from the global Moltbook feed. Can be sorted by hot, new, top, or rising.',
93
+ inputSchema: {
94
+ type: 'object',
95
+ properties: {
96
+ sort: {
97
+ type: 'string',
98
+ description: 'Sort order: "hot" (default), "new", "top", or "rising".',
99
+ },
100
+ limit: {
101
+ type: 'number',
102
+ description: 'Maximum number of posts to return (default: 20).',
103
+ },
104
+ connection_id: {
105
+ type: 'string',
106
+ description: 'Optional: specific Moltbook connection ID.',
107
+ },
108
+ },
109
+ },
110
+ },
111
+ moltbook_get_post: {
112
+ name: 'moltbook_get_post',
113
+ annotations: {
114
+ title: 'Get Post',
115
+ readOnlyHint: true,
116
+ destructiveHint: false,
117
+ openWorldHint: false,
118
+ },
119
+ description: 'Get a specific Moltbook post by its ID. Returns full post content, author, votes, and comment count.',
120
+ inputSchema: {
121
+ type: 'object',
122
+ properties: {
123
+ post_id: {
124
+ type: 'string',
125
+ description: 'The post ID to retrieve.',
126
+ },
127
+ connection_id: {
128
+ type: 'string',
129
+ description: 'Optional: specific Moltbook connection ID.',
130
+ },
131
+ },
132
+ required: ['post_id'],
133
+ },
134
+ },
135
+ moltbook_create_post: {
136
+ name: 'moltbook_create_post',
137
+ annotations: {
138
+ title: 'Create Post',
139
+ readOnlyHint: false,
140
+ destructiveHint: true,
141
+ openWorldHint: false,
142
+ },
143
+ description: 'Create a new post on Moltbook. Anti-spam verification is handled automatically by the gateway. Optionally post to a specific submolt (community).',
144
+ inputSchema: {
145
+ type: 'object',
146
+ properties: {
147
+ title: {
148
+ type: 'string',
149
+ description: 'Post title.',
150
+ },
151
+ content: {
152
+ type: 'string',
153
+ description: 'Post body content (text).',
154
+ },
155
+ submolt: {
156
+ type: 'string',
157
+ description: 'Optional: submolt (community) to post in (e.g., "agents", "governance").',
158
+ },
159
+ connection_id: {
160
+ type: 'string',
161
+ description: 'Optional: specific Moltbook connection ID.',
162
+ },
163
+ },
164
+ required: ['title', 'content'],
165
+ },
166
+ },
167
+ moltbook_get_comments: {
168
+ name: 'moltbook_get_comments',
169
+ annotations: {
170
+ title: 'Get Comments',
171
+ readOnlyHint: true,
172
+ destructiveHint: false,
173
+ openWorldHint: false,
174
+ },
175
+ description: 'Get comments on a Moltbook post. Returns comment tree with author, content, and votes.',
176
+ inputSchema: {
177
+ type: 'object',
178
+ properties: {
179
+ post_id: {
180
+ type: 'string',
181
+ description: 'The post ID to get comments for.',
182
+ },
183
+ limit: {
184
+ type: 'number',
185
+ description: 'Maximum number of comments to return (default: 20).',
186
+ },
187
+ connection_id: {
188
+ type: 'string',
189
+ description: 'Optional: specific Moltbook connection ID.',
190
+ },
191
+ },
192
+ required: ['post_id'],
193
+ },
194
+ },
195
+ moltbook_create_comment: {
196
+ name: 'moltbook_create_comment',
197
+ annotations: {
198
+ title: 'Create Comment',
199
+ readOnlyHint: false,
200
+ destructiveHint: true,
201
+ openWorldHint: false,
202
+ },
203
+ description: 'Comment on a Moltbook post. Anti-spam verification is handled automatically by the gateway. Can also reply to existing comments.',
204
+ inputSchema: {
205
+ type: 'object',
206
+ properties: {
207
+ post_id: {
208
+ type: 'string',
209
+ description: 'The post ID to comment on.',
210
+ },
211
+ content: {
212
+ type: 'string',
213
+ description: 'Comment text.',
214
+ },
215
+ parent_comment_id: {
216
+ type: 'string',
217
+ description: 'Optional: parent comment ID to reply to (for nested comments).',
218
+ },
219
+ connection_id: {
220
+ type: 'string',
221
+ description: 'Optional: specific Moltbook connection ID.',
222
+ },
223
+ },
224
+ required: ['post_id', 'content'],
225
+ },
226
+ },
227
+ moltbook_upvote_post: {
228
+ name: 'moltbook_upvote_post',
229
+ annotations: {
230
+ title: 'Upvote Post',
231
+ readOnlyHint: false,
232
+ destructiveHint: true,
233
+ openWorldHint: false,
234
+ },
235
+ description: 'Upvote a Moltbook post.',
236
+ inputSchema: {
237
+ type: 'object',
238
+ properties: {
239
+ post_id: {
240
+ type: 'string',
241
+ description: 'The post ID to upvote.',
242
+ },
243
+ connection_id: {
244
+ type: 'string',
245
+ description: 'Optional: specific Moltbook connection ID.',
246
+ },
247
+ },
248
+ required: ['post_id'],
249
+ },
250
+ },
251
+ moltbook_downvote_post: {
252
+ name: 'moltbook_downvote_post',
253
+ annotations: {
254
+ title: 'Downvote Post',
255
+ readOnlyHint: false,
256
+ destructiveHint: true,
257
+ openWorldHint: false,
258
+ },
259
+ description: 'Downvote a Moltbook post.',
260
+ inputSchema: {
261
+ type: 'object',
262
+ properties: {
263
+ post_id: {
264
+ type: 'string',
265
+ description: 'The post ID to downvote.',
266
+ },
267
+ connection_id: {
268
+ type: 'string',
269
+ description: 'Optional: specific Moltbook connection ID.',
270
+ },
271
+ },
272
+ required: ['post_id'],
273
+ },
274
+ },
275
+ moltbook_search: {
276
+ name: 'moltbook_search',
277
+ annotations: {
278
+ title: 'Search Moltbook',
279
+ readOnlyHint: true,
280
+ destructiveHint: false,
281
+ openWorldHint: false,
282
+ },
283
+ description: 'Search Moltbook for posts, agents, or submolts (communities). Returns matching results with relevance.',
284
+ inputSchema: {
285
+ type: 'object',
286
+ properties: {
287
+ query: {
288
+ type: 'string',
289
+ description: 'Search query string.',
290
+ },
291
+ search_type: {
292
+ type: 'string',
293
+ description: 'Type filter: "all" (default), "posts", "agents", or "submolts".',
294
+ },
295
+ limit: {
296
+ type: 'number',
297
+ description: 'Maximum number of results to return (default: 20).',
298
+ },
299
+ connection_id: {
300
+ type: 'string',
301
+ description: 'Optional: specific Moltbook connection ID.',
302
+ },
303
+ },
304
+ required: ['query'],
305
+ },
306
+ },
307
+ moltbook_get_notifications: {
308
+ name: 'moltbook_get_notifications',
309
+ annotations: {
310
+ title: 'Get Notifications',
311
+ readOnlyHint: true,
312
+ destructiveHint: false,
313
+ openWorldHint: false,
314
+ },
315
+ description: 'Get the authenticated agent\'s Moltbook notifications (mentions, replies, follows, upvotes).',
316
+ inputSchema: {
317
+ type: 'object',
318
+ properties: {
319
+ limit: {
320
+ type: 'number',
321
+ description: 'Maximum number of notifications to return (default: 20).',
322
+ },
323
+ connection_id: {
324
+ type: 'string',
325
+ description: 'Optional: specific Moltbook connection ID.',
326
+ },
327
+ },
328
+ },
329
+ },
330
+ };
331
+ async function callMoltbookGatewayProxy(client, payload) {
332
+ const url = `${client.apiUrl}/api/v1/gateway/agents/proxy`;
333
+ const response = await fetch(url, {
334
+ method: 'POST',
335
+ headers: {
336
+ 'Content-Type': 'application/json',
337
+ Authorization: `Bearer ${client.apiKey}`,
338
+ ...(client.tenantId ? { 'X-Tenant-Id': client.tenantId } : {}),
339
+ },
340
+ body: JSON.stringify(payload),
341
+ });
342
+ if (!response.ok) {
343
+ const errBody = await response.json().catch(() => ({
344
+ error: `Gateway proxy returned ${response.status}`,
345
+ }));
346
+ throw new Error(errBody.error ||
347
+ `Gateway proxy error: HTTP ${response.status}`);
348
+ }
349
+ return response.json();
350
+ }
351
+ // ============================================
352
+ // Tool Handlers
353
+ // ============================================
354
+ /**
355
+ * Get agent profile
356
+ */
357
+ export async function handleMoltbookGetProfile(client, args) {
358
+ try {
359
+ const data = await callMoltbookGatewayProxy(client, {
360
+ action: 'get_agent_profile',
361
+ provider_id: 'moltbook',
362
+ connection_id: args.connection_id,
363
+ });
364
+ const profile = data.response || {};
365
+ let text = `# Moltbook Agent Profile\n\n`;
366
+ text += `- **Name:** ${profile.name || 'N/A'}\n`;
367
+ text += `- **Description:** ${profile.description || 'No description'}\n`;
368
+ if (profile.karma !== undefined)
369
+ text += `- **Karma:** ${profile.karma}\n`;
370
+ if (profile.followers_count !== undefined)
371
+ text += `- **Followers:** ${profile.followers_count}\n`;
372
+ if (profile.following_count !== undefined)
373
+ text += `- **Following:** ${profile.following_count}\n`;
374
+ if (profile.post_count !== undefined)
375
+ text += `- **Posts:** ${profile.post_count}\n`;
376
+ if (profile.is_claimed !== undefined)
377
+ text += `- **Claimed:** ${profile.is_claimed ? 'Yes' : 'No'}\n`;
378
+ if (profile.is_verified !== undefined)
379
+ text += `- **Verified:** ${profile.is_verified ? 'Yes' : 'No'}\n`;
380
+ text += `\n_Latency: ${data.latency_ms}ms_`;
381
+ return { content: [{ type: 'text', text }] };
382
+ }
383
+ catch (error) {
384
+ return {
385
+ content: [{ type: 'text', text: `Failed to get Moltbook profile: ${error.message}` }],
386
+ isError: true,
387
+ };
388
+ }
389
+ }
390
+ /**
391
+ * Update agent profile
392
+ */
393
+ export async function handleMoltbookUpdateProfile(client, args) {
394
+ try {
395
+ const data = await callMoltbookGatewayProxy(client, {
396
+ action: 'update_agent_profile',
397
+ provider_id: 'moltbook',
398
+ connection_id: args.connection_id,
399
+ profile_fields: args.profile_fields,
400
+ });
401
+ const profile = data.response || {};
402
+ let text = `# Profile Updated\n\n`;
403
+ text += `Updated fields: ${Object.keys(args.profile_fields).join(', ')}\n`;
404
+ if (profile.name)
405
+ text += `- **Name:** ${profile.name}\n`;
406
+ text += `\n_Latency: ${data.latency_ms}ms_`;
407
+ return { content: [{ type: 'text', text }] };
408
+ }
409
+ catch (error) {
410
+ return {
411
+ content: [{ type: 'text', text: `Failed to update Moltbook profile: ${error.message}` }],
412
+ isError: true,
413
+ };
414
+ }
415
+ }
416
+ /**
417
+ * Get personalized home feed
418
+ */
419
+ export async function handleMoltbookGetHomeFeed(client, args) {
420
+ try {
421
+ const data = await callMoltbookGatewayProxy(client, {
422
+ action: 'get_home_feed',
423
+ provider_id: 'moltbook',
424
+ connection_id: args.connection_id,
425
+ limit: args.limit,
426
+ });
427
+ const response = data.response || {};
428
+ const posts = response.posts || response.data || response || [];
429
+ const postList = Array.isArray(posts) ? posts : [];
430
+ let text = `# Moltbook Home Feed\n\n`;
431
+ if (postList.length === 0) {
432
+ text += `No posts in your feed yet. Follow agents and subscribe to submolts to see content.\n`;
433
+ }
434
+ else {
435
+ text += `| # | Title | Author | Submolt | Votes | Comments |\n`;
436
+ text += `|---|-------|--------|---------|-------|----------|\n`;
437
+ postList.forEach((post, i) => {
438
+ const title = (post.title || 'Untitled').substring(0, 50);
439
+ const author = post.author?.name || post.author_name || 'Unknown';
440
+ const submolt = post.submolt || '-';
441
+ const votes = post.upvotes !== undefined ? `+${post.upvotes}/-${post.downvotes || 0}` : (post.score ?? '-');
442
+ const comments = post.comment_count ?? post.comments_count ?? '-';
443
+ text += `| ${i + 1} | ${title} | ${author} | ${submolt} | ${votes} | ${comments} |\n`;
444
+ });
445
+ text += `\n**${postList.length} posts**`;
446
+ }
447
+ text += `\n_Latency: ${data.latency_ms}ms_`;
448
+ return { content: [{ type: 'text', text }] };
449
+ }
450
+ catch (error) {
451
+ return {
452
+ content: [{ type: 'text', text: `Failed to get Moltbook home feed: ${error.message}` }],
453
+ isError: true,
454
+ };
455
+ }
456
+ }
457
+ /**
458
+ * Get global feed posts
459
+ */
460
+ export async function handleMoltbookGetPosts(client, args) {
461
+ try {
462
+ const data = await callMoltbookGatewayProxy(client, {
463
+ action: 'get_feed',
464
+ provider_id: 'moltbook',
465
+ connection_id: args.connection_id,
466
+ sort: args.sort,
467
+ limit: args.limit,
468
+ });
469
+ const response = data.response || {};
470
+ const posts = response.posts || response.data || response || [];
471
+ const postList = Array.isArray(posts) ? posts : [];
472
+ let text = `# Moltbook Feed`;
473
+ if (args.sort)
474
+ text += ` (${args.sort})`;
475
+ text += `\n\n`;
476
+ if (postList.length === 0) {
477
+ text += `No posts found.\n`;
478
+ }
479
+ else {
480
+ text += `| # | Title | Author | Submolt | Votes | Comments |\n`;
481
+ text += `|---|-------|--------|---------|-------|----------|\n`;
482
+ postList.forEach((post, i) => {
483
+ const title = (post.title || 'Untitled').substring(0, 50);
484
+ const author = post.author?.name || post.author_name || 'Unknown';
485
+ const submolt = post.submolt || '-';
486
+ const votes = post.upvotes !== undefined ? `+${post.upvotes}/-${post.downvotes || 0}` : (post.score ?? '-');
487
+ const comments = post.comment_count ?? post.comments_count ?? '-';
488
+ text += `| ${i + 1} | ${title} | ${author} | ${submolt} | ${votes} | ${comments} |\n`;
489
+ });
490
+ text += `\n**${postList.length} posts**`;
491
+ }
492
+ text += `\n_Latency: ${data.latency_ms}ms_`;
493
+ return { content: [{ type: 'text', text }] };
494
+ }
495
+ catch (error) {
496
+ return {
497
+ content: [{ type: 'text', text: `Failed to get Moltbook posts: ${error.message}` }],
498
+ isError: true,
499
+ };
500
+ }
501
+ }
502
+ /**
503
+ * Get a single post
504
+ */
505
+ export async function handleMoltbookGetPost(client, args) {
506
+ try {
507
+ const data = await callMoltbookGatewayProxy(client, {
508
+ action: 'get_post',
509
+ provider_id: 'moltbook',
510
+ connection_id: args.connection_id,
511
+ post_id: args.post_id,
512
+ });
513
+ const post = data.response || {};
514
+ let text = `# ${post.title || 'Untitled Post'}\n\n`;
515
+ text += `- **Author:** ${post.author?.name || post.author_name || 'Unknown'}\n`;
516
+ if (post.submolt)
517
+ text += `- **Submolt:** ${post.submolt}\n`;
518
+ if (post.created_at)
519
+ text += `- **Created:** ${post.created_at}\n`;
520
+ if (post.upvotes !== undefined)
521
+ text += `- **Votes:** +${post.upvotes}/-${post.downvotes || 0}\n`;
522
+ if (post.score !== undefined)
523
+ text += `- **Score:** ${post.score}\n`;
524
+ if (post.comment_count !== undefined)
525
+ text += `- **Comments:** ${post.comment_count}\n`;
526
+ text += `\n---\n\n`;
527
+ text += post.content || post.body || '_No content_';
528
+ text += `\n\n_Post ID: ${post.id || args.post_id} | Latency: ${data.latency_ms}ms_`;
529
+ return { content: [{ type: 'text', text }] };
530
+ }
531
+ catch (error) {
532
+ return {
533
+ content: [{ type: 'text', text: `Failed to get Moltbook post: ${error.message}` }],
534
+ isError: true,
535
+ };
536
+ }
537
+ }
538
+ /**
539
+ * Create a post (verification handled automatically by gateway)
540
+ */
541
+ export async function handleMoltbookCreatePost(client, args) {
542
+ try {
543
+ const data = await callMoltbookGatewayProxy(client, {
544
+ action: 'create_post',
545
+ provider_id: 'moltbook',
546
+ connection_id: args.connection_id,
547
+ title: args.title,
548
+ content: args.content,
549
+ submolt: args.submolt,
550
+ });
551
+ const response = data.response || {};
552
+ const post = response.post || response;
553
+ const verification = response.verification || {};
554
+ let text = `# Post Created\n\n`;
555
+ text += `- **Title:** ${args.title}\n`;
556
+ if (post.id)
557
+ text += `- **Post ID:** ${post.id}\n`;
558
+ if (args.submolt)
559
+ text += `- **Submolt:** ${args.submolt}\n`;
560
+ if (verification.status === 'verified') {
561
+ text += `- **Verification:** Auto-verified\n`;
562
+ }
563
+ else if (verification.status === 'pending') {
564
+ text += `- **Verification:** Pending (auto-solve failed: ${verification.error || 'unknown'})\n`;
565
+ if (verification.verification_code) {
566
+ text += `- **Verification Code:** ${verification.verification_code}\n`;
567
+ text += ` Use \`solve_verification\` tool to manually verify.\n`;
568
+ }
569
+ }
570
+ text += `\n_Latency: ${data.latency_ms}ms_`;
571
+ return { content: [{ type: 'text', text }] };
572
+ }
573
+ catch (error) {
574
+ return {
575
+ content: [{ type: 'text', text: `Failed to create Moltbook post: ${error.message}` }],
576
+ isError: true,
577
+ };
578
+ }
579
+ }
580
+ /**
581
+ * Get comments on a post
582
+ */
583
+ export async function handleMoltbookGetComments(client, args) {
584
+ try {
585
+ const data = await callMoltbookGatewayProxy(client, {
586
+ action: 'get_comments',
587
+ provider_id: 'moltbook',
588
+ connection_id: args.connection_id,
589
+ post_id: args.post_id,
590
+ limit: args.limit,
591
+ });
592
+ const response = data.response || {};
593
+ const comments = response.comments || response.data || response || [];
594
+ const commentList = Array.isArray(comments) ? comments : [];
595
+ let text = `# Comments on Post ${args.post_id}\n\n`;
596
+ if (commentList.length === 0) {
597
+ text += `No comments yet.\n`;
598
+ }
599
+ else {
600
+ commentList.forEach((comment, i) => {
601
+ const author = comment.author?.name || comment.author_name || 'Unknown';
602
+ const body = comment.body || comment.content || '';
603
+ const votes = comment.upvotes !== undefined ? `+${comment.upvotes}/-${comment.downvotes || 0}` : '';
604
+ text += `**${i + 1}. ${author}** ${votes ? `(${votes})` : ''}\n`;
605
+ text += `${body}\n`;
606
+ if (comment.created_at)
607
+ text += `_${comment.created_at}_\n`;
608
+ text += `\n`;
609
+ });
610
+ text += `**${commentList.length} comments**`;
611
+ }
612
+ text += `\n_Latency: ${data.latency_ms}ms_`;
613
+ return { content: [{ type: 'text', text }] };
614
+ }
615
+ catch (error) {
616
+ return {
617
+ content: [{ type: 'text', text: `Failed to get Moltbook comments: ${error.message}` }],
618
+ isError: true,
619
+ };
620
+ }
621
+ }
622
+ /**
623
+ * Create a comment (verification handled automatically by gateway)
624
+ */
625
+ export async function handleMoltbookCreateComment(client, args) {
626
+ try {
627
+ const data = await callMoltbookGatewayProxy(client, {
628
+ action: 'create_comment',
629
+ provider_id: 'moltbook',
630
+ connection_id: args.connection_id,
631
+ post_id: args.post_id,
632
+ content: args.content,
633
+ parent_comment_id: args.parent_comment_id,
634
+ });
635
+ const response = data.response || {};
636
+ const comment = response.comment || response;
637
+ const verification = response.verification || {};
638
+ let text = `# Comment Created\n\n`;
639
+ text += `- **Post ID:** ${args.post_id}\n`;
640
+ if (comment.id)
641
+ text += `- **Comment ID:** ${comment.id}\n`;
642
+ if (args.parent_comment_id)
643
+ text += `- **Reply to:** ${args.parent_comment_id}\n`;
644
+ if (verification.status === 'verified') {
645
+ text += `- **Verification:** Auto-verified\n`;
646
+ }
647
+ else if (verification.status === 'pending') {
648
+ text += `- **Verification:** Pending (auto-solve failed: ${verification.error || 'unknown'})\n`;
649
+ if (verification.verification_code) {
650
+ text += `- **Verification Code:** ${verification.verification_code}\n`;
651
+ }
652
+ }
653
+ text += `\n_Latency: ${data.latency_ms}ms_`;
654
+ return { content: [{ type: 'text', text }] };
655
+ }
656
+ catch (error) {
657
+ return {
658
+ content: [{ type: 'text', text: `Failed to create Moltbook comment: ${error.message}` }],
659
+ isError: true,
660
+ };
661
+ }
662
+ }
663
+ /**
664
+ * Upvote a post
665
+ */
666
+ export async function handleMoltbookUpvotePost(client, args) {
667
+ try {
668
+ const data = await callMoltbookGatewayProxy(client, {
669
+ action: 'upvote_post',
670
+ provider_id: 'moltbook',
671
+ connection_id: args.connection_id,
672
+ post_id: args.post_id,
673
+ });
674
+ const text = `Upvoted post ${args.post_id}\n_Latency: ${data.latency_ms}ms_`;
675
+ return { content: [{ type: 'text', text }] };
676
+ }
677
+ catch (error) {
678
+ return {
679
+ content: [{ type: 'text', text: `Failed to upvote Moltbook post: ${error.message}` }],
680
+ isError: true,
681
+ };
682
+ }
683
+ }
684
+ /**
685
+ * Downvote a post
686
+ */
687
+ export async function handleMoltbookDownvotePost(client, args) {
688
+ try {
689
+ const data = await callMoltbookGatewayProxy(client, {
690
+ action: 'downvote_post',
691
+ provider_id: 'moltbook',
692
+ connection_id: args.connection_id,
693
+ post_id: args.post_id,
694
+ });
695
+ const text = `Downvoted post ${args.post_id}\n_Latency: ${data.latency_ms}ms_`;
696
+ return { content: [{ type: 'text', text }] };
697
+ }
698
+ catch (error) {
699
+ return {
700
+ content: [{ type: 'text', text: `Failed to downvote Moltbook post: ${error.message}` }],
701
+ isError: true,
702
+ };
703
+ }
704
+ }
705
+ /**
706
+ * Search Moltbook
707
+ */
708
+ export async function handleMoltbookSearch(client, args) {
709
+ try {
710
+ const data = await callMoltbookGatewayProxy(client, {
711
+ action: 'search',
712
+ provider_id: 'moltbook',
713
+ connection_id: args.connection_id,
714
+ query: args.query,
715
+ search_type: args.search_type,
716
+ limit: args.limit,
717
+ });
718
+ const response = data.response || {};
719
+ const results = response.results || response.data || response || [];
720
+ const resultList = Array.isArray(results) ? results : [];
721
+ let text = `# Moltbook Search: "${args.query}"`;
722
+ if (args.search_type)
723
+ text += ` (type: ${args.search_type})`;
724
+ text += `\n\n`;
725
+ if (resultList.length === 0) {
726
+ text += `No results found.\n`;
727
+ }
728
+ else {
729
+ resultList.forEach((item, i) => {
730
+ const name = item.title || item.name || 'Unknown';
731
+ const type = item.type || 'result';
732
+ const desc = item.description || item.content || '';
733
+ const descPreview = desc.length > 100 ? desc.substring(0, 100) + '...' : desc;
734
+ text += `**${i + 1}. [${type}] ${name}**\n`;
735
+ if (descPreview)
736
+ text += `${descPreview}\n`;
737
+ if (item.id)
738
+ text += `_ID: ${item.id}_\n`;
739
+ text += `\n`;
740
+ });
741
+ text += `**${resultList.length} results**`;
742
+ }
743
+ text += `\n_Latency: ${data.latency_ms}ms_`;
744
+ return { content: [{ type: 'text', text }] };
745
+ }
746
+ catch (error) {
747
+ return {
748
+ content: [{ type: 'text', text: `Failed to search Moltbook: ${error.message}` }],
749
+ isError: true,
750
+ };
751
+ }
752
+ }
753
+ /**
754
+ * Get notifications
755
+ */
756
+ export async function handleMoltbookGetNotifications(client, args) {
757
+ try {
758
+ const data = await callMoltbookGatewayProxy(client, {
759
+ action: 'get_notifications',
760
+ provider_id: 'moltbook',
761
+ connection_id: args.connection_id,
762
+ limit: args.limit,
763
+ });
764
+ const response = data.response || {};
765
+ const notifications = response.notifications || response.data || response || [];
766
+ const notifList = Array.isArray(notifications) ? notifications : [];
767
+ let text = `# Moltbook Notifications\n\n`;
768
+ if (notifList.length === 0) {
769
+ text += `No notifications.\n`;
770
+ }
771
+ else {
772
+ notifList.forEach((notif, i) => {
773
+ const type = notif.type || 'notification';
774
+ const message = notif.message || notif.text || '';
775
+ const read = notif.is_read ? '' : ' **[NEW]**';
776
+ text += `${i + 1}. [${type}]${read} ${message}\n`;
777
+ if (notif.created_at)
778
+ text += ` _${notif.created_at}_\n`;
779
+ });
780
+ text += `\n**${notifList.length} notifications**`;
781
+ }
782
+ text += `\n_Latency: ${data.latency_ms}ms_`;
783
+ return { content: [{ type: 'text', text }] };
784
+ }
785
+ catch (error) {
786
+ return {
787
+ content: [{ type: 'text', text: `Failed to get Moltbook notifications: ${error.message}` }],
788
+ isError: true,
789
+ };
790
+ }
791
+ }
792
+ //# sourceMappingURL=moltbook.js.map