🪢 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 { z } from "zod";
import {
SkillFilePathSchema,
SkillNameSchema,
SkillSelectorSchema,
} from "@langfuse/shared";
import { prisma } from "@langfuse/shared/src/db";
import { SkillService } from "@/src/features/skills/server/skill-service";
import { defineTool } from "../../../core/define-tool";
import { runMcpTool } from "../../../core/run-mcp-tool";
const LoadSkillResourceBaseSchema = z.object({
name: SkillNameSchema,
path: SkillFilePathSchema,
...SkillSelectorSchema.shape,
});
const LoadSkillResourceInputSchema = z
.object({ name: SkillNameSchema, path: SkillFilePathSchema })
.and(SkillSelectorSchema);
export const [loadSkillResourceTool, handleLoadSkillResource] = defineTool({
name: "loadSkillResource",
description:
"Read a skill file as text by path (see getSkill). Version and label are optional; defaults to production, or latest if no production label is set. Reuse the version returned by getSkill when loading multiple files.",
action: "skills:read",
baseSchema: LoadSkillResourceBaseSchema,
inputSchema: LoadSkillResourceInputSchema,
handler: async ({ name, path, ...selector }, context) =>
runMcpTool({
spanName: "mcp.skills.loadResource",
context,
fn: async () =>
new SkillService(prisma).loadResource({
projectId: context.projectId,
name,
selector,
fallbackToLatest: true,
path,
}),
}),
readOnlyHint: true,
});