nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

MCP tool input schemas are untyped (inputSchema?: any)

Open ragini-pandey opened this issue 7 months ago • 1 comments

Description

The inputSchema field in the MCP tool type (source/types/mcp.ts, line 13) is typed as any, meaning MCP tool schemas have no type checking at compile time.

Current Behavior

inputSchema?: any;

Expected Behavior

inputSchema should use a proper JSON Schema type — either from a library (e.g., @types/json-schema's JSONSchema7) or a minimal custom interface — to enable type safety and improve editor support.

Suggested Fix

Define a minimal schema interface or import a JSON Schema type:

interface JsonSchemaObject {
  type?: string;
  properties?: Record<string, JsonSchemaObject>;
  required?: string[];
  [key: string]: unknown;
}

inputSchema?: JsonSchemaObject;

Severity

Enhancement

ragini-pandey avatar Apr 22 '26 15:04 ragini-pandey

The observation is valid... partial custom interface would not fully model JSON Schema and may narrow the type in ways that are incomplete or misleading.

If this should be typed, it would be better to align with a standard JSON Schema type used consistently with the MCP flow.