Skip to content

Tool.inputSchema does not cover actual values sent by servers #156

@headinthebox

Description

@headinthebox

https://github.com/modelcontextprotocol/specification/blob/cf6dc35dcab6df175d660990df889548db6e5279/schema/2024-11-05/schema.ts#L690

The schema specifies

export interface Tool {
/**

  • The name of the tool.
    /
    name: string;
    /
    *
  • A human-readable description of the tool.
    /
    description?: string;
    /
    *
  • A JSON Schema object defining the expected parameters for the tool.
    */
    inputSchema: {
    type: "object";
    properties?: { [key: string]: object };
    required?: string[];
    };
    }

but many servers, such as fileSystem, etc have additional fields for inputSchema such as "additionalProperties" and "$schema"

{
"name": "read_file",
"description": "Read the complete contents of a file from the file system. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Only works within allowed directories.",
"inputSchema": {
"type": "object",
"properties": {
"path": {
"type": "string"
}
},
"required": [
"path"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}

I did a quick scan of the spec, but I could not find if it additional fields are allowed and that servers and clients should ignore those.

Independent of that, I believe that if servers routinely send "additionalProperties" and "$schema" it would be good to add those keys to the inputSchema schema.

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