Skip to main content
Glama
search.ts2.66 kB
import { AzureService, ServiceResult } from './base-service.js'; import { CacheKeys } from '../lib/cache.js'; interface SearchServiceInfo { name: string; resourceGroup: string; location: string; sku: { name: string }; status: string; } interface SearchIndex { name: string; fields: Array<{ name: string; type: string }>; } export class SearchService extends AzureService { readonly serviceName = 'AI Search'; readonly cliPrefix = 'search'; async list(resourceGroup?: string): Promise<ServiceResult<SearchServiceInfo[]>> { const cacheKey = CacheKeys.service('search', 'services', resourceGroup ?? ''); return this.cachedExecute(cacheKey, async () => { const opts: Record<string, string> = {}; if (resourceGroup) opts['resource-group'] = resourceGroup; const result = await this.execute('service list', opts); return this.toResult<SearchServiceInfo[]>(result); }); } async listIndexes(serviceName: string, resourceGroup: string): Promise<ServiceResult<SearchIndex[]>> { const cacheKey = CacheKeys.service('search', 'indexes', serviceName); return this.cachedExecute(cacheKey, async () => { const result = await this.execute('index list', { 'service-name': serviceName, 'resource-group': resourceGroup }); return this.toResult<SearchIndex[]>(result); }); } async getIndex(serviceName: string, resourceGroup: string, indexName: string): Promise<ServiceResult> { const result = await this.execute('index show', { 'service-name': serviceName, 'resource-group': resourceGroup, 'name': indexName }); return this.toResult(result); } async queryIndex( serviceName: string, resourceGroup: string, indexName: string, searchText: string, top?: number ): Promise<ServiceResult> { const opts: Record<string, string> = { 'service-name': serviceName, 'resource-group': resourceGroup, 'index-name': indexName, 'search': searchText }; if (top) opts['top'] = String(top); const result = await this.execute('query', opts); return this.toResult(result); } async getServiceDetails(serviceName: string, resourceGroup: string): Promise<ServiceResult> { const result = await this.execute('service show', { 'name': serviceName, 'resource-group': resourceGroup }); return this.toResult(result); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vedantparmar12/Azure-_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server