Skip to content

Generator: flag unsupported parameter types in NetclawTool<TParams> records #309

@Aaronontheweb

Description

@Aaronontheweb

Parent epic: #304

Problem

The tool source generator maps parameter types to JSON schema types, but silently falls back to "string" for any type it doesn't recognize. If someone adds a DateTime, enum, List<string>, or custom type as a tool parameter, the generator:

  1. Emits "type": "string" in the schema — the LLM gets no useful format hint
  2. Generates ParseArguments code that will likely fail at runtime with a cast/parse error

This compiles cleanly and tests pass until someone actually invokes the tool with that parameter.

Supported types today

  • string"string"
  • int, long"integer"
  • float, double"number"
  • bool"boolean"
  • Nullable variants of the above

Everything else silently becomes "string".

Proposed fix

Add a diagnostic to NetclawToolGenerator that emits a warning when a TParams constructor parameter uses an unsupported type:

NCLW2002: Tool parameter type is not supported by schema generator

  • Trigger: TParams record constructor parameter is not one of the supported primitive types
  • Severity: Warning
  • Fix: Use a supported type, or add support for the new type in the generator

This is a generator enhancement, not a separate analyzer — the diagnostic should be emitted during source generation since the generator already inspects parameter types.

Acceptance criteria

  • Generator emits diagnostic for unsupported parameter types
  • Diagnostic includes the parameter name, type, and tool name
  • Existing tools compile without new warnings
  • If we later add support for new types (e.g., enums), the diagnostic stops firing for those

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions