|
6 | 6 | "fmt" |
7 | 7 | "io" |
8 | 8 | "net/http" |
9 | | - "reflect" |
10 | 9 |
|
11 | 10 | "github.com/google/jsonschema-go/jsonschema" |
12 | 11 | "github.com/modelcontextprotocol/go-sdk/mcp" |
@@ -38,26 +37,12 @@ func init() { |
38 | 37 | var err error |
39 | 38 |
|
40 | 39 | // generate the output schemas only once |
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 | | - }) |
| 40 | + taskGetOutputSchema, err = jsonschema.For[projects.TaskGetResponse](helpers.WithDateTypeSchema(&jsonschema.ForOptions{})) |
49 | 41 | if err != nil { |
50 | 42 | panic(fmt.Sprintf("failed to generate JSON schema for TaskGetResponse: %v", err)) |
51 | 43 | } |
52 | 44 | helpers.WithMetaWebLinkSchema(taskGetOutputSchema) |
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 | | - }) |
| 45 | + taskListOutputSchema, err = jsonschema.For[projects.TaskListResponse](helpers.WithDateTypeSchema(&jsonschema.ForOptions{})) |
61 | 46 | if err != nil { |
62 | 47 | panic(fmt.Sprintf("failed to generate JSON schema for TaskListResponse: %v", err)) |
63 | 48 | } |
|
0 commit comments