Convert to dictionary, excluding None values.
(self)
| 26 | metadata: dict[str, str] = field(default_factory=dict) |
| 27 | |
| 28 | def to_dict(self) -> dict: |
| 29 | """Convert to dictionary, excluding None values.""" |
| 30 | result = {"name": self.name, "description": self.description} |
| 31 | if self.license is not None: |
| 32 | result["license"] = self.license |
| 33 | if self.compatibility is not None: |
| 34 | result["compatibility"] = self.compatibility |
| 35 | if self.allowed_tools is not None: |
| 36 | result["allowed-tools"] = self.allowed_tools |
| 37 | if self.metadata: |
| 38 | result["metadata"] = self.metadata |
| 39 | return result |
no outgoing calls