Skip to content

[FEATURE] support blank parameters of tools #182

Description

@invisibleyoung

Thank you for creating a great go mcp SDK.
in protocol module, the declaration of InputSchema is:

type InputSchema struct {
	Type       InputSchemaType      `json:"type"`
	Properties map[string]*Property `json:"properties,omitempty"`
	Required   []string             `json:"required,omitempty"`
}

I used the Client SDK to communicate with LLM, during my development I found that when a remote tool params is blank, the protocol.InputSchema will omit the Properties, the generated JSON string is illegal for OpenAI tool calling json schema.
for now, the blank param schema is:

{
"type": "object"
}

the expected params format which could be accepted by OpenAI api is:

{
"type": "object",
"properties": {}
}

Could you remove the omitempty tag of Promperties?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions