Skip to content

Commit b0d32f7

Browse files
authored
schema: fix circular reference recursion (#87)
1 parent f1de168 commit b0d32f7

File tree

7 files changed

+1257
-45
lines changed

7 files changed

+1257
-45
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.0.7 (2025-10-15)
4+
5+
### Features
6+
- feat: refactor context handling to use WithoutCancel (#86)
7+
8+
### Fixes
9+
- schema: fix circular reference recursion (#87)
10+
311
## 0.0.6 (2025-09-29)
412

513
### Features

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,11 +761,24 @@ weatherHandler := mcp.NewTypedToolHandler(func(ctx context.Context, req *mcp.Cal
761761
})
762762
```
763763

764+
**Schema Generation Styles:**
765+
766+
By default, schemas use `$defs + $ref` for compact representation (~2KB). You can customize the generation style:
767+
768+
```go
769+
// Ref style (default) - compact schemas with $defs + $ref
770+
mcp.WithInputStruct[Input](mcp.WithRefStyle())
771+
772+
// Inline style - expand all types inline (larger schemas)
773+
mcp.WithOutputStruct[Output](mcp.WithInlineStyle())
774+
```
775+
764776
**Benefits:**
765777
- 🛡️ **Type Safety**: Compile-time type checking and automatic validation
766778
- 📋 **Rich Schemas**: Auto-generated OpenAPI schemas with descriptions, enums, defaults
767779
- 🔄 **Structured Output**: Type-safe responses with backward compatibility
768780
- 🎯 **DRY Principle**: Single source of truth for data structures
781+
- 🎨 **Flexible Styles**: Choose between compact ($ref) or expanded (inline) schemas
769782

770783
See [`examples/schema-generation/`](examples/schema-generation/) for a complete example.
771784

0 commit comments

Comments
 (0)