Skip to content

Commit e1c9455

Browse files
committed
Fix schema for default fields
1 parent 9c1ef5d commit e1c9455

3 files changed

Lines changed: 18 additions & 22 deletions

File tree

rust/generate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ enum AcpTypes {
1919
}
2020

2121
fn main() {
22-
let mut settings = SchemaSettings::default().for_serialize();
22+
let mut settings = SchemaSettings::default();
2323
settings.untagged_enum_variant_titles = true;
2424

2525
let generator = settings.into_generator();

schema/schema.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"description": "Prompt capabilities supported by the agent."
1919
}
2020
},
21-
"required": ["loadSession", "promptCapabilities"],
2221
"type": "object"
2322
},
2423
"AgentNotification": {
@@ -130,7 +129,7 @@
130129
"type": "string"
131130
}
132131
},
133-
"required": ["id", "name", "description"],
132+
"required": ["id", "name"],
134133
"type": "object"
135134
},
136135
"AuthMethodId": {
@@ -187,7 +186,6 @@
187186
"description": "File system capabilities supported by the client.\nDetermines which file operations the agent can request."
188187
}
189188
},
190-
"required": ["fs"],
191189
"type": "object"
192190
},
193191
"ClientNotification": {
@@ -453,7 +451,6 @@
453451
"type": "boolean"
454452
}
455453
},
456-
"required": ["readTextFile", "writeTextFile"],
457454
"type": "object"
458455
},
459456
"ImageContent": {
@@ -500,7 +497,7 @@
500497
"description": "The latest protocol version supported by the client."
501498
}
502499
},
503-
"required": ["protocolVersion", "clientCapabilities"],
500+
"required": ["protocolVersion"],
504501
"type": "object"
505502
},
506503
"InitializeResponse": {
@@ -531,7 +528,7 @@
531528
"description": "The protocol version the client specified if supported by the agent,\nor the latest protocol version supported by the agent.\n\nThe client should disconnect, if it doesn't support this version."
532529
}
533530
},
534-
"required": ["protocolVersion", "agentCapabilities", "authMethods"],
531+
"required": ["protocolVersion"],
535532
"type": "object"
536533
},
537534
"LoadSessionRequest": {
@@ -754,7 +751,6 @@
754751
"type": "boolean"
755752
}
756753
},
757-
"required": ["image", "audio", "embeddedContext"],
758754
"type": "object"
759755
},
760756
"PromptRequest": {
@@ -1274,7 +1270,7 @@
12741270
"type": "string"
12751271
}
12761272
},
1277-
"required": ["type", "path", "oldText", "newText"],
1273+
"required": ["type", "path", "newText"],
12781274
"type": "object"
12791275
}
12801276
]

typescript/schema.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ export const toolCallContentSchema = z.union([
417417
/**
418418
* The original content (None for new files).
419419
*/
420-
oldText: z.string().nullable(),
420+
oldText: z.string().optional().nullable(),
421421
/**
422422
* The file path being modified.
423423
*/
@@ -453,11 +453,11 @@ export const fileSystemCapabilitySchema = z.object({
453453
/**
454454
* Whether the Client supports `fs/read_text_file` requests.
455455
*/
456-
readTextFile: z.boolean(),
456+
readTextFile: z.boolean().optional(),
457457
/**
458458
* Whether the Client supports `fs/write_text_file` requests.
459459
*/
460-
writeTextFile: z.boolean(),
460+
writeTextFile: z.boolean().optional(),
461461
});
462462

463463
/**
@@ -560,7 +560,7 @@ export const authMethodSchema = z.object({
560560
/**
561561
* Optional description providing more details about this authentication method.
562562
*/
563-
description: z.string().nullable(),
563+
description: z.string().optional().nullable(),
564564
/**
565565
* Unique identifier for this authentication method.
566566
*/
@@ -578,18 +578,18 @@ export const promptCapabilitiesSchema = z.object({
578578
/**
579579
* Agent supports [`ContentBlock::Audio`].
580580
*/
581-
audio: z.boolean(),
581+
audio: z.boolean().optional(),
582582
/**
583583
* Agent supports embedded context in `session/prompt` requests.
584584
*
585585
* When enabled, the Client is allowed to include [`ContentBlock::Resource`]
586586
* in prompt requests for pieces of context that are referenced in the message.
587587
*/
588-
embeddedContext: z.boolean(),
588+
embeddedContext: z.boolean().optional(),
589589
/**
590590
* Agent supports [`ContentBlock::Image`].
591591
*/
592-
image: z.boolean(),
592+
image: z.boolean().optional(),
593593
});
594594

595595
/**
@@ -889,7 +889,7 @@ export const toolCallUpdateSchema = z.object({
889889
* Capabilities supported by the client.
890890
*/
891891
export const clientCapabilitiesSchema = z.object({
892-
fs: fileSystemCapabilitySchema,
892+
fs: fileSystemCapabilitySchema.optional(),
893893
});
894894

895895
/**
@@ -899,8 +899,8 @@ export const agentCapabilitiesSchema = z.object({
899899
/**
900900
* Whether the agent supports `session/load`.
901901
*/
902-
loadSession: z.boolean(),
903-
promptCapabilities: promptCapabilitiesSchema,
902+
loadSession: z.boolean().optional(),
903+
promptCapabilities: promptCapabilitiesSchema.optional(),
904904
});
905905

906906
/**
@@ -940,7 +940,7 @@ export const requestPermissionRequestSchema = z.object({
940940
* See: <https://agentclientprotocol.com/protocol/initialization>
941941
*/
942942
export const initializeRequestSchema = z.object({
943-
clientCapabilities: clientCapabilitiesSchema,
943+
clientCapabilities: clientCapabilitiesSchema.optional(),
944944
/**
945945
* The latest protocol version supported by the client.
946946
*/
@@ -955,11 +955,11 @@ export const initializeRequestSchema = z.object({
955955
* See: <https://agentclientprotocol.com/protocol/initialization>
956956
*/
957957
export const initializeResponseSchema = z.object({
958-
agentCapabilities: agentCapabilitiesSchema,
958+
agentCapabilities: agentCapabilitiesSchema.optional(),
959959
/**
960960
* Authentication methods supported by the agent.
961961
*/
962-
authMethods: z.array(authMethodSchema),
962+
authMethods: z.array(authMethodSchema).optional(),
963963
/**
964964
* The protocol version the client specified if supported by the agent,
965965
* or the latest protocol version supported by the agent.

0 commit comments

Comments
 (0)