Skip to content

Commit 431e2e0

Browse files
fix MCP api client
1 parent c5fb877 commit 431e2e0

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

packages/mcp/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ server.tool(
161161
};
162162
}
163163

164-
const content: TextContent[] = response.repos.map(repo => {
164+
const content: TextContent[] = response.map(repo => {
165165
return {
166166
type: "text",
167-
text: `id: ${repo.name}\nurl: ${repo.webUrl}`,
167+
text: `id: ${repo.repoName}\nurl: ${repo.webUrl}`,
168168
}
169169
});
170170

packages/mcp/src/schemas.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,34 @@ export const searchResponseSchema = z.object({
9292
isBranchFilteringEnabled: z.boolean(),
9393
});
9494

95-
export const repositorySchema = z.object({
96-
name: z.string(),
97-
branches: z.array(z.string()),
95+
enum RepoIndexingStatus {
96+
NEW = 'NEW',
97+
IN_INDEX_QUEUE = 'IN_INDEX_QUEUE',
98+
INDEXING = 'INDEXING',
99+
INDEXED = 'INDEXED',
100+
FAILED = 'FAILED',
101+
IN_GC_QUEUE = 'IN_GC_QUEUE',
102+
GARBAGE_COLLECTING = 'GARBAGE_COLLECTING',
103+
GARBAGE_COLLECTION_FAILED = 'GARBAGE_COLLECTION_FAILED'
104+
}
105+
106+
export const repositoryQuerySchema = z.object({
107+
codeHostType: z.string(),
108+
repoId: z.number(),
109+
repoName: z.string(),
110+
repoDisplayName: z.string().optional(),
111+
repoCloneUrl: z.string(),
98112
webUrl: z.string().optional(),
99-
rawConfig: z.record(z.string(), z.string()).optional(),
113+
linkedConnections: z.array(z.object({
114+
id: z.number(),
115+
name: z.string(),
116+
})),
117+
imageUrl: z.string().optional(),
118+
indexedAt: z.coerce.date().optional(),
119+
repoIndexingStatus: z.nativeEnum(RepoIndexingStatus),
100120
});
101121

102-
export const listRepositoriesResponseSchema = z.object({
103-
repos: z.array(repositorySchema),
104-
});
122+
export const listRepositoriesResponseSchema = repositoryQuerySchema.array();
105123

106124
export const fileSourceRequestSchema = z.object({
107125
fileName: z.string(),

packages/mcp/src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export type SearchResultChunk = SearchResultFile["chunks"][number];
2222
export type SearchSymbol = z.infer<typeof symbolSchema>;
2323

2424
export type ListRepositoriesResponse = z.infer<typeof listRepositoriesResponseSchema>;
25-
export type Repository = ListRepositoriesResponse["repos"][number];
2625

2726
export type FileSourceRequest = z.infer<typeof fileSourceRequestSchema>;
2827
export type FileSourceResponse = z.infer<typeof fileSourceResponseSchema>;

0 commit comments

Comments
 (0)