-
Notifications
You must be signed in to change notification settings - Fork 4k
Expand file tree
/
Copy pathprompts.go
More file actions
42 lines (38 loc) · 1.56 KB
/
prompts.go
File metadata and controls
42 lines (38 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package inventory
import "github.com/modelcontextprotocol/go-sdk/mcp"
// ServerPrompt pairs a prompt with its toolset metadata.
type ServerPrompt struct {
Prompt mcp.Prompt
Handler mcp.PromptHandler
// Toolset identifies which toolset this prompt belongs to
Toolset ToolsetMetadata
// FeatureFlagEnable specifies a feature flag that must be enabled for this prompt
// to be available. If set and the flag is not enabled, the prompt is omitted.
FeatureFlagEnable string
// FeatureFlagDisable specifies a feature flag that, when enabled, causes this prompt
// to be omitted. Used to disable prompts when a feature flag is on.
FeatureFlagDisable string
// RequiredTools lists tools that must remain available after filtering for this prompt
// to be exposed. This keeps prompts from advertising capabilities that policy has hidden.
RequiredTools []string
}
// NewServerPrompt creates a new ServerPrompt with toolset metadata.
func NewServerPrompt(toolset ToolsetMetadata, prompt mcp.Prompt, handler mcp.PromptHandler) ServerPrompt {
return ServerPrompt{
Prompt: prompt,
Handler: handler,
Toolset: toolset,
}
}
// NewServerPromptWithRequiredTools creates a new ServerPrompt that is only exposed
// when the given tools remain available after filtering.
func NewServerPromptWithRequiredTools(
toolset ToolsetMetadata,
prompt mcp.Prompt,
handler mcp.PromptHandler,
requiredTools ...string,
) ServerPrompt {
serverPrompt := NewServerPrompt(toolset, prompt, handler)
serverPrompt.RequiredTools = append(serverPrompt.RequiredTools, requiredTools...)
return serverPrompt
}