@conveniencepro/ctp-spec
v1.0.0
Published
ConveniencePro Tool Protocol (CTP) Specification
Maintainers
Readme
@conveniencepro/ctp-spec
Formal specification and JSON schemas for the ConveniencePro Tool Protocol (CTP).
Overview
This package contains:
- SPEC.md - Complete protocol specification
- JSON Schemas - Validation schemas for all CTP documents
- Type Constants - Standard values and type definitions
Installation
npm install @conveniencepro/ctp-spec
# or
yarn add @conveniencepro/ctp-specJSON Schemas
Tool Definition Schema
Validates tool definition documents:
{
"$ref": "https://conveniencepro.cc/schemas/tool-definition.schema.json"
}Tool Result Schema
Validates tool execution results:
{
"$ref": "https://conveniencepro.cc/schemas/tool-result.schema.json"
}CTP Manifest Schema
Validates service manifests:
{
"$ref": "https://conveniencepro.cc/schemas/ctp-manifest.schema.json"
}Embed Config Schema
Validates embed configurations:
{
"$ref": "https://conveniencepro.cc/schemas/embed-config.schema.json"
}Usage
Using with AJV
import Ajv from 'ajv';
import toolDefinitionSchema from '@conveniencepro/ctp-spec/schemas/tool-definition.schema.json';
const ajv = new Ajv();
const validate = ajv.compile(toolDefinitionSchema);
const isValid = validate(myToolDefinition);
if (!isValid) {
console.error(validate.errors);
}Importing Constants
import {
CTP_SPEC_VERSION,
FIELD_TYPES,
CATEGORIES,
ERROR_CODES,
} from '@conveniencepro/ctp-spec';
// Type-safe field type
const fieldType: FieldType = 'textarea';
// All standard categories
console.log(CATEGORIES);
// ['formatters', 'encoders', 'generators', ...]Schema Files
| File | Description |
|------|-------------|
| tool-definition.schema.json | Complete tool definition validation |
| tool-result.schema.json | Tool execution result format |
| ctp-manifest.schema.json | Service manifest format |
| embed-config.schema.json | Embed configuration options |
Specification
The complete CTP specification is available in SPEC.md.
Quick Reference
Field Types:
text,textarea,number,boolean,selectjson,file,color,date,datetime,url,email
Categories:
formatters,encoders,generators,convertersvalidators,analyzers,editors,utilities
Execution Modes:
client- Browser-only executionserver- Server-required executionhybrid- Either environment
Error Codes:
INVALID_INPUT,MISSING_REQUIRED,TYPE_ERRORCONSTRAINT_VIOLATION,EXECUTION_ERROR,TIMEOUTRATE_LIMITED,UNAUTHORIZED,NOT_FOUND,INTERNAL_ERROR
Related Packages
@conveniencepro/ctp-core- Core types and validation@conveniencepro/ctp-runtime- Execution runtime@conveniencepro/ctp-discovery- Discovery generators@conveniencepro/ctp-sdk- Embeddable SDK
License
MIT © ConveniencePro
