@@ -91,6 +91,17 @@ func NewServer() *MCPServer {
91
91
handleBuildTool ,
92
92
)
93
93
94
+ mcpServer .AddResource (mcp .NewResource (
95
+ "func://docs" ,
96
+ "Root Help Command" ,
97
+ mcp .WithResourceDescription ("--help output of the func command" ),
98
+ mcp .WithMIMEType ("text/plain" ),
99
+ ), handleRootHelpResource )
100
+
101
+ mcpServer .AddPrompt (mcp .NewPrompt ("help" ,
102
+ mcp .WithPromptDescription ("help prompt for the root command" ),
103
+ ), handleHelpPrompt )
104
+
94
105
return & MCPServer {
95
106
server : mcpServer ,
96
107
}
@@ -100,6 +111,40 @@ func (s *MCPServer) Start() error {
100
111
return server .ServeStdio (s .server )
101
112
}
102
113
114
+ func handleRootHelpResource (ctx context.Context , request mcp.ReadResourceRequest ) ([]mcp.ResourceContents , error ) {
115
+ content , err := exec .Command ("func" , "--help" ).Output ()
116
+ if err != nil {
117
+ return nil , err
118
+ }
119
+
120
+ return []mcp.ResourceContents {
121
+ mcp.TextResourceContents {
122
+ URI : "func://docs" ,
123
+ MIMEType : "text/plain" ,
124
+ Text : string (content ),
125
+ },
126
+ }, nil
127
+ }
128
+
129
+ func handleHelpPrompt (ctx context.Context , request mcp.GetPromptRequest ) (* mcp.GetPromptResult , error ) {
130
+ return mcp .NewGetPromptResult (
131
+ "Help Prompt" ,
132
+ []mcp.PromptMessage {
133
+ mcp .NewPromptMessage (
134
+ mcp .RoleUser ,
135
+ mcp .NewTextContent ("What can I do with the func command?" ),
136
+ ),
137
+ mcp .NewPromptMessage (
138
+ mcp .RoleAssistant ,
139
+ mcp .NewEmbeddedResource (mcp.TextResourceContents {
140
+ URI : "func://docs" ,
141
+ MIMEType : "text/plain" ,
142
+ }),
143
+ ),
144
+ },
145
+ ), nil
146
+ }
147
+
103
148
func handleHealthCheckTool (
104
149
ctx context.Context ,
105
150
request mcp.CallToolRequest ,
0 commit comments