@@ -17,6 +17,7 @@ import (
1717 "github.com/charmbracelet/crush/internal/filetracker"
1818 "github.com/charmbracelet/crush/internal/lsp"
1919 "github.com/charmbracelet/crush/internal/permission"
20+ "github.com/charmbracelet/crush/internal/skills"
2021)
2122
2223//go:embed view.md
@@ -34,9 +35,19 @@ type ViewPermissionsParams struct {
3435 Limit int `json:"limit"`
3536}
3637
38+type ViewResourceType string
39+
40+const (
41+ ViewResourceUnset ViewResourceType = ""
42+ ViewResourceSkill ViewResourceType = "skill"
43+)
44+
3745type ViewResponseMetadata struct {
38− FilePath string `json:"file_path"`
39− Content string `json:"content"`
46+ FilePath string `json:"file_path"`
47+ Content string `json:"content"`
48+ ResourceType ViewResourceType `json:"resource_type,omitempty"`
49+ ResourceName string `json:"resource_name,omitempty"`
50+ ResourceDescription string `json:"resource_description,omitempty"`
4051}
4152
4253const (
@@ -196,12 +207,22 @@ func NewViewTool(
196207 output += "\n</file>\n"
197208 output += getDiagnostics(filePath, lspManager)
198209 filetracker.RecordRead(ctx, sessionID, filePath)
210+
211+ meta := ViewResponseMetadata{
212+ FilePath: filePath,
213+ Content: content,
214+ }
215+ if isSkillFile {
216+ if skill, err := skills.Parse(filePath); err == nil {
217+ meta.ResourceType = ViewResourceSkill
218+ meta.ResourceName = skill.Name
219+ meta.ResourceDescription = skill.Description
220+ }
221+ }
222+
199223 return fantasy.WithResponseMetadata(
200224 fantasy.NewTextResponse(output),
201− ViewResponseMetadata{
202− FilePath: filePath,
203− Content: content,
204− },
225+ meta,
205226 ), nil
206227 })
207228}