Skip to main content
Glama
provider-config-manager.ts1.51 kB
import { z } from 'zod'; import { logger } from '../config/logging.js'; import { getStoredProviderConfig, updateStoredProviderConfig, } from '../storage/provider-config.js'; /** * Schema for getting all provider configurations (no inputs) */ export const getProviderConfigSchema = z.object({}); export async function getProviderConfig() { try { const configs = await getStoredProviderConfig(); return configs; } catch (error) { logger.error(`Error retrieving provider configurations: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`Failed to retrieve provider configurations: ${error instanceof Error ? error.message : 'Unknown error'}`); } } /** * Schema for updating provider configuration */ export const updateProviderConfigSchema = z.object({ providerId: z.string().min(1, 'Provider ID is required'), apiKey: z.string().optional(), baseUrl: z.string().optional(), model: z.string().optional(), }); export async function updateProviderConfig( providerId: string, apiKey?: string, baseUrl?: string, model?: string ) { try { const partial = { apiKey, baseUrl, model }; await updateStoredProviderConfig(providerId, partial); return { success: true }; } catch (error) { logger.error(`Error updating provider configuration: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`Failed to update provider configuration: ${error instanceof Error ? error.message : 'Unknown error'}`); } }

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/Saml1211/PRD-MCP-Server'

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