|
6 | 6 | "fmt" |
7 | 7 | "io" |
8 | 8 | "net/http" |
| 9 | + "reflect" |
9 | 10 |
|
10 | 11 | "github.com/google/jsonschema-go/jsonschema" |
11 | 12 | "github.com/modelcontextprotocol/go-sdk/mcp" |
@@ -37,12 +38,26 @@ func init() { |
37 | 38 | var err error |
38 | 39 |
|
39 | 40 | // generate the output schemas only once |
40 | | - taskGetOutputSchema, err = jsonschema.For[projects.TaskGetResponse](&jsonschema.ForOptions{}) |
| 41 | + taskGetOutputSchema, err = jsonschema.For[projects.TaskGetResponse](&jsonschema.ForOptions{ |
| 42 | + TypeSchemas: map[reflect.Type]*jsonschema.Schema{ |
| 43 | + reflect.TypeFor[twapi.Date](): { |
| 44 | + Types: []string{"null", "string"}, |
| 45 | + Description: "Null or date-only date string", |
| 46 | + }, |
| 47 | + }, |
| 48 | + }) |
41 | 49 | if err != nil { |
42 | 50 | panic(fmt.Sprintf("failed to generate JSON schema for TaskGetResponse: %v", err)) |
43 | 51 | } |
44 | 52 | helpers.WithMetaWebLinkSchema(taskGetOutputSchema) |
45 | | - taskListOutputSchema, err = jsonschema.For[projects.TaskListResponse](&jsonschema.ForOptions{}) |
| 53 | + taskListOutputSchema, err = jsonschema.For[projects.TaskListResponse](&jsonschema.ForOptions{ |
| 54 | + TypeSchemas: map[reflect.Type]*jsonschema.Schema{ |
| 55 | + reflect.TypeFor[twapi.Date](): { |
| 56 | + Types: []string{"null", "string"}, |
| 57 | + Description: "Null or date-only date string", |
| 58 | + }, |
| 59 | + }, |
| 60 | + }) |
46 | 61 | if err != nil { |
47 | 62 | panic(fmt.Sprintf("failed to generate JSON schema for TaskListResponse: %v", err)) |
48 | 63 | } |
|
0 commit comments