Skip to content

Commit 8a16ffe

Browse files
committed
Basic Syntax Fixing
1 parent e5227f2 commit 8a16ffe

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

tools/Mcp/src/services/toolsService.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ import path from 'path';
55
import { get, RequestOptions } from 'http';
66
import { toolParameterSchema } from '../types.js';
77
import { CodegenServer } from '../CodegenServer.js';
8-
import {
9-
listSpecModules,
10-
listProvidersForService,
11-
listApiVersions,
12-
resolveAutorestInputs
13-
} from './utils.js';
148

159
export class ToolsService {
1610
private static _instance: ToolsService;
@@ -180,7 +174,7 @@ export class ToolsService {
180174
setupModuleStructure = async <Args extends ZodRawShape>(args: Args): Promise<string[]> => {
181175
try {
182176
// List available services with dropdown
183-
const modules = await listSpecModules();
177+
const modules = await utils.listSpecModules();
184178
const serviceResponse = await this._server!.elicitInput({
185179
message: `Select an Azure service from the dropdown below:`,
186180
requestedSchema: {
@@ -202,7 +196,7 @@ export class ToolsService {
202196
}
203197

204198
// List providers for the selected service with dropdown
205-
const providers = await listProvidersForService(selectedService);
199+
const providers = await utils.listProvidersForService(selectedService);
206200
if (providers.length === 0) {
207201
throw new Error(`No providers found for service '${selectedService}'`);
208202
}
@@ -228,7 +222,7 @@ export class ToolsService {
228222
}
229223

230224
// List API versions with dropdown combining version and stability
231-
const apiVersions = await listApiVersions(selectedService, selectedProvider);
225+
const apiVersions = await utils.listApiVersions(selectedService, selectedProvider);
232226
const allVersions = [
233227
...apiVersions.stable.map(v => ({ version: v, stability: 'stable' as const })),
234228
...apiVersions.preview.map(v => ({ version: v, stability: 'preview' as const }))
@@ -269,7 +263,7 @@ export class ToolsService {
269263
const selectedStability = versionMatch[2] as 'stable' | 'preview';
270264

271265
// Resolve Readme placeholder values based on Responses
272-
const resolved = await resolveAutorestInputs({
266+
const resolved = await utils.resolveAutorestInputs({
273267
service: selectedService,
274268
provider: selectedProvider,
275269
stability: selectedStability,

tools/Mcp/src/services/utils.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ export async function getSwaggerContentFromUrl(swaggerUrl: string): Promise<any>
8282
}
8383
}
8484

85-
/**
86-
* GitHub helper: get latest commit SHA for azure-rest-api-specs main branch
87-
*/
8885
export async function getSpecsHeadCommitSha(branch: string = 'main'): Promise<string> {
8986
const url = `${GITHUB_API_BASE}/repos/${REST_API_SPECS_OWNER}/${REST_API_SPECS_REPO}/branches/${branch}`;
9087
const res = await fetch(url);
@@ -95,9 +92,6 @@ export async function getSpecsHeadCommitSha(branch: string = 'main'): Promise<st
9592
return data?.commit?.sha as string;
9693
}
9794

98-
/**
99-
* List top-level service directories under specification/
100-
*/
10195
export async function listSpecModules(): Promise<string[]> {
10296
const url = `${GITHUB_API_BASE}/repos/${REST_API_SPECS_OWNER}/${REST_API_SPECS_REPO}/contents/specification`;
10397
const res = await fetch(url);
@@ -111,9 +105,6 @@ export async function listSpecModules(): Promise<string[]> {
111105
.sort((a: string, b: string) => a.localeCompare(b));
112106
}
113107

114-
/**
115-
* Given a service (spec folder), list provider namespaces under resource-manager.
116-
*/
117108
export async function listProvidersForService(service: string): Promise<string[]> {
118109
const url = `${GITHUB_API_BASE}/repos/${REST_API_SPECS_OWNER}/${REST_API_SPECS_REPO}/contents/specification/${service}/resource-manager`;
119110
const res = await fetch(url);
@@ -128,10 +119,6 @@ export async function listProvidersForService(service: string): Promise<string[]
128119
.sort((a: string, b: string) => a.localeCompare(b));
129120
}
130121

131-
/**
132-
* For service + provider, list API version directories under stable/ and preview/.
133-
* Returns map: { stable: string[], preview: string[] }
134-
*/
135122
export async function listApiVersions(service: string, provider: string): Promise<{ stable: string[]; preview: string[] }> {
136123
const base = `specification/${service}/resource-manager/${provider}`;
137124
const folders = ['stable', 'preview'] as const;
@@ -153,10 +140,6 @@ export async function listApiVersions(service: string, provider: string): Promis
153140
return result;
154141
}
155142

156-
/**
157-
* For a given service/provider/version, find likely swagger files (.json) under that version path.
158-
* Returns array of repo-relative file paths (starting with specification/...).
159-
*/
160143
export async function listSwaggerFiles(service: string, provider: string, stability: 'stable'|'preview', version: string): Promise<string[]> {
161144
const dir = `specification/${service}/resource-manager/${provider}/${stability}/${version}`;
162145
const url = `${GITHUB_API_BASE}/repos/${REST_API_SPECS_OWNER}/${REST_API_SPECS_REPO}/contents/${dir}`;
@@ -173,9 +156,6 @@ export async function listSwaggerFiles(service: string, provider: string, stabil
173156
return ordered;
174157
}
175158

176-
/**
177-
* Resolve the four Autorest inputs given service, provider, and version path.
178-
*/
179159
export async function resolveAutorestInputs(params: {
180160
service: string;
181161
provider: string;

0 commit comments

Comments
 (0)