MCPcopy Index your code
hub / github.com/anomalyco/opencode / toModelOutput

Function toModelOutput

packages/core/src/tool/skill.ts:35–52  ·  view source on GitHub ↗
(skill: SkillV2.Info, files: ReadonlyArray<string>)

Source from the content-addressed store, hash-verified

33].join("\n")
34
35export const toModelOutput = (skill: SkillV2.Info, files: ReadonlyArray<string>) => {
36 const directory = path.dirname(skill.location)
37 return [
38 `<skill_content name="${skill.name}">`,
39 `# Skill: ${skill.name}`,
40 "",
41 skill.content.trim(),
42 "",
43 `Base directory for this skill: ${directory}`,
44 "Relative paths in this skill (e.g., scripts/, reference/) are relative to this base directory.",
45 "Note: file list is sampled.",
46 "",
47 "<skill_files>",
48 ...files.map((file) => `<file>${file}</file>`),
49 "</skill_files>",
50 "</skill_content>",
51 ].join("\n")
52}
53
54const unableToLoad = (name: string, error?: unknown) =>
55 new ToolFailure({ message: `Unable to load skill ${name}`, error })

Callers 1

skill.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected