Skip to content

Commit b420e27

Browse files
committed
Morning updates
1 parent d9ce07f commit b420e27

2 files changed

Lines changed: 47 additions & 56 deletions

File tree

scripts/validate-component.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,10 @@ function validateAgainstSchema(jsonData, schemaName) {
4545

4646
// Example usage
4747
const jsonToValidate = {
48-
call_id: "723e4567-e89b-12d3-a456-426614174006",
49-
duration: 60,
50-
success: false,
51-
error: {
52-
message: "Doorbell ID not found",
53-
developer_message: "The doorbell with ID 'doorbell1' does not exist.",
54-
can_retry: true,
55-
additional_prompt_content: "available_ids: doorbell42,doorbell84",
56-
retry_after_ms: 500,
57-
},
48+
call_id: "123e4567-e89b-12d3-a456-426614174000",
49+
duration: 2,
50+
success: true,
51+
value: 3,
5852
};
5953

6054
const result = validateAgainstSchema(jsonToValidate, "CallToolResponse");

specification/http/1.0/openapi.json

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
"content": {
149149
"application/json": {
150150
"schema": {
151-
"$ref": "#/components/schemas/ValidationFailedResponse"
151+
"$ref": "#/components/schemas/ValidationErrorResponse"
152152
}
153153
}
154154
}
@@ -354,7 +354,7 @@
354354
},
355355
"user_id": {
356356
"type": "string",
357-
"description": "A unique ID that identifies the user, if present."
357+
"description": "A unique ID that identifies the user, if required by the tool."
358358
}
359359
},
360360
"additionalProperties": true
@@ -385,22 +385,16 @@
385385
"properties": {
386386
"success": { "enum": [true] },
387387
"value": {
388-
"description": "The value returned from the tool.",
389-
"oneOf": [
390-
{
391-
"type": "object",
392-
"additionalProperties": true
393-
},
394-
{
395-
"type": "number"
396-
},
397-
{
398-
"type": "string"
399-
},
400-
{
401-
"type": "boolean"
402-
}
403-
]
388+
"type": [
389+
"object",
390+
"array",
391+
"string",
392+
"number",
393+
"boolean",
394+
"null"
395+
],
396+
"additionalProperties": true,
397+
"description": "The value returned from the tool."
404398
}
405399
},
406400
"not": { "required": ["error"] }
@@ -409,33 +403,7 @@
409403
"properties": {
410404
"success": { "enum": [false] },
411405
"error": {
412-
"type": "object",
413-
"description": "An error that occurred inside the tool function.",
414-
"properties": {
415-
"message": {
416-
"type": "string",
417-
"description": "An error message that can be shown to the user or the AI model."
418-
},
419-
"developer_message": {
420-
"type": "string",
421-
"description": "An internal message that will be logged but will not be shown to the user or the AI model"
422-
},
423-
"can_retry": {
424-
"type": "boolean",
425-
"description": "Whether the tool call can be retried by the client.",
426-
"default": false
427-
},
428-
"additional_prompt_content": {
429-
"type": "string",
430-
"description": "Additional content to be included in the retry prompt."
431-
},
432-
"retry_after_ms": {
433-
"type": "integer",
434-
"description": "The number of milliseconds (if any) to wait before retrying the tool call."
435-
}
436-
},
437-
"required": ["message"],
438-
"additionalProperties": false
406+
"$ref": "#/components/schemas/ToolError"
439407
}
440408
},
441409
"required": ["error"],
@@ -463,7 +431,7 @@
463431
"required": ["message"],
464432
"additionalProperties": false
465433
},
466-
"ValidationFailedResponse": {
434+
"ValidationErrorResponse": {
467435
"type": "object",
468436
"properties": {
469437
"$schema": {
@@ -481,6 +449,35 @@
481449
},
482450
"required": ["message"],
483451
"additionalProperties": false
452+
},
453+
"ToolError": {
454+
"type": "object",
455+
"description": "An error that occurred inside the tool function.",
456+
"properties": {
457+
"message": {
458+
"type": "string",
459+
"description": "An error message that can be shown to the user or the AI model."
460+
},
461+
"developer_message": {
462+
"type": "string",
463+
"description": "An internal message that will be logged but will not be shown to the user or the AI model"
464+
},
465+
"can_retry": {
466+
"type": "boolean",
467+
"description": "Whether the tool call can be retried by the client.",
468+
"default": false
469+
},
470+
"additional_prompt_content": {
471+
"type": "string",
472+
"description": "Additional content to be included in the retry prompt."
473+
},
474+
"retry_after_ms": {
475+
"type": "integer",
476+
"description": "The number of milliseconds (if any) to wait before retrying the tool call."
477+
}
478+
},
479+
"required": ["message"],
480+
"additionalProperties": false
484481
}
485482
}
486483
}

0 commit comments

Comments
 (0)