MCPcopy Index your code
hub / github.com/simstudioai/sim / resolveSkillMetadata

Function resolveSkillMetadata

apps/sim/executor/handlers/agent/skills-resolver.ts:27–57  ·  view source on GitHub ↗
(
  skillInputs: SkillInput[],
  workspaceId: string
)

Source from the content-addressed store, hash-verified

25 * Only returns lightweight data so the LLM knows what skills are available.
26 */
27export async function resolveSkillMetadata(
28 skillInputs: SkillInput[],
29 workspaceId: string
30): Promise<SkillMetadata[]> {
31 if (!skillInputs.length || !workspaceId) return []
32
33 const metadata: SkillMetadata[] = []
34 const dbSkillIds: string[] = []
35 for (const input of skillInputs) {
36 const builtin = getBuiltinSkillById(input.skillId)
37 if (builtin) {
38 metadata.push({ name: builtin.name, description: builtin.description })
39 } else {
40 dbSkillIds.push(input.skillId)
41 }
42 }
43
44 if (dbSkillIds.length === 0) return metadata
45
46 try {
47 const rows = await db
48 .select({ name: skill.name, description: skill.description })
49 .from(skill)
50 .where(and(eq(skill.workspaceId, workspaceId), inArray(skill.id, dbSkillIds)))
51
52 return [...metadata, ...rows]
53 } catch (error) {
54 logger.error('Failed to resolve skill metadata', { error, dbSkillIds, workspaceId })
55 return metadata
56 }
57}
58
59/**
60 * Fetch full skill content for a load_skill tool response.

Callers 1

executeMethod · 0.90

Calls 4

getBuiltinSkillByIdFunction · 0.90
errorMethod · 0.80
eqFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected