@esaio/esa-mcp-server 0.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/.claude/settings.local.json +23 -0
- package/.dockerignore +36 -0
- package/.envrc +2 -0
- package/.github/dependabot.yml +18 -0
- package/.github/workflows/docker-publish.yml +120 -0
- package/.github/workflows/main.yml +41 -0
- package/.node-version +1 -0
- package/CLAUDE.md +94 -0
- package/Dockerfile +34 -0
- package/LICENSE +7 -0
- package/README.en.md +139 -0
- package/README.md +139 -0
- package/bin/index.js +30 -0
- package/biome.json +57 -0
- package/package.json +48 -0
- package/src/__tests__/fixtures/mock-comment.ts +90 -0
- package/src/__tests__/fixtures/mock-post.ts +79 -0
- package/src/__tests__/index.test.ts +209 -0
- package/src/api_client/__tests__/index.test.ts +149 -0
- package/src/api_client/__tests__/middleware.test.ts +119 -0
- package/src/api_client/__tests__/with-context.test.ts +98 -0
- package/src/api_client/index.ts +29 -0
- package/src/api_client/middleware.ts +21 -0
- package/src/api_client/with-context.ts +26 -0
- package/src/config/__tests__/index.test.ts +65 -0
- package/src/config/index.ts +20 -0
- package/src/context/mcp-context.ts +1 -0
- package/src/context/stdio-context.ts +6 -0
- package/src/errors/missing-team-name-error.ts +8 -0
- package/src/formatters/__tests__/mcp-response.test.ts +106 -0
- package/src/formatters/mcp-response.ts +95 -0
- package/src/generated/api-types.ts +2691 -0
- package/src/i18n/__tests__/index.test.ts +53 -0
- package/src/i18n/index.ts +39 -0
- package/src/index.ts +47 -0
- package/src/locales/en.json +13 -0
- package/src/locales/ja.json +13 -0
- package/src/prompts/__tests__/index.test.ts +47 -0
- package/src/prompts/__tests__/summarize-post.test.ts +291 -0
- package/src/prompts/index.ts +21 -0
- package/src/prompts/summarize-post.ts +94 -0
- package/src/resources/__tests__/index.test.ts +49 -0
- package/src/resources/__tests__/recent-posts-list.test.ts +91 -0
- package/src/resources/__tests__/recent-posts.test.ts +270 -0
- package/src/resources/index.ts +33 -0
- package/src/resources/recent-posts-list.ts +22 -0
- package/src/resources/recent-posts.ts +45 -0
- package/src/schemas/team-name-schema.ts +19 -0
- package/src/tools/__tests__/categories.test.ts +226 -0
- package/src/tools/__tests__/comments.test.ts +970 -0
- package/src/tools/__tests__/helps.test.ts +222 -0
- package/src/tools/__tests__/index.test.ts +47 -0
- package/src/tools/__tests__/post-actions.test.ts +445 -0
- package/src/tools/__tests__/posts.test.ts +917 -0
- package/src/tools/__tests__/search.test.ts +339 -0
- package/src/tools/__tests__/teams.test.ts +615 -0
- package/src/tools/categories.ts +93 -0
- package/src/tools/comments.ts +258 -0
- package/src/tools/helps.ts +50 -0
- package/src/tools/index.ts +324 -0
- package/src/tools/post-actions.ts +132 -0
- package/src/tools/posts.ts +179 -0
- package/src/tools/search.ts +98 -0
- package/src/tools/teams.ts +157 -0
- package/src/transformers/__tests__/category-transformer.test.ts +161 -0
- package/src/transformers/__tests__/comment-transformer.test.ts +129 -0
- package/src/transformers/__tests__/post-name-normalizer.test.ts +53 -0
- package/src/transformers/__tests__/post-transformer.test.ts +70 -0
- package/src/transformers/__tests__/query-normalizer.test.ts +98 -0
- package/src/transformers/__tests__/team-name-normalizer.test.ts +21 -0
- package/src/transformers/category-transformer.ts +36 -0
- package/src/transformers/comment-transformer.ts +34 -0
- package/src/transformers/post-name-normalizer.ts +30 -0
- package/src/transformers/post-transformer.ts +38 -0
- package/src/transformers/query-normalizer.ts +36 -0
- package/src/transformers/team-name-normalizer.ts +7 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +30 -0
- package/tsdown.config.ts +13 -0
- package/vitest.config.ts +24 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { createEsaClient } from "../api_client/index.js";
|
|
3
|
+
import { MissingTeamNameError } from "../errors/missing-team-name-error.js";
|
|
4
|
+
import {
|
|
5
|
+
formatToolError,
|
|
6
|
+
formatToolResponse,
|
|
7
|
+
} from "../formatters/mcp-response.js";
|
|
8
|
+
import type { components } from "../generated/api-types.js";
|
|
9
|
+
import { createSchemaWithTeamName } from "../schemas/team-name-schema.js";
|
|
10
|
+
import { transformComment } from "../transformers/comment-transformer.js";
|
|
11
|
+
|
|
12
|
+
export const getCommentSchema = createSchemaWithTeamName({
|
|
13
|
+
commentId: z.number().describe("The comment ID to retrieve"),
|
|
14
|
+
include: z
|
|
15
|
+
.enum(["stargazers"])
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Specify 'stargazers' to include stargazers in the response"),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export async function getComment(
|
|
21
|
+
client: ReturnType<typeof createEsaClient>,
|
|
22
|
+
args: z.infer<typeof getCommentSchema>,
|
|
23
|
+
) {
|
|
24
|
+
try {
|
|
25
|
+
if (!args.teamName) {
|
|
26
|
+
throw new MissingTeamNameError();
|
|
27
|
+
}
|
|
28
|
+
const { data, error, response } = await client.GET(
|
|
29
|
+
"/v1/teams/{team_name}/comments/{comment_id}",
|
|
30
|
+
{
|
|
31
|
+
params: {
|
|
32
|
+
path: { team_name: args.teamName, comment_id: args.commentId },
|
|
33
|
+
query: {
|
|
34
|
+
include: args.include,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
if (error || !response.ok) {
|
|
41
|
+
return formatToolError(error || response.status);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const comment: components["schemas"]["Comment"] = data;
|
|
45
|
+
const transformed = transformComment(comment);
|
|
46
|
+
|
|
47
|
+
return formatToolResponse(transformed);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
return formatToolError(error);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const createCommentSchema = createSchemaWithTeamName({
|
|
54
|
+
postNumber: z.number().describe("The post number to comment on"),
|
|
55
|
+
bodyMd: z.string().describe("The comment content in Markdown format"),
|
|
56
|
+
user: z
|
|
57
|
+
.string()
|
|
58
|
+
.optional()
|
|
59
|
+
.describe("Comment author's screen_name (owner permission required)"),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export async function createComment(
|
|
63
|
+
client: ReturnType<typeof createEsaClient>,
|
|
64
|
+
args: z.infer<typeof createCommentSchema>,
|
|
65
|
+
) {
|
|
66
|
+
try {
|
|
67
|
+
if (!args.teamName) {
|
|
68
|
+
throw new MissingTeamNameError();
|
|
69
|
+
}
|
|
70
|
+
const { data, error, response } = await client.POST(
|
|
71
|
+
"/v1/teams/{team_name}/posts/{post_number}/comments",
|
|
72
|
+
{
|
|
73
|
+
params: {
|
|
74
|
+
path: { team_name: args.teamName, post_number: args.postNumber },
|
|
75
|
+
},
|
|
76
|
+
body: {
|
|
77
|
+
comment: {
|
|
78
|
+
body_md: args.bodyMd,
|
|
79
|
+
user: args.user,
|
|
80
|
+
} as components["schemas"]["CommentInput"],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
if (error || !response.ok) {
|
|
86
|
+
return formatToolError(error || response.status);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const comment: components["schemas"]["Comment"] = data;
|
|
90
|
+
const transformed = transformComment(comment, { truncateBody: 300 });
|
|
91
|
+
|
|
92
|
+
return formatToolResponse(transformed);
|
|
93
|
+
} catch (error) {
|
|
94
|
+
return formatToolError(error);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const updateCommentSchema = createSchemaWithTeamName({
|
|
99
|
+
commentId: z.number().describe("The comment ID to update"),
|
|
100
|
+
bodyMd: z.string().describe("The updated comment content in Markdown format"),
|
|
101
|
+
user: z
|
|
102
|
+
.string()
|
|
103
|
+
.optional()
|
|
104
|
+
.describe("Comment author's screen_name (owner permission required)"),
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export async function updateComment(
|
|
108
|
+
client: ReturnType<typeof createEsaClient>,
|
|
109
|
+
args: z.infer<typeof updateCommentSchema>,
|
|
110
|
+
) {
|
|
111
|
+
try {
|
|
112
|
+
if (!args.teamName) {
|
|
113
|
+
throw new MissingTeamNameError();
|
|
114
|
+
}
|
|
115
|
+
const { data, error, response } = await client.PATCH(
|
|
116
|
+
"/v1/teams/{team_name}/comments/{comment_id}",
|
|
117
|
+
{
|
|
118
|
+
params: {
|
|
119
|
+
path: { team_name: args.teamName, comment_id: args.commentId },
|
|
120
|
+
},
|
|
121
|
+
body: {
|
|
122
|
+
comment: {
|
|
123
|
+
body_md: args.bodyMd,
|
|
124
|
+
user: args.user,
|
|
125
|
+
} as components["schemas"]["CommentInput"],
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
if (error || !response.ok) {
|
|
131
|
+
return formatToolError(error || response.status);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const comment: components["schemas"]["Comment"] = data;
|
|
135
|
+
const transformed = transformComment(comment);
|
|
136
|
+
|
|
137
|
+
return formatToolResponse(transformed);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
return formatToolError(error);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export const deleteCommentSchema = createSchemaWithTeamName({
|
|
144
|
+
commentId: z.number().describe("The comment ID to delete"),
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
export async function deleteComment(
|
|
148
|
+
client: ReturnType<typeof createEsaClient>,
|
|
149
|
+
args: z.infer<typeof deleteCommentSchema>,
|
|
150
|
+
) {
|
|
151
|
+
try {
|
|
152
|
+
if (!args.teamName) {
|
|
153
|
+
throw new MissingTeamNameError();
|
|
154
|
+
}
|
|
155
|
+
const { error, response } = await client.DELETE(
|
|
156
|
+
"/v1/teams/{team_name}/comments/{comment_id}",
|
|
157
|
+
{
|
|
158
|
+
params: {
|
|
159
|
+
path: { team_name: args.teamName, comment_id: args.commentId },
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
if (error || !response.ok) {
|
|
165
|
+
return formatToolError(error || response.status);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return formatToolResponse({
|
|
169
|
+
success: true,
|
|
170
|
+
message: "Comment deleted successfully",
|
|
171
|
+
});
|
|
172
|
+
} catch (error) {
|
|
173
|
+
return formatToolError(error);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export const getPostCommentsSchema = createSchemaWithTeamName({
|
|
178
|
+
postNumber: z.number().describe("The post number to get comments for"),
|
|
179
|
+
page: z.number().optional().describe("Page number (starts from 1)"),
|
|
180
|
+
perPage: z.number().optional().describe("Number of items per page"),
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
export async function getPostComments(
|
|
184
|
+
client: ReturnType<typeof createEsaClient>,
|
|
185
|
+
args: z.infer<typeof getPostCommentsSchema>,
|
|
186
|
+
) {
|
|
187
|
+
try {
|
|
188
|
+
if (!args.teamName) {
|
|
189
|
+
throw new MissingTeamNameError();
|
|
190
|
+
}
|
|
191
|
+
const { data, error, response } = await client.GET(
|
|
192
|
+
"/v1/teams/{team_name}/posts/{post_number}/comments",
|
|
193
|
+
{
|
|
194
|
+
params: {
|
|
195
|
+
path: { team_name: args.teamName, post_number: args.postNumber },
|
|
196
|
+
query: {
|
|
197
|
+
page: args.page,
|
|
198
|
+
per_page: args.perPage,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
if (error || !response.ok) {
|
|
205
|
+
return formatToolError(error || response.status);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const comments: components["schemas"]["Comment"][] = data.comments;
|
|
209
|
+
const transformed = comments.map((comment) =>
|
|
210
|
+
transformComment(comment, { truncateBody: 300 }),
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
return formatToolResponse({ ...data, comments: transformed });
|
|
214
|
+
} catch (error) {
|
|
215
|
+
return formatToolError(error);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export const getTeamCommentsSchema = createSchemaWithTeamName({
|
|
220
|
+
page: z.number().optional().describe("Page number (starts from 1)"),
|
|
221
|
+
perPage: z.number().optional().describe("Number of items per page"),
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
export async function getTeamComments(
|
|
225
|
+
client: ReturnType<typeof createEsaClient>,
|
|
226
|
+
args: z.infer<typeof getTeamCommentsSchema>,
|
|
227
|
+
) {
|
|
228
|
+
try {
|
|
229
|
+
if (!args.teamName) {
|
|
230
|
+
throw new MissingTeamNameError();
|
|
231
|
+
}
|
|
232
|
+
const { data, error, response } = await client.GET(
|
|
233
|
+
"/v1/teams/{team_name}/comments",
|
|
234
|
+
{
|
|
235
|
+
params: {
|
|
236
|
+
path: { team_name: args.teamName },
|
|
237
|
+
query: {
|
|
238
|
+
page: args.page,
|
|
239
|
+
per_page: args.perPage,
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
if (error || !response.ok) {
|
|
246
|
+
return formatToolError(error || response.status);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const comments: components["schemas"]["Comment"][] = data.comments;
|
|
250
|
+
const transformed = comments.map((comment) =>
|
|
251
|
+
transformComment(comment, { truncateBody: 300 }),
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
return formatToolResponse({ ...data, comments: transformed });
|
|
255
|
+
} catch (error) {
|
|
256
|
+
return formatToolError(error);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { createEsaClient } from "../api_client/index.js";
|
|
3
|
+
import { getPost } from "./posts.js";
|
|
4
|
+
import { searchPosts, searchPostsSchema } from "./search.js";
|
|
5
|
+
|
|
6
|
+
// Documentation team and post constants
|
|
7
|
+
export const HELP_DOCS = {
|
|
8
|
+
TEAM: "docs",
|
|
9
|
+
SEARCH_OPTIONS_POST_ID: 104,
|
|
10
|
+
MARKDOWN_SYNTAX_POST_ID: 49,
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
// Schema for searchHelp - omit teamName, order, include, and sort from searchPostsSchema
|
|
14
|
+
export const searchHelpSchema = searchPostsSchema.omit({
|
|
15
|
+
teamName: true,
|
|
16
|
+
order: true,
|
|
17
|
+
include: true,
|
|
18
|
+
sort: true,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export async function getSearchOptionsHelp(
|
|
22
|
+
client: ReturnType<typeof createEsaClient>,
|
|
23
|
+
_args: Record<string, never>,
|
|
24
|
+
) {
|
|
25
|
+
return getPost(client, {
|
|
26
|
+
teamName: HELP_DOCS.TEAM,
|
|
27
|
+
postNumber: HELP_DOCS.SEARCH_OPTIONS_POST_ID,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function getMarkdownSyntaxHelp(
|
|
32
|
+
client: ReturnType<typeof createEsaClient>,
|
|
33
|
+
_args: Record<string, never>,
|
|
34
|
+
) {
|
|
35
|
+
return getPost(client, {
|
|
36
|
+
teamName: HELP_DOCS.TEAM,
|
|
37
|
+
postNumber: HELP_DOCS.MARKDOWN_SYNTAX_POST_ID,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function searchHelp(
|
|
42
|
+
client: ReturnType<typeof createEsaClient>,
|
|
43
|
+
args: z.infer<typeof searchHelpSchema>,
|
|
44
|
+
) {
|
|
45
|
+
return searchPosts(client, {
|
|
46
|
+
teamName: HELP_DOCS.TEAM,
|
|
47
|
+
sort: "best_match",
|
|
48
|
+
...args,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import { withContext } from "../api_client/with-context.js";
|
|
4
|
+
import type { MCPContext } from "../context/mcp-context.js";
|
|
5
|
+
import {
|
|
6
|
+
getCategories,
|
|
7
|
+
getCategoriesSchema,
|
|
8
|
+
getTopCategories,
|
|
9
|
+
getTopCategoriesSchema,
|
|
10
|
+
} from "./categories.js";
|
|
11
|
+
import {
|
|
12
|
+
createComment,
|
|
13
|
+
createCommentSchema,
|
|
14
|
+
deleteComment,
|
|
15
|
+
deleteCommentSchema,
|
|
16
|
+
getComment,
|
|
17
|
+
getCommentSchema,
|
|
18
|
+
getPostComments,
|
|
19
|
+
getPostCommentsSchema,
|
|
20
|
+
getTeamComments,
|
|
21
|
+
getTeamCommentsSchema,
|
|
22
|
+
updateComment,
|
|
23
|
+
updateCommentSchema,
|
|
24
|
+
} from "./comments.js";
|
|
25
|
+
import {
|
|
26
|
+
getMarkdownSyntaxHelp,
|
|
27
|
+
getSearchOptionsHelp,
|
|
28
|
+
searchHelp,
|
|
29
|
+
searchHelpSchema,
|
|
30
|
+
} from "./helps.js";
|
|
31
|
+
import {
|
|
32
|
+
archivePost,
|
|
33
|
+
archivePostSchema,
|
|
34
|
+
duplicatePost,
|
|
35
|
+
duplicatePostSchema,
|
|
36
|
+
shipPost,
|
|
37
|
+
shipPostSchema,
|
|
38
|
+
} from "./post-actions.js";
|
|
39
|
+
import {
|
|
40
|
+
createPost,
|
|
41
|
+
createPostSchema,
|
|
42
|
+
getPost,
|
|
43
|
+
getPostSchema,
|
|
44
|
+
updatePost,
|
|
45
|
+
updatePostSchema,
|
|
46
|
+
} from "./posts.js";
|
|
47
|
+
import { searchPosts, searchPostsSchema } from "./search.js";
|
|
48
|
+
import {
|
|
49
|
+
getTeamMembers,
|
|
50
|
+
getTeamMembersSchema,
|
|
51
|
+
getTeamStats,
|
|
52
|
+
getTeamStatsSchema,
|
|
53
|
+
getTeams,
|
|
54
|
+
getTeamsSchema,
|
|
55
|
+
getTeamTags,
|
|
56
|
+
getTeamTagsSchema,
|
|
57
|
+
} from "./teams.js";
|
|
58
|
+
|
|
59
|
+
export function setupTools(server: McpServer, context: MCPContext): void {
|
|
60
|
+
console.error("Setting up MCP tools...");
|
|
61
|
+
|
|
62
|
+
server.registerTool(
|
|
63
|
+
"esa_get_teams",
|
|
64
|
+
{
|
|
65
|
+
title: "Get user's accessible esa teams",
|
|
66
|
+
description: "Retrieves a list of esa teams that the user has access to.",
|
|
67
|
+
inputSchema: getTeamsSchema.shape,
|
|
68
|
+
},
|
|
69
|
+
async (params: z.infer<typeof getTeamsSchema>) =>
|
|
70
|
+
withContext(context, getTeams, params),
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
server.registerTool(
|
|
74
|
+
"esa_get_team_stats",
|
|
75
|
+
{
|
|
76
|
+
title: "Get team statistics",
|
|
77
|
+
description:
|
|
78
|
+
"Retrieves team statistics including member count, posts count (total/WIP/shipped), comments, stars, watches, and daily/weekly/monthly active users",
|
|
79
|
+
inputSchema: getTeamStatsSchema.shape,
|
|
80
|
+
},
|
|
81
|
+
async (params: z.infer<typeof getTeamStatsSchema>) =>
|
|
82
|
+
withContext(context, getTeamStats, params),
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
server.registerTool(
|
|
86
|
+
"esa_get_team_tags",
|
|
87
|
+
{
|
|
88
|
+
title: "Get team tags",
|
|
89
|
+
description:
|
|
90
|
+
"Retrieves all tags used in posts within a team, along with the count of posts for each tag",
|
|
91
|
+
inputSchema: getTeamTagsSchema.shape,
|
|
92
|
+
},
|
|
93
|
+
async (params: z.infer<typeof getTeamTagsSchema>) =>
|
|
94
|
+
withContext(context, getTeamTags, params),
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
server.registerTool(
|
|
98
|
+
"esa_get_team_members",
|
|
99
|
+
{
|
|
100
|
+
title: "Get team members",
|
|
101
|
+
description:
|
|
102
|
+
"Retrieves all members of a team with their roles and profile information",
|
|
103
|
+
inputSchema: getTeamMembersSchema.shape,
|
|
104
|
+
},
|
|
105
|
+
async (params: z.infer<typeof getTeamMembersSchema>) =>
|
|
106
|
+
withContext(context, getTeamMembers, params),
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
server.registerTool(
|
|
110
|
+
"esa_get_post",
|
|
111
|
+
{
|
|
112
|
+
title: "Get a specific esa post",
|
|
113
|
+
description:
|
|
114
|
+
"Retrieves a specific post from an esa team by post number, with optional comments included.",
|
|
115
|
+
inputSchema: getPostSchema.shape,
|
|
116
|
+
},
|
|
117
|
+
async (params: z.infer<typeof getPostSchema>) =>
|
|
118
|
+
withContext(context, getPost, params),
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
server.registerTool(
|
|
122
|
+
"esa_search_posts",
|
|
123
|
+
{
|
|
124
|
+
title: "Search Posts",
|
|
125
|
+
description: "Search for posts in esa.io",
|
|
126
|
+
inputSchema: searchPostsSchema.shape,
|
|
127
|
+
},
|
|
128
|
+
async (params: z.infer<typeof searchPostsSchema>) =>
|
|
129
|
+
withContext(context, searchPosts, params),
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
server.registerTool(
|
|
133
|
+
"esa_create_post",
|
|
134
|
+
{
|
|
135
|
+
title: "Create a new esa post",
|
|
136
|
+
description:
|
|
137
|
+
"Creates a new post in an esa team with optional tags, category, and WIP status.",
|
|
138
|
+
inputSchema: createPostSchema.shape,
|
|
139
|
+
},
|
|
140
|
+
async (params: z.infer<typeof createPostSchema>) =>
|
|
141
|
+
withContext(context, createPost, params),
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
server.registerTool(
|
|
145
|
+
"esa_update_post",
|
|
146
|
+
{
|
|
147
|
+
title: "Update an existing esa post",
|
|
148
|
+
description:
|
|
149
|
+
"Updates an existing post in an esa team by post number. You can update the title, content, tags, category, and WIP status. To ship a post (mark as complete), set wip to false - this is preferred over using esa_ship_post when updating other fields simultaneously.",
|
|
150
|
+
inputSchema: updatePostSchema.shape,
|
|
151
|
+
},
|
|
152
|
+
async (params: z.infer<typeof updatePostSchema>) =>
|
|
153
|
+
withContext(context, updatePost, params),
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
server.registerTool(
|
|
157
|
+
"esa_get_comment",
|
|
158
|
+
{
|
|
159
|
+
title: "Get a specific comment",
|
|
160
|
+
description:
|
|
161
|
+
"Retrieves a specific comment by comment ID, with optional stargazers included.",
|
|
162
|
+
inputSchema: getCommentSchema.shape,
|
|
163
|
+
},
|
|
164
|
+
async (params: z.infer<typeof getCommentSchema>) =>
|
|
165
|
+
withContext(context, getComment, params),
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
server.registerTool(
|
|
169
|
+
"esa_create_comment",
|
|
170
|
+
{
|
|
171
|
+
title: "Create a new comment on a post",
|
|
172
|
+
description: "Creates a new comment on an existing post in an esa team.",
|
|
173
|
+
inputSchema: createCommentSchema.shape,
|
|
174
|
+
},
|
|
175
|
+
async (params: z.infer<typeof createCommentSchema>) =>
|
|
176
|
+
withContext(context, createComment, params),
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
server.registerTool(
|
|
180
|
+
"esa_update_comment",
|
|
181
|
+
{
|
|
182
|
+
title: "Update an existing comment",
|
|
183
|
+
description: "Updates an existing comment in an esa team by comment ID.",
|
|
184
|
+
inputSchema: updateCommentSchema.shape,
|
|
185
|
+
},
|
|
186
|
+
async (params: z.infer<typeof updateCommentSchema>) =>
|
|
187
|
+
withContext(context, updateComment, params),
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
server.registerTool(
|
|
191
|
+
"esa_delete_comment",
|
|
192
|
+
{
|
|
193
|
+
title: "Delete a comment",
|
|
194
|
+
description: "Deletes a comment from an esa team by comment ID.",
|
|
195
|
+
inputSchema: deleteCommentSchema.shape,
|
|
196
|
+
},
|
|
197
|
+
async (params: z.infer<typeof deleteCommentSchema>) =>
|
|
198
|
+
withContext(context, deleteComment, params),
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
server.registerTool(
|
|
202
|
+
"esa_get_post_comments",
|
|
203
|
+
{
|
|
204
|
+
title: "Get comments for a specific post",
|
|
205
|
+
description:
|
|
206
|
+
"Retrieves a list of comments for a specific post with pagination support.",
|
|
207
|
+
inputSchema: getPostCommentsSchema.shape,
|
|
208
|
+
},
|
|
209
|
+
async (params: z.infer<typeof getPostCommentsSchema>) =>
|
|
210
|
+
withContext(context, getPostComments, params),
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
server.registerTool(
|
|
214
|
+
"esa_get_team_comments",
|
|
215
|
+
{
|
|
216
|
+
title: "Get team comments",
|
|
217
|
+
description:
|
|
218
|
+
"Retrieves a list of comments in a team with pagination support.",
|
|
219
|
+
inputSchema: getTeamCommentsSchema.shape,
|
|
220
|
+
},
|
|
221
|
+
async (params: z.infer<typeof getTeamCommentsSchema>) =>
|
|
222
|
+
withContext(context, getTeamComments, params),
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
server.registerTool(
|
|
226
|
+
"esa_get_categories",
|
|
227
|
+
{
|
|
228
|
+
title: "Get categories for a specific path",
|
|
229
|
+
description:
|
|
230
|
+
"Retrieves category information and subcategories for a specific category path, with optional posts and parent categories included",
|
|
231
|
+
inputSchema: getCategoriesSchema.shape,
|
|
232
|
+
},
|
|
233
|
+
async (params: z.infer<typeof getCategoriesSchema>) =>
|
|
234
|
+
withContext(context, getCategories, params),
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
server.registerTool(
|
|
238
|
+
"esa_get_top_categories",
|
|
239
|
+
{
|
|
240
|
+
title: "Get top-level categories",
|
|
241
|
+
description: "Retrieves all top-level categories for a team",
|
|
242
|
+
inputSchema: getTopCategoriesSchema.shape,
|
|
243
|
+
},
|
|
244
|
+
async (params: z.infer<typeof getTopCategoriesSchema>) =>
|
|
245
|
+
withContext(context, getTopCategories, params),
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
server.registerTool(
|
|
249
|
+
"esa_archive_post",
|
|
250
|
+
{
|
|
251
|
+
title: "Archive a post",
|
|
252
|
+
description:
|
|
253
|
+
"Archives a post by moving it to the Archived/ category. If the post is in 'dev/docs', it becomes 'Archived/dev/docs'. Posts without category go to 'Archived'.",
|
|
254
|
+
inputSchema: archivePostSchema.shape,
|
|
255
|
+
},
|
|
256
|
+
async (params: z.infer<typeof archivePostSchema>) =>
|
|
257
|
+
withContext(context, archivePost, params),
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
server.registerTool(
|
|
261
|
+
"esa_ship_post",
|
|
262
|
+
{
|
|
263
|
+
title: "Ship a post",
|
|
264
|
+
description:
|
|
265
|
+
"Ships a post by setting wip to false. This marks the post as complete and ready to be published. Use this only when you need to ship without making other changes - if you're also updating title, content, or other fields, use esa_update_post with wip: false instead.",
|
|
266
|
+
inputSchema: shipPostSchema.shape,
|
|
267
|
+
},
|
|
268
|
+
async (params: z.infer<typeof shipPostSchema>) =>
|
|
269
|
+
withContext(context, shipPost, params),
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
server.registerTool(
|
|
273
|
+
"esa_duplicate_post",
|
|
274
|
+
{
|
|
275
|
+
title: "Prepare a post for duplication",
|
|
276
|
+
description:
|
|
277
|
+
"Prepares a post for duplication by retrieving its name and body_md content. Returns the name and body_md that can be used with esa_create_post to create a duplicate of the original post.",
|
|
278
|
+
inputSchema: duplicatePostSchema.shape,
|
|
279
|
+
},
|
|
280
|
+
async (params: z.infer<typeof duplicatePostSchema>) =>
|
|
281
|
+
withContext(context, duplicatePost, params),
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
server.registerTool(
|
|
285
|
+
"esa_get_search_options_help",
|
|
286
|
+
{
|
|
287
|
+
title: "Get esa search options documentation",
|
|
288
|
+
description: `Get esa search syntax documentation when you need to construct complex
|
|
289
|
+
search queries. Use this BEFORE esa_search_posts if you're unsure how to
|
|
290
|
+
translate user's search requirements into proper esa query syntax (e.g., date
|
|
291
|
+
ranges, tag filters, category searches, advanced operators).`,
|
|
292
|
+
inputSchema: {},
|
|
293
|
+
},
|
|
294
|
+
async (params: Record<string, never>) =>
|
|
295
|
+
withContext(context, getSearchOptionsHelp, params),
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
server.registerTool(
|
|
299
|
+
"esa_get_markdown_syntax_help",
|
|
300
|
+
{
|
|
301
|
+
title: "Get esa Markdown syntax documentation",
|
|
302
|
+
description: `Get esa Markdown and formatting documentation when unsure about syntax.
|
|
303
|
+
Use this BEFORE using any tools with *_md parameters (like esa_create_post,
|
|
304
|
+
esa_update_post, esa_create_comment, esa_update_comment) if you need
|
|
305
|
+
clarification on Markdown syntax, esa-specific extensions, or formatting options.`,
|
|
306
|
+
inputSchema: {},
|
|
307
|
+
},
|
|
308
|
+
async (params: Record<string, never>) =>
|
|
309
|
+
withContext(context, getMarkdownSyntaxHelp, params),
|
|
310
|
+
);
|
|
311
|
+
|
|
312
|
+
server.registerTool(
|
|
313
|
+
"esa_search_help",
|
|
314
|
+
{
|
|
315
|
+
title: "Search esa documentation and help",
|
|
316
|
+
description: `Search esa documentation for features, terminology, and specifications.
|
|
317
|
+
Use this when users mention esa-specific terms, ask about esa functionality,
|
|
318
|
+
or request help with esa workflows that you're not familiar with.`,
|
|
319
|
+
inputSchema: searchHelpSchema.shape,
|
|
320
|
+
},
|
|
321
|
+
async (params: z.infer<typeof searchHelpSchema>) =>
|
|
322
|
+
withContext(context, searchHelp, params),
|
|
323
|
+
);
|
|
324
|
+
}
|