Skip to content

Commit 2fb3c99

Browse files
Add example usage to ToolOverrides documentation
1 parent fe5b222 commit 2fb3c99

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

pkg/inventory/tool_variants.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ import "context"
55
// ToolOverride allows replacing a tool's definition based on runtime conditions.
66
// Use this for the small number of tools that have different schemas/handlers
77
// depending on features, capabilities, or environment.
8+
//
9+
// Example usage:
10+
//
11+
// // Define overrides for tools that have enterprise-specific variants
12+
// overrides := ToolOverrides{
13+
// "create_issue": {
14+
// ToolName: "create_issue",
15+
// Condition: func(ctx context.Context) (bool, error) {
16+
// // Check if enterprise features are enabled for this request
17+
// return isEnterpriseEnabled(ctx), nil
18+
// },
19+
// Override: ServerTool{
20+
// Tool: mcp.Tool{
21+
// Name: "create_issue",
22+
// Description: "Create an issue (Enterprise)",
23+
// InputSchema: enterpriseCreateIssueSchema, // has extra fields
24+
// },
25+
// Handler: enterpriseCreateIssueHandler, // different handler
26+
// },
27+
// },
28+
// }
29+
//
30+
// // Apply overrides after building the base tool list
31+
// tools := index.Materialize(ctx, queryResult)
32+
// tools = overrides.ApplyToTools(ctx, tools)
833
type ToolOverride struct {
934
// ToolName is the canonical tool name to override
1035
ToolName string

0 commit comments

Comments
 (0)