Skip to content

feat(tools): add OOP C# code generation tools #83

@CalvinAllen

Description

@CalvinAllen

Description

Add structured C# code generation/mutation tools powered by Roslyn that allow AI assistants to create, update, and delete C# code elements at a semantic level — rather than raw text editing via document_write/editor_replace.

Tools to Implement

Type Management

Tool Description
cs_create_type Create a new class, struct, record, interface, or enum in a specified file/namespace
cs_delete_type Remove a type declaration from a file
cs_rename_type Rename a type with Roslyn rename support (updates all references)
cs_modify_type Change type modifiers (sealed, abstract, static, partial), base types, or implemented interfaces

Member Management

Tool Description
cs_add_method Add a method to a type with full signature and body
cs_update_method Update a method's signature, body, or modifiers
cs_delete_method Remove a method from a type
cs_add_property Add a property with optional getter/setter/init bodies
cs_update_property Update a property's type, accessors, or modifiers
cs_delete_property Remove a property from a type
cs_add_field Add a field with optional initializer
cs_update_field Update a field's type, modifiers, or initializer
cs_delete_field Remove a field from a type

Constructor and Event Management

Tool Description
cs_add_constructor Add a constructor with parameters and body
cs_update_constructor Update constructor parameters or body
cs_delete_constructor Remove a constructor
cs_add_event Add an event declaration
cs_delete_event Remove an event

Attribute and Using Management

Tool Description
cs_add_attribute Add an attribute to a type or member
cs_remove_attribute Remove an attribute from a type or member
cs_add_using Add a using directive to a file
cs_remove_using Remove a using directive from a file

Enum Members

Tool Description
cs_add_enum_member Add a member to an enum with optional value
cs_delete_enum_member Remove an enum member

Batch Operations

Tool Description
cs_batch Execute multiple code generation operations in a single transaction

Notes

  • All operations should use Roslyn SyntaxNode manipulation for correctness (proper formatting, trivia preservation)
  • Operations should respect existing code style (indentation, brace placement)
  • Batch mode allows multiple mutations atomically to avoid intermediate broken states
  • Complements feat(tools): add Roslyn-based deep C# analysis tools #82 (Roslyn analysis) — analysis tools inspect, these tools mutate
  • Competitor reference: RoslynMcp cs tool (86 actions)

Metadata

Metadata

Assignees

Labels

No labels
No labels

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