fix: Remove unnecessary fields from map parameter manifests (#1138)

Previously the `additionalProperties` field manifests returns name,
descriptions, authSources etc. that are not needed.
These fields are removed for clarity.
This commit is contained in:
Wenxin Du
2025-08-13 14:12:27 -04:00
committed by GitHub
parent 497d3b126d
commit fbe8c1a9c0
2 changed files with 10 additions and 10 deletions

View File

@@ -1211,12 +1211,12 @@ func (p *MapParameter) Manifest() ParameterManifest {
var additionalProperties any
if p.ValueType != "" {
prototype, err := getPrototypeParameter(p.ValueType)
_, err := getPrototypeParameter(p.ValueType)
if err != nil {
panic(err)
}
valueSchema := prototype.Manifest()
additionalProperties = &valueSchema
valueSchema := map[string]any{"type": p.ValueType}
additionalProperties = valueSchema
} else {
// If no valueType is given, allow any properties.
additionalProperties = true
@@ -1236,12 +1236,12 @@ func (p *MapParameter) Manifest() ParameterManifest {
func (p *MapParameter) McpManifest() ParameterMcpManifest {
var additionalProperties any
if p.ValueType != "" {
prototype, err := getPrototypeParameter(p.ValueType)
_, err := getPrototypeParameter(p.ValueType)
if err != nil {
panic(err)
}
valueSchema := prototype.McpManifest()
additionalProperties = &valueSchema
valueSchema := map[string]any{"type": p.ValueType}
additionalProperties = valueSchema
} else {
// If no valueType is given, allow any properties.
additionalProperties = true

View File

@@ -1270,7 +1270,7 @@ func TestParamManifest(t *testing.T) {
Required: true,
Description: "bar",
AuthServices: []string{},
AdditionalProperties: &tools.ParameterManifest{Name: "", Type: "string", Required: true, Description: "", AuthServices: []string{}},
AdditionalProperties: map[string]any{"type": "string"},
},
},
{
@@ -1282,7 +1282,7 @@ func TestParamManifest(t *testing.T) {
Required: false,
Description: "bar",
AuthServices: []string{},
AdditionalProperties: &tools.ParameterManifest{Name: "", Type: "string", Required: true, Description: "", AuthServices: []string{}},
AdditionalProperties: map[string]any{"type": "string"},
},
},
{
@@ -1350,7 +1350,7 @@ func TestParamMcpManifest(t *testing.T) {
want: tools.ParameterMcpManifest{
Type: "object",
Description: "bar",
AdditionalProperties: &tools.ParameterMcpManifest{Type: "string", Description: ""},
AdditionalProperties: map[string]any{"type": "string"},
},
},
{
@@ -1405,7 +1405,7 @@ func TestMcpManifest(t *testing.T) {
"foo-map-int": {
Type: "object",
Description: "a map of ints",
AdditionalProperties: &tools.ParameterMcpManifest{Type: "integer", Description: ""},
AdditionalProperties: map[string]any{"type": "integer"},
},
"foo-map-any": {
Type: "object",