fix(api): use camelCase in CallToolResponse and add type discriminators to ContentBlock (#7487)

Co-authored-by: Goose <opensource@block.xyz>
Co-authored-by: Jack Amadeo <jackamadeo@block.xyz>
This commit is contained in:
Andrew Harvard
2026-03-10 20:39:44 -04:00
committed by GitHub
parent 902c2ac28a
commit 76e49662ad
8 changed files with 342 additions and 61 deletions
File diff suppressed because one or more lines are too long
+28 -6
View File
@@ -54,9 +54,9 @@ export type CallToolRequest = {
export type CallToolResponse = {
_meta?: unknown;
content: Array<Content>;
is_error: boolean;
structured_content?: unknown;
content: Array<ContentBlock>;
isError: boolean;
structuredContent?: unknown;
};
export type ChatRequest = {
@@ -128,7 +128,29 @@ export type ConfirmToolActionRequest = {
sessionId: string;
};
export type Content = RawTextContent | RawImageContent | RawEmbeddedResource | RawAudioContent | RawResource;
export type Content = ({
type: 'text';
} & RawTextContent) | ({
type: 'image';
} & RawImageContent) | ({
type: 'resource';
} & RawEmbeddedResource) | ({
type: 'audio';
} & RawAudioContent) | ({
type: 'resource_link';
} & RawResource);
export type ContentBlock = ({
type: 'text';
} & RawTextContent) | ({
type: 'image';
} & RawImageContent) | ({
type: 'resource';
} & RawEmbeddedResource) | ({
type: 'audio';
} & RawAudioContent) | ({
type: 'resource_link';
} & RawResource);
export type Conversation = Array<Message>;
@@ -1112,7 +1134,7 @@ export type RetryConfig = {
timeout_seconds?: number | null;
};
export type Role = string;
export type Role = 'user' | 'assistant';
export type RunNowResponse = {
session_id: string;
@@ -1317,7 +1339,7 @@ export type SystemNotificationContent = {
export type SystemNotificationType = 'thinkingMessage' | 'inlineMessage' | 'creditsExhausted';
export type TaskSupport = string;
export type TaskSupport = 'forbidden' | 'optional' | 'required';
export type TelemetryEventRequest = {
event_name: string;