@feedmob/github-issues 0.0.3 → 0.0.4

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.
@@ -1,3 +1,3 @@
1
1
  // If the format of this file changes, so it doesn't simply export a VERSION constant,
2
2
  // this will break .github/workflows/version-check.yml.
3
- export const VERSION = "0.0.3";
3
+ export const VERSION = "0.0.4";
package/dist/index.js CHANGED
@@ -66,7 +66,7 @@ server.addTool({
66
66
  let params = new URLSearchParams();
67
67
  params.set('start_date', args.start_date);
68
68
  params.set('end_date', args.end_date);
69
- // 添加可选参数
69
+ args.fields.forEach(field => params.append('fields[]', field));
70
70
  if (args.status !== undefined) {
71
71
  params.set('status', args.status);
72
72
  }
@@ -79,14 +79,32 @@ server.addTool({
79
79
  if (args.team !== undefined) {
80
80
  params.set('team', args.team);
81
81
  }
82
+ if (args.title !== undefined) {
83
+ params.set('title', args.title);
84
+ }
85
+ if (args.labels !== undefined) {
86
+ args.labels.forEach(label => params.append('labels[]', label));
87
+ }
82
88
  const response = await fetch(`${AI_API_URL}/issues?${params}`, {
83
89
  method: 'GET',
84
90
  headers: {
85
91
  'Authorization': "Bearer " + AI_API_TOKEN
86
92
  }
87
93
  });
94
+ const data = await response.text();
88
95
  return {
89
- content: [{ type: "text", text: await response.text() }],
96
+ content: [
97
+ {
98
+ type: "text",
99
+ text: `# Github Issue Query Result
100
+ **Raw JSON Data:**
101
+ \`\`\`json
102
+ ${JSON.stringify(data, null, 2)}
103
+ \`\`\`
104
+ **Please further analyze and find the data required by the user based on the prompt, and return the data in a human-readable, formatted, and aesthetically pleasing manner.**
105
+ `,
106
+ },
107
+ ],
90
108
  };
91
109
  }
92
110
  catch (error) {
@@ -149,20 +167,52 @@ server.addTool({
149
167
  },
150
168
  });
151
169
  server.addTool({
152
- name: "get_issue",
153
- description: "Get details of a specific issue in a GitHub repository.",
170
+ name: "get_issues",
171
+ description: "Get comments for multiple issues in bulk",
154
172
  parameters: issues.GetIssueSchema,
155
173
  execute: async (args) => {
156
- const owner = args.owner || DEFAULT_OWNER;
157
- const repo = args.repo;
158
- const { issue_number } = args;
159
- if (!owner || !repo) {
160
- throw new Error("Repository owner and name are required. Either provide them directly or set GITHUB_DEFAULT_OWNER environment variables.");
174
+ try {
175
+ const response = await fetch(`${AI_API_URL}/issues/get_comments`, {
176
+ method: 'POST',
177
+ headers: {
178
+ 'Authorization': "Bearer " + AI_API_TOKEN,
179
+ 'Content-Type': 'application/json'
180
+ },
181
+ body: JSON.stringify({
182
+ repo_issues: args.repo_issues,
183
+ comment_count: args.comment_count
184
+ })
185
+ });
186
+ if (!response.ok) {
187
+ throw new Error(`HTTP error! status: ${response.status}`);
188
+ }
189
+ const data = await response.text();
190
+ return {
191
+ content: [
192
+ {
193
+ type: "text",
194
+ text: `# Github Issue Comments
195
+ **Raw JSON Data:**
196
+ \`\`\`json
197
+ ${JSON.stringify(data, null, 2)}
198
+ \`\`\`
199
+ **Please format the above data beautifully, refer to the following markdown example for the converted format and return the corresponding data.**
200
+ ### title
201
+ repo: repo
202
+ issue_number: issue_number
203
+ ------- Comment 1: user create_at -------
204
+ comment body(Original text, no need to convert to md)
205
+ `,
206
+ },
207
+ ],
208
+ };
209
+ }
210
+ catch (error) {
211
+ console.error(`[ERROR] Failed to get issue comments:`, error);
212
+ return {
213
+ content: [{ type: "text", text: `Failed to get issue comments: ${error instanceof Error ? error.message : String(error)}` }],
214
+ };
161
215
  }
162
- const issue = await issues.getIssue(owner, repo, issue_number);
163
- return {
164
- content: [{ type: "text", text: JSON.stringify(issue, null, 2) }],
165
- };
166
216
  },
167
217
  });
168
218
  server.addTool({
@@ -3,17 +3,22 @@ import { githubRequest, buildUrl } from "../common/utils.js";
3
3
  import { subDays, format } from 'date-fns';
4
4
  export const FeedmobSearchOptions = z.object({
5
5
  scheam: z.string().describe("get from system resources issues/search_schema"),
6
- start_date: z.string().default(format(subDays(new Date(), 6), 'yyyy-MM-dd')).describe("The creation start date of the issue"),
6
+ start_date: z.string().default(format(subDays(new Date(), 30), 'yyyy-MM-dd')).describe("The creation start date of the issue"),
7
7
  end_date: z.string().default(format(new Date(), 'yyyy-MM-dd')).describe("The creation end date of the issue"),
8
8
  status: z.string().optional().describe("The status of the issue, e.g., 'open', 'closed'"),
9
9
  repo: z.string().optional().describe("The repository name, e.g., 'feedmob', 'tracking_admin', If the user does not specify otherwise, this parameter can be omitted and all repos will be searched by default."),
10
- users: z.array(z.string()).optional().optional(),
10
+ users: z.array(z.string()).optional().describe("The users to filter issues by, can be assign_users, developers, code_reviewers, publishers, create_user, pm_qa_user"),
11
11
  team: z.string().optional().describe("The team name, e.g., 'Star', 'Mighty'"),
12
+ title: z.string().optional().describe("The title of the issue, supports fuzzy matching"),
13
+ labels: z.array(z.string()).optional().describe("Labels to filter issues by"),
14
+ fields: z.array(z.string()).describe("Fields to return for each issue, available fields: 'issue_id', 'repo', 'title', 'created_at', 'closed_at', 'hubspot_ticket_link', 'create_user', 'assign_users', 'status', 'current_labels', 'process_time_seconds', 'developers', 'code_reviewers', 'publishers', 'qa_members', 'pm_qa_user', 'team'"),
12
15
  });
13
16
  export const GetIssueSchema = z.object({
14
- owner: z.string(),
15
- repo: z.string().describe("The repository name, e.g., 'feedmob', 'tracking_admin'"),
16
- issue_number: z.number(),
17
+ comment_count: z.string().default('all').describe("Get all comments, or a specified number of comments, by default starting from the latest submission."),
18
+ repo_issues: z.array(z.object({
19
+ repo: z.string(),
20
+ issue_number: z.number()
21
+ }))
17
22
  });
18
23
  export const IssueCommentSchema = z.object({
19
24
  owner: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmob/github-issues",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "MCP server for using the GitHub API",
5
5
  "license": "MIT",
6
6
  "author": "FeedMob",