Skip to content

Analyzer: tool registration completeness — detect unregistered NetclawTool implementations #308

@Aaronontheweb

Description

@Aaronontheweb

Parent epic: #304

Problem

The source generator produces a fully functional tool class from [NetclawTool] + NetclawTool<TParams>, but nothing verifies the tool is actually registered in ToolRegistrationExtensions. You can create a perfectly generated tool, forget to add it to WithFirstPartyTools() (or the appropriate registration method), and the tool silently doesn't exist at runtime. It compiles, tests pass, users can never invoke it.

Candidate rule

NCLW2001: NetclawTool implementation is not registered

  • Trigger: A non-abstract class with [NetclawTool] attribute has no corresponding Register(new XxxTool(...)) call in any ToolRegistrationExtensions method
  • Severity: Warning
  • Scope: Classes in Netclaw.Actors and Netclaw.Channels (not test projects)
  • Fix: Add registration call in the appropriate With*Tools() extension method

Notes

  • Channel tools (IChannelTool) have a different registration path — the analyzer should account for that
  • MCP-wrapped tools are registered dynamically and should be excluded
  • May need a [ExcludeFromRegistrationCheck] attribute for tools that are intentionally registered conditionally

Acceptance criteria

  • Analyzer detects unregistered tool classes
  • No false positives on channel tools, MCP tools, or test fakes
  • Existing codebase passes clean

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