Skip to main content
Glama

@arizeai/phoenix-mcp

Official
by Arize-ai
fetchPlaygroundPrompt.test.ts2.98 kB
import { invocationParametersToObject, objectToInvocationParameters, } from "../fetchPlaygroundPrompt"; type InvocationParameterInput = Parameters< typeof invocationParametersToObject >[0]; type SupportedParamsType = Parameters<typeof objectToInvocationParameters>[1]; describe("objectToInvocationParameters", () => { it("should convert simple parameters with matching definitions", () => { const params = { temperature: 0.7, max_tokens: 100, }; const supportedParams = [ { __typename: "FloatInvocationParameter", invocationName: "temperature", canonicalName: "TEMPERATURE", invocationInputField: "value_float", }, { __typename: "IntInvocationParameter", invocationName: "max_tokens", canonicalName: "MAX_COMPLETION_TOKENS", invocationInputField: "value_int", }, ] satisfies SupportedParamsType; const result = objectToInvocationParameters(params, supportedParams); expect(result).toEqual([ { invocationName: "temperature", canonicalName: "TEMPERATURE", valueFloat: 0.7, }, { invocationName: "max_tokens", canonicalName: "MAX_COMPLETION_TOKENS", valueInt: 100, }, ]); }); it("should handle parameters without matching definitions", () => { const params = { unknownParam: "test", maxTokens: 100, }; const supportedParams = [] satisfies SupportedParamsType; const result = objectToInvocationParameters(params, supportedParams); expect(result).toEqual([ { invocationName: "unknownParam", valueJson: "test", }, { invocationName: "maxTokens", valueJson: 100, }, ]); }); }); describe("invocationParametersToObject", () => { it("should convert invocation parameters back to object format", () => { const params = [ { invocationName: "temperature", canonicalName: "TEMPERATURE", valueFloat: 0.7, }, { invocationName: "max_tokens", canonicalName: "MAX_COMPLETION_TOKENS", valueInt: 100, }, ] satisfies InvocationParameterInput; const supportedParams = [ { __typename: "FloatInvocationParameter", invocationName: "temperature", canonicalName: "TEMPERATURE", invocationInputField: "value_float", }, { __typename: "IntInvocationParameter", invocationName: "max_tokens", canonicalName: "MAX_COMPLETION_TOKENS", invocationInputField: "value_int", }, ] satisfies SupportedParamsType; const result = invocationParametersToObject(params, supportedParams); expect(result).toEqual({ temperature: 0.7, max_tokens: 100, }); }); it("should handle empty parameters", () => { const result = invocationParametersToObject([], []); expect(result).toEqual({}); }); });

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/Arize-ai/phoenix'

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