🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
import {
GetModelV1Query,
GetModelV1Response,
} from "@/src/features/public-api/types/models";
import { getModelForApi } from "@/src/features/models/server/publicApiModelService";
import { defineTool } from "../../../core/define-tool";
import { buildModelUrl } from "@langfuse/shared/src/server";
import { runMcpTool } from "../../../core/run-mcp-tool";
export const [getModelTool, handleGetModel] = defineTool({
name: "getModel",
description: "Get a model definition by ID from the current project scope.",
action: "models:read",
baseSchema: GetModelV1Query,
inputSchema: GetModelV1Query,
handler: async (input, context) =>
runMcpTool({
spanName: "mcp.models.get",
context,
attributes: { "mcp.model_id": input.modelId },
fn: async () => {
const result = await getModelForApi({
projectId: context.projectId,
modelId: input.modelId,
});
const model = GetModelV1Response.parse(result);
return {
...model,
url: buildModelUrl({
projectId: context.projectId,
modelId: model.id,
}),
};
},
}),
readOnlyHint: true,
});