Skip to content

Commit adc1053

Browse files
committed
remove show_ui param for now
1 parent 072f5c4 commit adc1053

File tree

8 files changed

+11
-180
lines changed

8 files changed

+11
-180
lines changed

internal/ghmcp/server.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ func NewMCPServer(cfg MCPServerConfig) (*mcp.Server, error) {
181181
WithToolsets(enabledToolsets).
182182
WithTools(cfg.EnabledTools).
183183
WithFeatureChecker(featureChecker).
184-
WithInsidersMode(cfg.InsidersMode).
185184
WithServerInstructions()
186185

187186
// Apply token scope filtering if scopes are known (for PAT filtering)

pkg/github/__toolsnaps__/create_pull_request.snap

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"annotations": {
1212
"title": "Open new pull request"
1313
},
14-
"description": "Create a new pull request in a GitHub repository.\n\nWhen show_ui is true, an interactive form is displayed for the user to fill in PR details. Use show_ui when:\n- Creating a new PR and you want user input on the details\n- The user hasn't specified all required fields (title, head, base, etc.)\n- Interactive feedback would be valuable (branch selection, reviewers, labels)\n\nWhen show_ui is false or omitted, the PR is created directly with the provided parameters.",
14+
"description": "Create a new pull request in a GitHub repository.",
1515
"inputSchema": {
1616
"properties": {
1717
"base": {
@@ -42,10 +42,6 @@
4242
"description": "Repository name",
4343
"type": "string"
4444
},
45-
"show_ui": {
46-
"description": "If true, show an interactive form for the user to fill in PR details. If false or omitted, create the PR directly with the provided parameters.",
47-
"type": "boolean"
48-
},
4945
"title": {
5046
"description": "PR title",
5147
"type": "string"

pkg/github/__toolsnaps__/issue_write.snap

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"annotations": {
1212
"title": "Create or update issue."
1313
},
14-
"description": "Create a new or update an existing issue in a GitHub repository.\n\nWhen show_ui is true, an interactive form is displayed for the user to fill in issue details. Use show_ui when:\n- Creating a new issue and you want user input on the details\n- The user hasn't specified all required fields (title, body, etc.)\n- Interactive feedback would be valuable\n\nWhen show_ui is false or omitted, the issue is created/updated directly with the provided parameters.",
14+
"description": "Create a new or update an existing issue in a GitHub repository.",
1515
"inputSchema": {
1616
"properties": {
1717
"assignees": {
@@ -60,10 +60,6 @@
6060
"description": "Repository name",
6161
"type": "string"
6262
},
63-
"show_ui": {
64-
"description": "If true, show an interactive form for the user to fill in issue details. If false or omitted, create/update the issue directly with the provided parameters.",
65-
"type": "boolean"
66-
},
6763
"state": {
6864
"description": "New state",
6965
"enum": [

pkg/github/issues.go

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,15 +1159,8 @@ func IssueWrite(t translations.TranslationHelperFunc) inventory.ServerTool {
11591159
return NewTool(
11601160
ToolsetMetadataIssues,
11611161
mcp.Tool{
1162-
Name: "issue_write",
1163-
Description: t("TOOL_ISSUE_WRITE_DESCRIPTION", `Create a new or update an existing issue in a GitHub repository.
1164-
1165-
When show_ui is true, an interactive form is displayed for the user to fill in issue details. Use show_ui when:
1166-
- Creating a new issue and you want user input on the details
1167-
- The user hasn't specified all required fields (title, body, etc.)
1168-
- Interactive feedback would be valuable
1169-
1170-
When show_ui is false or omitted, the issue is created/updated directly with the provided parameters.`),
1162+
Name: "issue_write",
1163+
Description: t("TOOL_ISSUE_WRITE_DESCRIPTION", "Create a new or update an existing issue in a GitHub repository."),
11711164
Annotations: &mcp.ToolAnnotations{
11721165
Title: t("TOOL_ISSUE_WRITE_USER_TITLE", "Create or update issue."),
11731166
ReadOnlyHint: false,
@@ -1181,10 +1174,6 @@ When show_ui is false or omitted, the issue is created/updated directly with the
11811174
InputSchema: &jsonschema.Schema{
11821175
Type: "object",
11831176
Properties: map[string]*jsonschema.Schema{
1184-
"show_ui": {
1185-
Type: "boolean",
1186-
Description: "If true, show an interactive form for the user to fill in issue details. If false or omitted, create/update the issue directly with the provided parameters.",
1187-
},
11881177
"method": {
11891178
Type: "string",
11901179
Description: `Write operation to perform on a single issue.
@@ -1270,15 +1259,8 @@ Options are:
12701259
return utils.NewToolResultError(err.Error()), nil, nil
12711260
}
12721261

1273-
// Check if UI mode is requested
1274-
showUI, err := OptionalParam[bool](args, "show_ui")
1275-
if err != nil {
1276-
return utils.NewToolResultError(err.Error()), nil, nil
1277-
}
1278-
1279-
// If show_ui is true and insiders mode is enabled, return a message indicating the UI should be shown
1280-
// The host will detect the UI metadata and display the form
1281-
if showUI && deps.GetFlags().InsidersMode {
1262+
// When insiders mode is enabled, show UI - the host will detect the UI metadata and display the form
1263+
if deps.GetFlags().InsidersMode {
12821264
if method == "update" {
12831265
issueNumber, numErr := RequiredInt(args, "issue_number")
12841266
if numErr != nil {

pkg/github/pullrequests.go

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -476,15 +476,8 @@ func CreatePullRequest(t translations.TranslationHelperFunc) inventory.ServerToo
476476
return NewTool(
477477
ToolsetMetadataPullRequests,
478478
mcp.Tool{
479-
Name: "create_pull_request",
480-
Description: t("TOOL_CREATE_PULL_REQUEST_DESCRIPTION", `Create a new pull request in a GitHub repository.
481-
482-
When show_ui is true, an interactive form is displayed for the user to fill in PR details. Use show_ui when:
483-
- Creating a new PR and you want user input on the details
484-
- The user hasn't specified all required fields (title, head, base, etc.)
485-
- Interactive feedback would be valuable (branch selection, reviewers, labels)
486-
487-
When show_ui is false or omitted, the PR is created directly with the provided parameters.`),
479+
Name: "create_pull_request",
480+
Description: t("TOOL_CREATE_PULL_REQUEST_DESCRIPTION", "Create a new pull request in a GitHub repository."),
488481
Annotations: &mcp.ToolAnnotations{
489482
Title: t("TOOL_CREATE_PULL_REQUEST_USER_TITLE", "Open new pull request"),
490483
ReadOnlyHint: false,
@@ -498,10 +491,6 @@ When show_ui is false or omitted, the PR is created directly with the provided p
498491
InputSchema: &jsonschema.Schema{
499492
Type: "object",
500493
Properties: map[string]*jsonschema.Schema{
501-
"show_ui": {
502-
Type: "boolean",
503-
Description: "If true, show an interactive form for the user to fill in PR details. If false or omitted, create the PR directly with the provided parameters.",
504-
},
505494
"owner": {
506495
Type: "string",
507496
Description: "Repository owner",
@@ -549,14 +538,8 @@ When show_ui is false or omitted, the PR is created directly with the provided p
549538
return utils.NewToolResultError(err.Error()), nil, nil
550539
}
551540

552-
// Check if UI mode is requested
553-
showUI, err := OptionalParam[bool](args, "show_ui")
554-
if err != nil {
555-
return utils.NewToolResultError(err.Error()), nil, nil
556-
}
557-
558-
// If show_ui is true and insiders mode is enabled, return a message indicating the UI should be shown
559-
if showUI && deps.GetFlags().InsidersMode {
541+
// When insiders mode is enabled, show UI - the host will detect the UI metadata and display the form
542+
if deps.GetFlags().InsidersMode {
560543
return utils.NewToolResultText(fmt.Sprintf("Ready to create a pull request in %s/%s. The interactive form will be displayed.", owner, repo)), nil, nil
561544
}
562545

pkg/github/pullrequests_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2031,7 +2031,6 @@ func Test_CreatePullRequest(t *testing.T) {
20312031
assert.Equal(t, "create_pull_request", tool.Name)
20322032
assert.NotEmpty(t, tool.Description)
20332033
schema := tool.InputSchema.(*jsonschema.Schema)
2034-
assert.Contains(t, schema.Properties, "show_ui")
20352034
assert.Contains(t, schema.Properties, "owner")
20362035
assert.Contains(t, schema.Properties, "repo")
20372036
assert.Contains(t, schema.Properties, "title")

pkg/inventory/builder.go

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"fmt"
66
"sort"
77
"strings"
8-
9-
"github.com/google/jsonschema-go/jsonschema"
108
)
119

1210
// ToolFilter is a function that determines if a tool should be included.
@@ -43,7 +41,6 @@ type Builder struct {
4341
featureChecker FeatureFlagChecker
4442
filters []ToolFilter // filters to apply to all tools
4543
generateInstructions bool
46-
insidersMode bool
4744
}
4845

4946
// NewBuilder creates a new Builder.
@@ -138,15 +135,6 @@ func (b *Builder) WithFilter(filter ToolFilter) *Builder {
138135
return b
139136
}
140137

141-
// WithInsidersMode enables or disables insiders mode features.
142-
// When insiders mode is disabled (default), UI-related parameters like "show_ui"
143-
// are removed from tool schemas to hide experimental features.
144-
// Returns self for chaining.
145-
func (b *Builder) WithInsidersMode(enabled bool) *Builder {
146-
b.insidersMode = enabled
147-
return b
148-
}
149-
150138
// cleanTools trims whitespace and removes duplicates from tool names.
151139
// Empty strings after trimming are excluded.
152140
func cleanTools(tools []string) []string {
@@ -174,14 +162,8 @@ func cleanTools(tools []string) []string {
174162
// (i.e., they don't exist in the tool set and are not deprecated aliases).
175163
// This ensures invalid tool configurations fail fast at build time.
176164
func (b *Builder) Build() (*Inventory, error) {
177-
// When insiders mode is disabled, strip show_ui parameters from tool schemas
178-
tools := b.tools
179-
if !b.insidersMode {
180-
tools = stripInsidersParameters(b.tools)
181-
}
182-
183165
r := &Inventory{
184-
tools: tools,
166+
tools: b.tools,
185167
resourceTemplates: b.resourceTemplates,
186168
prompts: b.prompts,
187169
deprecatedAliases: b.deprecatedAliases,
@@ -344,60 +326,3 @@ func (b *Builder) processToolsets() (map[ToolsetID]bool, []string, []ToolsetID,
344326
}
345327
return enabledToolsets, unrecognized, allToolsetIDs, validIDs, defaultToolsetIDList, descriptions
346328
}
347-
348-
// stripInsidersParameters removes insiders-only parameters from tool schemas.
349-
// This creates shallow copies of tools that have insiders parameters to avoid
350-
// mutating the original tool definitions.
351-
func stripInsidersParameters(tools []ServerTool) []ServerTool {
352-
result := make([]ServerTool, len(tools))
353-
for i, tool := range tools {
354-
if modified, ok := removeInsidersParameters(tool.Tool.InputSchema); ok {
355-
// Make a shallow copy of the tool
356-
toolCopy := tool
357-
toolCopy.Tool.InputSchema = modified
358-
result[i] = toolCopy
359-
} else {
360-
result[i] = tool
361-
}
362-
}
363-
return result
364-
}
365-
366-
// insidersParameters lists the parameter names that are insiders-only
367-
var insidersParameters = map[string]bool{
368-
"show_ui": true,
369-
}
370-
371-
// removeInsidersParameters removes insiders-only parameters from a schema.
372-
// Returns the modified schema and true if any changes were made.
373-
// Handles *jsonschema.Schema type used by most tools.
374-
func removeInsidersParameters(schema any) (any, bool) {
375-
// Handle *jsonschema.Schema (the most common case)
376-
if js, ok := schema.(*jsonschema.Schema); ok && js != nil {
377-
if js.Properties == nil {
378-
return schema, false
379-
}
380-
hasInsidersParam := false
381-
for name := range js.Properties {
382-
if insidersParameters[name] {
383-
hasInsidersParam = true
384-
break
385-
}
386-
}
387-
if !hasInsidersParam {
388-
return schema, false
389-
}
390-
// Create a new schema with insiders parameters removed
391-
newProps := make(map[string]*jsonschema.Schema, len(js.Properties))
392-
for name, prop := range js.Properties {
393-
if !insidersParameters[name] {
394-
newProps[name] = prop
395-
}
396-
}
397-
newSchema := *js // shallow copy
398-
newSchema.Properties = newProps
399-
return &newSchema, true
400-
}
401-
// For other types (json.RawMessage, map[string]any, etc.), leave unchanged
402-
return schema, false
403-
}

pkg/inventory/registry_test.go

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"testing"
88

9-
"github.com/google/jsonschema-go/jsonschema"
109
"github.com/modelcontextprotocol/go-sdk/mcp"
1110
"github.com/stretchr/testify/require"
1211
)
@@ -1833,51 +1832,3 @@ func TestWithTools_DeprecatedAliasAndFeatureFlag(t *testing.T) {
18331832
t.Errorf("Flag ON: Expected new_tool (via alias), got %s", availableOn[0].Tool.Name)
18341833
}
18351834
}
1836-
1837-
func TestWithInsidersMode(t *testing.T) {
1838-
// Create a tool with a jsonschema.Schema that has show_ui
1839-
toolWithShowUI := NewServerToolFromHandler(
1840-
mcp.Tool{
1841-
Name: "test_tool",
1842-
InputSchema: &jsonschema.Schema{
1843-
Type: "object",
1844-
Properties: map[string]*jsonschema.Schema{
1845-
"show_ui": {
1846-
Type: "boolean",
1847-
Description: "Show UI",
1848-
},
1849-
"owner": {
1850-
Type: "string",
1851-
Description: "Owner",
1852-
},
1853-
},
1854-
},
1855-
},
1856-
testToolsetMetadata("test"),
1857-
func(_ any) mcp.ToolHandler {
1858-
return func(_ context.Context, _ *mcp.CallToolRequest) (*mcp.CallToolResult, error) {
1859-
return nil, nil
1860-
}
1861-
},
1862-
)
1863-
1864-
tools := []ServerTool{toolWithShowUI}
1865-
1866-
// Test with insiders mode disabled - show_ui should be stripped
1867-
regNoInsiders := mustBuild(t, NewBuilder().SetTools(tools).WithInsidersMode(false))
1868-
toolsNoInsiders := regNoInsiders.AllTools()
1869-
require.Len(t, toolsNoInsiders, 1)
1870-
schema, ok := toolsNoInsiders[0].Tool.InputSchema.(*jsonschema.Schema)
1871-
require.True(t, ok, "Schema should be *jsonschema.Schema")
1872-
require.Nil(t, schema.Properties["show_ui"], "show_ui should be stripped when insiders mode is disabled")
1873-
require.NotNil(t, schema.Properties["owner"], "owner should still exist")
1874-
1875-
// Test with insiders mode enabled - show_ui should remain
1876-
regWithInsiders := mustBuild(t, NewBuilder().SetTools(tools).WithInsidersMode(true))
1877-
toolsWithInsiders := regWithInsiders.AllTools()
1878-
require.Len(t, toolsWithInsiders, 1)
1879-
schemaInsiders, ok := toolsWithInsiders[0].Tool.InputSchema.(*jsonschema.Schema)
1880-
require.True(t, ok, "Schema should be *jsonschema.Schema")
1881-
require.NotNil(t, schemaInsiders.Properties["show_ui"], "show_ui should remain when insiders mode is enabled")
1882-
require.NotNil(t, schemaInsiders.Properties["owner"], "owner should still exist")
1883-
}

0 commit comments

Comments
 (0)