@mseep/mcp-agent-social 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.
- package/LICENSE +21 -0
- package/README.md +154 -0
- package/bin/mcp-agent-social +30 -0
- package/dist/api-client.d.ts +31 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +212 -0
- package/dist/api-client.js.map +1 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +79 -0
- package/dist/config.js.map +1 -0
- package/dist/hooks/index.d.ts +38 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +253 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/types.d.ts +35 -0
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/hooks/types.js +4 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/http-server.d.ts +38 -0
- package/dist/http-server.d.ts.map +1 -0
- package/dist/http-server.js +210 -0
- package/dist/http-server.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +186 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +44 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +281 -0
- package/dist/logger.js.map +1 -0
- package/dist/metrics.d.ts +47 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +178 -0
- package/dist/metrics.js.map +1 -0
- package/dist/middleware/error-handler.d.ts +74 -0
- package/dist/middleware/error-handler.d.ts.map +1 -0
- package/dist/middleware/error-handler.js +218 -0
- package/dist/middleware/error-handler.js.map +1 -0
- package/dist/middleware/index.d.ts +55 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +91 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/timeout.d.ts +52 -0
- package/dist/middleware/timeout.d.ts.map +1 -0
- package/dist/middleware/timeout.js +189 -0
- package/dist/middleware/timeout.js.map +1 -0
- package/dist/middleware/validator.d.ts +25 -0
- package/dist/middleware/validator.d.ts.map +1 -0
- package/dist/middleware/validator.js +186 -0
- package/dist/middleware/validator.js.map +1 -0
- package/dist/prompts/analyze.d.ts +46 -0
- package/dist/prompts/analyze.d.ts.map +1 -0
- package/dist/prompts/analyze.js +351 -0
- package/dist/prompts/analyze.js.map +1 -0
- package/dist/prompts/generate.d.ts +48 -0
- package/dist/prompts/generate.d.ts.map +1 -0
- package/dist/prompts/generate.js +177 -0
- package/dist/prompts/generate.js.map +1 -0
- package/dist/prompts/index.d.ts +23 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +69 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/summarize.d.ts +32 -0
- package/dist/prompts/summarize.d.ts.map +1 -0
- package/dist/prompts/summarize.js +182 -0
- package/dist/prompts/summarize.js.map +1 -0
- package/dist/prompts/types.d.ts +34 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/prompts/types.js +24 -0
- package/dist/prompts/types.js.map +1 -0
- package/dist/resources/agents.d.ts +17 -0
- package/dist/resources/agents.d.ts.map +1 -0
- package/dist/resources/agents.js +139 -0
- package/dist/resources/agents.js.map +1 -0
- package/dist/resources/feed.d.ts +19 -0
- package/dist/resources/feed.d.ts.map +1 -0
- package/dist/resources/feed.js +138 -0
- package/dist/resources/feed.js.map +1 -0
- package/dist/resources/index.d.ts +19 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +146 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/posts.d.ts +17 -0
- package/dist/resources/posts.d.ts.map +1 -0
- package/dist/resources/posts.js +151 -0
- package/dist/resources/posts.js.map +1 -0
- package/dist/resources/types.d.ts +91 -0
- package/dist/resources/types.d.ts.map +1 -0
- package/dist/resources/types.js +12 -0
- package/dist/resources/types.js.map +1 -0
- package/dist/roots/index.d.ts +43 -0
- package/dist/roots/index.d.ts.map +1 -0
- package/dist/roots/index.js +131 -0
- package/dist/roots/index.js.map +1 -0
- package/dist/roots/types.d.ts +31 -0
- package/dist/roots/types.d.ts.map +1 -0
- package/dist/roots/types.js +4 -0
- package/dist/roots/types.js.map +1 -0
- package/dist/session-manager.d.ts +50 -0
- package/dist/session-manager.d.ts.map +1 -0
- package/dist/session-manager.js +127 -0
- package/dist/session-manager.js.map +1 -0
- package/dist/tools/create-post.d.ts +45 -0
- package/dist/tools/create-post.d.ts.map +1 -0
- package/dist/tools/create-post.js +119 -0
- package/dist/tools/create-post.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +44 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/login.d.ts +35 -0
- package/dist/tools/login.d.ts.map +1 -0
- package/dist/tools/login.js +132 -0
- package/dist/tools/login.js.map +1 -0
- package/dist/tools/read-posts.d.ts +48 -0
- package/dist/tools/read-posts.d.ts.map +1 -0
- package/dist/tools/read-posts.js +93 -0
- package/dist/tools/read-posts.js.map +1 -0
- package/dist/types.d.ts +88 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/json.d.ts +13 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +48 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/validation.d.ts +58 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +223 -0
- package/dist/validation.js.map +1 -0
- package/package.json +70 -0
- package/src/api-client.ts +292 -0
- package/src/config.ts +92 -0
- package/src/hooks/index.ts +304 -0
- package/src/hooks/types.ts +44 -0
- package/src/http-server.ts +243 -0
- package/src/index.ts +213 -0
- package/src/logger.ts +326 -0
- package/src/metrics.ts +235 -0
- package/src/middleware/error-handler.ts +252 -0
- package/src/middleware/index.ts +112 -0
- package/src/middleware/timeout.ts +216 -0
- package/src/middleware/validator.ts +216 -0
- package/src/prompts/analyze.ts +404 -0
- package/src/prompts/generate.ts +217 -0
- package/src/prompts/index.ts +121 -0
- package/src/prompts/summarize.ts +217 -0
- package/src/prompts/types.ts +44 -0
- package/src/resources/agents.ts +165 -0
- package/src/resources/feed.ts +169 -0
- package/src/resources/index.ts +210 -0
- package/src/resources/posts.ts +179 -0
- package/src/resources/types.ts +104 -0
- package/src/roots/index.ts +166 -0
- package/src/roots/types.ts +36 -0
- package/src/session-manager.ts +149 -0
- package/src/tools/create-post.ts +154 -0
- package/src/tools/index.ts +70 -0
- package/src/tools/login.ts +169 -0
- package/src/tools/read-posts.ts +120 -0
- package/src/types.ts +107 -0
- package/src/utils/json.ts +46 -0
- package/src/validation.ts +322 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
// ABOUTME: Analysis prompts for social media insights
|
|
2
|
+
// ABOUTME: Provides templates for sentiment analysis and trend detection
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { config } from '../config.js';
|
|
5
|
+
import { logger } from '../logger.js';
|
|
6
|
+
const analyzeSentimentArgsSchema = {
|
|
7
|
+
scope: z.string().describe('Scope of analysis: thread, agent, tag, or recent'),
|
|
8
|
+
target: z.string().optional().describe('Target ID (thread_id, agent_name, or tag)'),
|
|
9
|
+
};
|
|
10
|
+
export async function analyzeSentimentPrompt(args, _extra, context) {
|
|
11
|
+
try {
|
|
12
|
+
logger.debug('Generating sentiment analysis prompt', {
|
|
13
|
+
scope: args.scope,
|
|
14
|
+
target: args.target,
|
|
15
|
+
});
|
|
16
|
+
let posts;
|
|
17
|
+
let description = '';
|
|
18
|
+
// Fetch posts based on scope
|
|
19
|
+
switch (args.scope) {
|
|
20
|
+
case 'thread': {
|
|
21
|
+
if (!args.target) {
|
|
22
|
+
return {
|
|
23
|
+
description: 'Thread ID required',
|
|
24
|
+
messages: [
|
|
25
|
+
{
|
|
26
|
+
role: 'user',
|
|
27
|
+
content: {
|
|
28
|
+
type: 'text',
|
|
29
|
+
text: 'Thread ID is required for thread sentiment analysis',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const threadResponse = await context.apiClient.fetchPosts(config.teamName, {
|
|
36
|
+
thread_id: args.target,
|
|
37
|
+
limit: 100,
|
|
38
|
+
offset: 0,
|
|
39
|
+
});
|
|
40
|
+
posts = threadResponse.posts;
|
|
41
|
+
description = `Thread ${args.target}`;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case 'agent': {
|
|
45
|
+
if (!args.target) {
|
|
46
|
+
return {
|
|
47
|
+
description: 'Agent name required',
|
|
48
|
+
messages: [
|
|
49
|
+
{
|
|
50
|
+
role: 'user',
|
|
51
|
+
content: {
|
|
52
|
+
type: 'text',
|
|
53
|
+
text: 'Agent name is required for agent sentiment analysis',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const agentResponse = await context.apiClient.fetchPosts(config.teamName, {
|
|
60
|
+
agent_filter: args.target,
|
|
61
|
+
limit: 50,
|
|
62
|
+
offset: 0,
|
|
63
|
+
});
|
|
64
|
+
posts = agentResponse.posts;
|
|
65
|
+
description = `Agent ${args.target}'s posts`;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case 'tag': {
|
|
69
|
+
if (!args.target) {
|
|
70
|
+
return {
|
|
71
|
+
description: 'Tag required',
|
|
72
|
+
messages: [
|
|
73
|
+
{
|
|
74
|
+
role: 'user',
|
|
75
|
+
content: {
|
|
76
|
+
type: 'text',
|
|
77
|
+
text: 'Tag is required for tag sentiment analysis',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const tagResponse = await context.apiClient.fetchPosts(config.teamName, {
|
|
84
|
+
tag_filter: args.target,
|
|
85
|
+
limit: 50,
|
|
86
|
+
offset: 0,
|
|
87
|
+
});
|
|
88
|
+
posts = tagResponse.posts;
|
|
89
|
+
description = `Posts tagged with #${args.target}`;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
default: {
|
|
93
|
+
const recentResponse = await context.apiClient.fetchPosts(config.teamName, {
|
|
94
|
+
limit: 30,
|
|
95
|
+
offset: 0,
|
|
96
|
+
});
|
|
97
|
+
posts = recentResponse.posts;
|
|
98
|
+
description = 'Recent posts';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!posts || posts.length === 0) {
|
|
102
|
+
return {
|
|
103
|
+
description: 'No posts found',
|
|
104
|
+
messages: [
|
|
105
|
+
{
|
|
106
|
+
role: 'user',
|
|
107
|
+
content: {
|
|
108
|
+
type: 'text',
|
|
109
|
+
text: `No posts found for ${description}`,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const postSample = posts
|
|
116
|
+
.slice(0, 20)
|
|
117
|
+
.map((p) => `${p.author_name}: "${p.content}"`)
|
|
118
|
+
.join('\n\n');
|
|
119
|
+
return {
|
|
120
|
+
description: `Analyze sentiment of ${description}`,
|
|
121
|
+
messages: [
|
|
122
|
+
{
|
|
123
|
+
role: 'user',
|
|
124
|
+
content: {
|
|
125
|
+
type: 'text',
|
|
126
|
+
text: `Please analyze the sentiment of the following social media posts from ${description}:
|
|
127
|
+
|
|
128
|
+
Total posts: ${posts.length}
|
|
129
|
+
Sample analyzed: ${Math.min(20, posts.length)}
|
|
130
|
+
|
|
131
|
+
Posts:
|
|
132
|
+
${postSample}
|
|
133
|
+
|
|
134
|
+
Please provide:
|
|
135
|
+
1. Overall sentiment (positive, negative, neutral, mixed)
|
|
136
|
+
2. Sentiment distribution (% positive, negative, neutral)
|
|
137
|
+
3. Key emotional themes detected
|
|
138
|
+
4. Notable sentiment shifts or patterns
|
|
139
|
+
5. Specific posts that exemplify the dominant sentiment
|
|
140
|
+
6. Any concerning or notably positive trends`,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
logger.error('Error generating sentiment analysis prompt', { error, scope: args.scope });
|
|
148
|
+
return {
|
|
149
|
+
description: 'Error generating prompt',
|
|
150
|
+
messages: [
|
|
151
|
+
{
|
|
152
|
+
role: 'user',
|
|
153
|
+
content: {
|
|
154
|
+
type: 'text',
|
|
155
|
+
text: `Error fetching data: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const findRelatedArgsSchema = {
|
|
163
|
+
topic: z.string().describe('The topic or keywords to search for'),
|
|
164
|
+
limit: z.string().optional().describe('Maximum number of results (default: 10)'),
|
|
165
|
+
};
|
|
166
|
+
export async function findRelatedDiscussionsPrompt(args, _extra, context) {
|
|
167
|
+
try {
|
|
168
|
+
const limit = args.limit ? Number.parseInt(args.limit, 10) : 10;
|
|
169
|
+
logger.debug('Generating related discussions prompt', { topic: args.topic, limit });
|
|
170
|
+
// Fetch recent posts to search through
|
|
171
|
+
const response = await context.apiClient.fetchPosts(config.teamName, {
|
|
172
|
+
limit: 100,
|
|
173
|
+
offset: 0,
|
|
174
|
+
});
|
|
175
|
+
// Simple keyword matching (in a real system, this would be more sophisticated)
|
|
176
|
+
const keywords = args.topic.toLowerCase().split(' ');
|
|
177
|
+
const relevantPosts = response.posts.filter((post) => {
|
|
178
|
+
const content = post.content.toLowerCase();
|
|
179
|
+
return keywords.some((keyword) => content.includes(keyword));
|
|
180
|
+
});
|
|
181
|
+
if (relevantPosts.length === 0) {
|
|
182
|
+
return {
|
|
183
|
+
description: 'No related discussions found',
|
|
184
|
+
messages: [
|
|
185
|
+
{
|
|
186
|
+
role: 'user',
|
|
187
|
+
content: {
|
|
188
|
+
type: 'text',
|
|
189
|
+
text: `No discussions found related to "${args.topic}"`,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
const discussions = relevantPosts
|
|
196
|
+
.slice(0, limit)
|
|
197
|
+
.map((p) => `[${p.id}] ${p.author_name}: "${p.content}"${p.tags?.length ? ` [${p.tags.join(', ')}]` : ''}`)
|
|
198
|
+
.join('\n\n');
|
|
199
|
+
return {
|
|
200
|
+
description: `Find discussions related to "${args.topic}"`,
|
|
201
|
+
messages: [
|
|
202
|
+
{
|
|
203
|
+
role: 'user',
|
|
204
|
+
content: {
|
|
205
|
+
type: 'text',
|
|
206
|
+
text: `Analyze the following posts related to "${args.topic}":
|
|
207
|
+
|
|
208
|
+
Found ${relevantPosts.length} related posts (showing ${Math.min(limit, relevantPosts.length)}):
|
|
209
|
+
|
|
210
|
+
${discussions}
|
|
211
|
+
|
|
212
|
+
Please provide:
|
|
213
|
+
1. A summary of how these posts relate to "${args.topic}"
|
|
214
|
+
2. Common themes or perspectives across the discussions
|
|
215
|
+
3. Any conflicting viewpoints or debates
|
|
216
|
+
4. Key insights or conclusions from the community
|
|
217
|
+
5. Recommendations for which threads to explore further
|
|
218
|
+
6. Suggested follow-up questions or topics`,
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
logger.error('Error generating related discussions prompt', { error, topic: args.topic });
|
|
226
|
+
return {
|
|
227
|
+
description: 'Error generating prompt',
|
|
228
|
+
messages: [
|
|
229
|
+
{
|
|
230
|
+
role: 'user',
|
|
231
|
+
content: {
|
|
232
|
+
type: 'text',
|
|
233
|
+
text: `Error searching for discussions: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const engagementReportArgsSchema = {
|
|
241
|
+
time_period: z.string().optional().describe('Time period: today, week, month (default: week)'),
|
|
242
|
+
focus: z.string().optional().describe('Focus area: posts, replies, tags, agents'),
|
|
243
|
+
};
|
|
244
|
+
export async function generateEngagementReportPrompt(args, _extra, context) {
|
|
245
|
+
try {
|
|
246
|
+
const period = args.time_period || 'week';
|
|
247
|
+
const focus = args.focus || 'general';
|
|
248
|
+
logger.debug('Generating engagement report prompt', { period, focus });
|
|
249
|
+
// Fetch posts (in a real system, would filter by time)
|
|
250
|
+
const response = await context.apiClient.fetchPosts(config.teamName, {
|
|
251
|
+
limit: 100,
|
|
252
|
+
offset: 0,
|
|
253
|
+
});
|
|
254
|
+
// Analyze engagement patterns
|
|
255
|
+
const posts = response.posts;
|
|
256
|
+
const authors = new Set(posts.map((p) => p.author_name));
|
|
257
|
+
const threads = new Set(posts.filter((p) => p.parent_post_id).map((p) => p.parent_post_id));
|
|
258
|
+
const tags = posts.flatMap((p) => p.tags || []);
|
|
259
|
+
const tagCounts = tags.reduce((acc, tag) => {
|
|
260
|
+
acc[tag] = (acc[tag] || 0) + 1;
|
|
261
|
+
return acc;
|
|
262
|
+
}, {});
|
|
263
|
+
const topTags = Object.entries(tagCounts)
|
|
264
|
+
.sort(([, a], [, b]) => b - a)
|
|
265
|
+
.slice(0, 5)
|
|
266
|
+
.map(([tag, count]) => `#${tag} (${count} uses)`)
|
|
267
|
+
.join(', ');
|
|
268
|
+
const originalPosts = posts.filter((p) => !p.parent_post_id).length;
|
|
269
|
+
const replies = posts.filter((p) => p.parent_post_id).length;
|
|
270
|
+
return {
|
|
271
|
+
description: `Generate ${period} engagement report`,
|
|
272
|
+
messages: [
|
|
273
|
+
{
|
|
274
|
+
role: 'user',
|
|
275
|
+
content: {
|
|
276
|
+
type: 'text',
|
|
277
|
+
text: `Generate an engagement report for the ${period} with focus on ${focus}:
|
|
278
|
+
|
|
279
|
+
Data Summary:
|
|
280
|
+
- Total Posts: ${posts.length}
|
|
281
|
+
- Original Posts: ${originalPosts}
|
|
282
|
+
- Replies: ${replies}
|
|
283
|
+
- Active Users: ${authors.size}
|
|
284
|
+
- Active Threads: ${threads.size}
|
|
285
|
+
- Top Tags: ${topTags || 'none'}
|
|
286
|
+
|
|
287
|
+
Time Range: ${posts[posts.length - 1]?.timestamp} to ${posts[0]?.timestamp}
|
|
288
|
+
|
|
289
|
+
Please create a comprehensive engagement report including:
|
|
290
|
+
|
|
291
|
+
1. Executive Summary
|
|
292
|
+
- Key metrics and trends
|
|
293
|
+
- Engagement rate (replies vs original posts)
|
|
294
|
+
- User participation levels
|
|
295
|
+
|
|
296
|
+
2. Content Analysis
|
|
297
|
+
- Most discussed topics
|
|
298
|
+
- Popular content types
|
|
299
|
+
- Viral posts or threads
|
|
300
|
+
|
|
301
|
+
3. User Behavior
|
|
302
|
+
- Most active contributors
|
|
303
|
+
- New vs returning users
|
|
304
|
+
- Engagement patterns
|
|
305
|
+
|
|
306
|
+
4. Insights & Recommendations
|
|
307
|
+
- What's working well
|
|
308
|
+
- Areas for improvement
|
|
309
|
+
- Suggested actions to increase engagement
|
|
310
|
+
|
|
311
|
+
5. ${focus === 'general' ? 'Overall trends' : `Specific ${focus} analysis`}`,
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
logger.error('Error generating engagement report prompt', { error });
|
|
319
|
+
return {
|
|
320
|
+
description: 'Error generating prompt',
|
|
321
|
+
messages: [
|
|
322
|
+
{
|
|
323
|
+
role: 'user',
|
|
324
|
+
content: {
|
|
325
|
+
type: 'text',
|
|
326
|
+
text: `Error generating report: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
// Export schemas for registration
|
|
334
|
+
export const analyzePrompts = {
|
|
335
|
+
analyzeSentiment: {
|
|
336
|
+
description: 'Analyze sentiment of posts by thread, agent, tag, or recent',
|
|
337
|
+
argsSchema: analyzeSentimentArgsSchema,
|
|
338
|
+
handler: analyzeSentimentPrompt,
|
|
339
|
+
},
|
|
340
|
+
findRelatedDiscussions: {
|
|
341
|
+
description: 'Find discussions related to a specific topic',
|
|
342
|
+
argsSchema: findRelatedArgsSchema,
|
|
343
|
+
handler: findRelatedDiscussionsPrompt,
|
|
344
|
+
},
|
|
345
|
+
generateEngagementReport: {
|
|
346
|
+
description: 'Generate engagement analytics and insights',
|
|
347
|
+
argsSchema: engagementReportArgsSchema,
|
|
348
|
+
handler: generateEngagementReportPrompt,
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
//# sourceMappingURL=analyze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.js","sourceRoot":"","sources":["../../src/prompts/analyze.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,yEAAyE;AAQzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAOtC,MAAM,0BAA0B,GAAG;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;IAC9E,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;CACpF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,IAAwC,EACxC,MAA8D,EAC9D,OAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,sCAAsC,EAAE;YACnD,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC;QAEH,IAAI,KAAyB,CAAC;QAC9B,IAAI,WAAW,GAAG,EAAE,CAAC;QAErB,6BAA6B;QAC7B,QAAQ,IAAI,CAAC,K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S,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,YAAY,KAAK,WAAW,EAAE;qBACjE;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,2CAA2C,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACrE,OAAO;YACL,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE;qBAC7F;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,kCAAkC;AAClC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,gBAAgB,EAAE;QAChB,WAAW,EAAE,6DAA6D;QAC1E,UAAU,EAAE,0BAA0B;QACtC,OAAO,EAAE,sBAAsB;KAChC;IACD,sBAAsB,EAAE;QACtB,WAAW,EAAE,8CAA8C;QAC3D,UAAU,EAAE,qBAAqB;QACjC,OAAO,EAAE,4BAA4B;KACtC;IACD,wBAAwB,EAAE;QACxB,WAAW,EAAE,4CAA4C;QACzD,UAAU,EAAE,0BAA0B;QACtC,OAAO,EAAE,8BAA8B;KACxC;CACF,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
2
|
+
import type { GetPromptResult, ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import type { IApiClient } from '../api-client.js';
|
|
5
|
+
import type { SessionManager } from '../session-manager.js';
|
|
6
|
+
export interface GeneratePromptContext {
|
|
7
|
+
apiClient: IApiClient;
|
|
8
|
+
sessionManager: SessionManager;
|
|
9
|
+
}
|
|
10
|
+
export declare function draftReplyPrompt(args: {
|
|
11
|
+
post_id: string;
|
|
12
|
+
tone?: string;
|
|
13
|
+
}, _extra: RequestHandlerExtra<ServerRequest, ServerNotification>, context: GeneratePromptContext): Promise<GetPromptResult>;
|
|
14
|
+
export declare function generateHashtagsPrompt(args: {
|
|
15
|
+
content: string;
|
|
16
|
+
style?: string;
|
|
17
|
+
}, _extra: RequestHandlerExtra<ServerRequest, ServerNotification>, _context: GeneratePromptContext): Promise<GetPromptResult>;
|
|
18
|
+
export declare function createEngagementPostPrompt(args: {
|
|
19
|
+
topic: string;
|
|
20
|
+
post_type?: string;
|
|
21
|
+
}, _extra: RequestHandlerExtra<ServerRequest, ServerNotification>, context: GeneratePromptContext): Promise<GetPromptResult>;
|
|
22
|
+
export declare const generatePrompts: {
|
|
23
|
+
draftReply: {
|
|
24
|
+
description: string;
|
|
25
|
+
argsSchema: {
|
|
26
|
+
post_id: z.ZodString;
|
|
27
|
+
tone: z.ZodOptional<z.ZodString>;
|
|
28
|
+
};
|
|
29
|
+
handler: typeof draftReplyPrompt;
|
|
30
|
+
};
|
|
31
|
+
generateHashtags: {
|
|
32
|
+
description: string;
|
|
33
|
+
argsSchema: {
|
|
34
|
+
content: z.ZodString;
|
|
35
|
+
style: z.ZodOptional<z.ZodString>;
|
|
36
|
+
};
|
|
37
|
+
handler: typeof generateHashtagsPrompt;
|
|
38
|
+
};
|
|
39
|
+
createEngagementPost: {
|
|
40
|
+
description: string;
|
|
41
|
+
argsSchema: {
|
|
42
|
+
topic: z.ZodString;
|
|
43
|
+
post_type: z.ZodOptional<z.ZodString>;
|
|
44
|
+
};
|
|
45
|
+
handler: typeof createEngagementPostPrompt;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/prompts/generate.ts"],"names":[],"mappings":"AAG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: Generation prompts for creating social media content
|
|
2
|
+
// ABOUTME: Provides templates for drafting posts and replies
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { config } from '../config.js';
|
|
5
|
+
import { logger } from '../logger.js';
|
|
6
|
+
const draftReplyArgsSchema = {
|
|
7
|
+
post_id: z.string().describe('The ID of the post to reply to'),
|
|
8
|
+
tone: z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe('Desired tone: friendly, professional, casual, enthusiastic'),
|
|
12
|
+
};
|
|
13
|
+
export async function draftReplyPrompt(args, _extra, context) {
|
|
14
|
+
try {
|
|
15
|
+
logger.debug('Generating reply draft prompt', { postId: args.post_id });
|
|
16
|
+
// Get current session to know who's replying
|
|
17
|
+
const session = context.sessionManager.getSession('global-session');
|
|
18
|
+
const agentName = session?.agentName || 'Anonymous';
|
|
19
|
+
// Fetch the specific post and its context
|
|
20
|
+
const response = await context.apiClient.fetchPosts(config.teamName, {
|
|
21
|
+
limit: 50,
|
|
22
|
+
offset: 0,
|
|
23
|
+
});
|
|
24
|
+
const post = response.posts.find((p) => p.id === args.post_id);
|
|
25
|
+
if (!post) {
|
|
26
|
+
return {
|
|
27
|
+
description: 'Post not found',
|
|
28
|
+
messages: [
|
|
29
|
+
{
|
|
30
|
+
role: 'user',
|
|
31
|
+
content: {
|
|
32
|
+
type: 'text',
|
|
33
|
+
text: `Unable to find post with ID: ${args.post_id}`,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// If it's part of a thread, get context
|
|
40
|
+
let threadContext = '';
|
|
41
|
+
if (post.parent_post_id) {
|
|
42
|
+
const parentPost = response.posts.find((p) => p.id === post.parent_post_id);
|
|
43
|
+
if (parentPost) {
|
|
44
|
+
threadContext = `\n\nOriginal post by ${parentPost.author_name}: "${parentPost.content}"`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const tone = args.tone || 'friendly';
|
|
48
|
+
return {
|
|
49
|
+
description: 'Draft a contextual reply to a social media post',
|
|
50
|
+
messages: [
|
|
51
|
+
{
|
|
52
|
+
role: 'user',
|
|
53
|
+
content: {
|
|
54
|
+
type: 'text',
|
|
55
|
+
text: `You are ${agentName}, drafting a reply to a social media post.
|
|
56
|
+
|
|
57
|
+
Post to reply to:
|
|
58
|
+
Author: ${post.author_name}
|
|
59
|
+
Content: "${post.content}"
|
|
60
|
+
Tags: ${post.tags?.join(', ') || 'none'}${threadContext}
|
|
61
|
+
|
|
62
|
+
Please draft a ${tone} reply that:
|
|
63
|
+
1. Acknowledges the author's point or question
|
|
64
|
+
2. Adds value to the conversation
|
|
65
|
+
3. Maintains a ${tone} tone
|
|
66
|
+
4. Is concise and engaging (under 280 characters if possible)
|
|
67
|
+
5. Uses relevant hashtags if appropriate
|
|
68
|
+
|
|
69
|
+
Draft 3 different reply options.`,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
logger.error('Error generating reply draft prompt', { error, postId: args.post_id });
|
|
77
|
+
return {
|
|
78
|
+
description: 'Error generating prompt',
|
|
79
|
+
messages: [
|
|
80
|
+
{
|
|
81
|
+
role: 'user',
|
|
82
|
+
content: {
|
|
83
|
+
type: 'text',
|
|
84
|
+
text: `Error fetching post data: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const generateHashtagsArgsSchema = {
|
|
92
|
+
content: z.string().describe('The post content to generate hashtags for'),
|
|
93
|
+
style: z.string().optional().describe('Hashtag style: trending, professional, casual, minimal'),
|
|
94
|
+
};
|
|
95
|
+
export async function generateHashtagsPrompt(args, _extra, _context) {
|
|
96
|
+
const style = args.style || 'trending';
|
|
97
|
+
return {
|
|
98
|
+
description: 'Generate relevant hashtags for social media content',
|
|
99
|
+
messages: [
|
|
100
|
+
{
|
|
101
|
+
role: 'user',
|
|
102
|
+
content: {
|
|
103
|
+
type: 'text',
|
|
104
|
+
text: `Generate hashtags for the following social media post:
|
|
105
|
+
|
|
106
|
+
"${args.content}"
|
|
107
|
+
|
|
108
|
+
Style preference: ${style}
|
|
109
|
+
|
|
110
|
+
Please suggest:
|
|
111
|
+
1. 3-5 highly relevant hashtags
|
|
112
|
+
2. 2-3 trending or popular related hashtags
|
|
113
|
+
3. 1-2 unique/creative hashtags
|
|
114
|
+
|
|
115
|
+
Format the response as a list of hashtags with brief explanations for each choice.
|
|
116
|
+
Consider the content's topic, tone, and potential audience.`,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const createEngagementPostArgsSchema = {
|
|
123
|
+
topic: z.string().describe('The topic or theme for the post'),
|
|
124
|
+
post_type: z.string().optional().describe('Type: question, poll, discussion, announcement'),
|
|
125
|
+
};
|
|
126
|
+
export async function createEngagementPostPrompt(args, _extra, context) {
|
|
127
|
+
const postType = args.post_type || 'discussion';
|
|
128
|
+
const session = context.sessionManager.getSession('global-session');
|
|
129
|
+
const agentName = session?.agentName || 'AI Assistant';
|
|
130
|
+
return {
|
|
131
|
+
description: 'Create an engaging social media post to drive conversation',
|
|
132
|
+
messages: [
|
|
133
|
+
{
|
|
134
|
+
role: 'user',
|
|
135
|
+
content: {
|
|
136
|
+
type: 'text',
|
|
137
|
+
text: `You are ${agentName}, creating an engaging ${postType} post about "${args.topic}".
|
|
138
|
+
|
|
139
|
+
Create a social media post that:
|
|
140
|
+
1. Sparks conversation and encourages responses
|
|
141
|
+
2. Is relevant to ${args.topic}
|
|
142
|
+
3. Fits the ${postType} format
|
|
143
|
+
4. Includes a clear call-to-action
|
|
144
|
+
5. Uses appropriate emojis and formatting
|
|
145
|
+
6. Stays under 280 characters if possible
|
|
146
|
+
|
|
147
|
+
Additional guidelines by post type:
|
|
148
|
+
- question: Ask an open-ended, thought-provoking question
|
|
149
|
+
- poll: Present 2-4 clear options for people to choose from
|
|
150
|
+
- discussion: Share an interesting perspective and invite opinions
|
|
151
|
+
- announcement: Share news/updates in an exciting, engaging way
|
|
152
|
+
|
|
153
|
+
Generate 3 different versions of the post.`,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
// Export schemas for registration
|
|
160
|
+
export const generatePrompts = {
|
|
161
|
+
draftReply: {
|
|
162
|
+
description: 'Draft contextual replies to social media posts',
|
|
163
|
+
argsSchema: draftReplyArgsSchema,
|
|
164
|
+
handler: draftReplyPrompt,
|
|
165
|
+
},
|
|
166
|
+
generateHashtags: {
|
|
167
|
+
description: 'Generate relevant hashtags for post content',
|
|
168
|
+
argsSchema: generateHashtagsArgsSchema,
|
|
169
|
+
handler: generateHashtagsPrompt,
|
|
170
|
+
},
|
|
171
|
+
createEngagementPost: {
|
|
172
|
+
description: 'Create posts designed to drive engagement',
|
|
173
|
+
argsSchema: createEngagementPostArgsSchema,
|
|
174
|
+
handler: createEngagementPostPrompt,
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/prompts/generate.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,6DAA6D;AAQ7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAQtC,MAAM,oBAAoB,GAAG;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IAC9D,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,4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AC7D,UAAU,EAAE,oBAAoB;QAChC,OAAO,EAAE,gBAAgB;KAC1B;IACD,gBAAgB,EAAE;QAChB,WAAW,EAAE,6CAA6C;QAC1D,UAAU,EAAE,0BAA0B;QACtC,OAAO,EAAE,sBAAsB;KAChC;IACD,oBAAoB,EAAE;QACpB,WAAW,EAAE,2CAA2C;QACxD,UAAU,EAAE,8BAA8B;QAC1C,OAAO,EAAE,0BAA0B;KACpC;CACF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
3
|
+
import type { GetPromptResult, ListPromptsResult, ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import type { IApiClient } from '../api-client.js';
|
|
5
|
+
import type { SessionManager } from '../session-manager.js';
|
|
6
|
+
export interface PromptContext {
|
|
7
|
+
apiClient: IApiClient;
|
|
8
|
+
sessionManager: SessionManager;
|
|
9
|
+
hooksManager?: any;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Register all prompts with the MCP server
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerPrompts(server: McpServer, context: PromptContext): void;
|
|
15
|
+
/**
|
|
16
|
+
* List all available prompts
|
|
17
|
+
*/
|
|
18
|
+
export declare function listPrompts(): Promise<ListPromptsResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Get a specific prompt by name
|
|
21
|
+
*/
|
|
22
|
+
export declare function getPrompt(name: string, args: Record<string, string>, context: PromptContext, extra?: RequestHandlerExtra<ServerRequest, ServerNotification>): Promise<GetPromptResult | null>;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAE5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAK5D,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,UAAU,CAAC;IACtB,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAgCD;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAoB/E;AAED;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAc9D;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,OAAO,EAAE,aAAa,EACtB,KAAK,CAAC,EAAE,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,GAC7D,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAajC"}
|