arcade-mcp/schemas/preview/tool_definition.schema.jsonc
Sam Partee 28fe56cfc1
MyPy Compliant (#5)
MyPy compliance for the whole codebase

- systematic way of executing tools (`executor.py`)
- support for using pydantic models in tool inputs and outputs
- mypy compliance (most of the changes)
- removal of unused code (from previous iterations)

Co-authored-by: Nate Barbettini <nate@arcade-ai.com>
2024-07-16 17:01:38 -07:00

162 lines
4.4 KiB
Text

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"primitives": {
// All supported primitive data types
"type": "string",
"enum": ["string", "integer", "float", "boolean", "json"]
},
"value_schema": {
// Represents a value schema (e.g. function input parameter)
"type": "object",
"properties": {
"type": {
"$ref": "#/$defs/primitives"
}
},
"required": ["type"],
"additionalProperties": false,
"if": {
"properties": {
"type": {
"const": "string"
}
}
},
"then": {
// String values can optionally be constrained to a known list
"properties": {
"enum": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
},
"type": "object",
"properties": {
"$schema": {
// Explicitly allow JSON-Schema to be referenced (due to additionalProperties: false)
"type": "string",
"format": "uri"
},
"name": {
"type": "string",
"description": "The tool name"
},
"description": {
"type": "string",
"description": "A human-readable description of the tool and when to use it"
},
"version": {
"type": "string",
"pattern": "^[a-f0-9]{7,40}$", // SHA version pattern (7-40 hexadecimal characters)
"description": "An identifier for this version of the tool"
},
"input": {
"type": "object",
"properties": {
"parameters": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"name": {
"description": "The human-readable name of this parameter.",
"type": "string"
},
"required": {
"description": "Whether this parameter is required (true) or optional (false).",
"type": "boolean"
},
"description": {
"description": "A descriptive, human-readable explanation of the parameter.",
"type": "string"
},
"schema": {
"$ref": "#/$defs/value_schema"
},
"inferrable": {
"type": "boolean",
"description": "Whether a value for this parameter can be inferred by a model. Defaults to `true`.",
"default": true
}
},
"required": ["name", "required", "schema"],
"additionalProperties": false
}
}
},
"required": ["parameters"],
"additionalProperties": false
},
"output": {
"type": "object",
"properties": {
"available_modes": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"enum": ["value", "error", "null", "artifact", "requires_authorization"]
}
},
"value": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"schema": {
"$ref": "#/$defs/value_schema"
}
},
"required": ["schema"],
"additionalProperties": false
}
},
"required": ["available_modes"],
"additionalProperties": false
},
"requirements": {
"type": "object",
"properties": {
"authorization": {
"oneOf": [
{
"type": "string",
"enum": ["none", "token"]
},
{
"type": "object",
"properties": {
"oauth2": {
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"scope": {
"type": "string"
}
},
"required": ["url"],
"additionalProperties": false
}
},
"required": ["oauth2"],
"additionalProperties": false
}
]
}
}
}
},
"required": ["name", "version", "input", "output"],
"additionalProperties": false
}