Skip to content

Tools without inputSchema are not visible in some MCP clients #79

Open
@artemnovichkov

Description

@artemnovichkov

Is your feature request related to a problem? Please describe.
I experimented with the SDK and found a strange behavior. Tools without inputSchema are not visible in Cursor and Claude Desktop, but work fine in Visual Studio Code. Here is my fix to make them available everywhere:

let tool = Tool(name: "swift_version",
                description: "Returns the current Swift version",
                inputSchema: .object([
                    "type": .string("object")
                ]))

Here is a full code if my example:
https://github.com/artemnovichkov/swift-version-mcp/blob/master/Sources/SwiftVersionMCP/main.swift

I'm not sure is this problem related to the SDK or to the clients.

Describe the solution you'd like
If you want to use the tool without inputSchema, it may be configured like:

let tool = Tool(name: "swift_version",
                description: "Returns the current Swift version")

Activity

stallent

stallent commented on Apr 17, 2025

@stallent
Contributor

In their defense, input schema isn't optional for tools per the spec. So i'm not sure this is something that should be changed. From the spec:

{
  name: string;          // Unique identifier for the tool
  description?: string;  // Human-readable description
  inputSchema: {         // JSON Schema for the tool's parameters
    type: "object",
    properties: { ... }  // Tool-specific parameters
  },
  annotations?: {        // Optional hints about tool behavior
    title?: string;      // Human-readable title for the tool
    readOnlyHint?: boolean;    // If true, the tool does not modify its environment
    destructiveHint?: boolean; // If true, the tool may perform destructive updates
    idempotentHint?: boolean;  // If true, repeated calls with same args have no additional effect
    openWorldHint?: boolean;   // If true, tool interacts with external entities
  }
}

I certainly get how without params whats the point, but spec interpretation is always somewhat subjective which is why you are seeing diff behavior from diff tools. Regardless, the spec does say optional for optional things so pretty reasonable to assume its required which is why it doesn't work in Claude Desktop especially, since they created the spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Tools without inputSchema are not visible in some MCP clients · Issue #79 · modelcontextprotocol/swift-sdk