OSS-first docs

These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.

agent.tool.create

Creates a new AI tool definition.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @agent-console-team
  • Tags: tool, create
  • File: packages/examples/agent-console/src/tool/tool.operation.ts
  • field.key.label
    agent.tool.create
    field.version.label
    1.0.0
    field.type.label
    operation (command)
    field.title.label
    agent.tool.create
    field.description.label

    Creates a new AI tool definition.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @agent-console-team
  • Tags: tool, create
  • File: packages/examples/agent-console/src/tool/tool.operation.ts
  • field.tags.label
    tool,create
    field.owners.label
    @agent-console-team
    field.stability.label
    stable

    Creates a new AI tool definition.

    Goal

    Allow users to define new tools that agents can use.

    Context

    Called from the tool builder UI when creating a new tool.

    Source Definition

    import {
    	defineCommand,
    	defineQuery,
    } from '@lssm-tech/lib.contracts-spec/operations';
    import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
    import { ToolCategoryEnum, ToolStatusEnum } from './tool.enum';
    import {
    	CreateToolInputModel,
    	ToolModel,
    	ToolSummaryModel,
    	UpdateToolInputModel,
    } from './tool.schema';
    
    export const CreateToolCommand = defineCommand({
    	meta: {
    		key: 'agent.tool.create',
    		version: '1.0.0',
    		stability: 'stable',
    		owners: ['@agent-console-team'],
    		tags: ['tool', 'create'],
    		description: 'Creates a new AI tool definition.',
    		goal: 'Allow users to define new tools that agents can use.',
    		context: 'Called from the tool builder UI when creating a new tool.',
    	},
    	io: {
    		input: CreateToolInputModel,
    		output: defineSchemaModel({
    			name: 'CreateToolOutput',
    			fields: {
    				id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
    				name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
    				slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
    				status: { type: ToolStatusEnum, isOptional: false },
    			},
    		}),
    		errors: {
    			SLUG_EXISTS: {
    				description: 'A tool with this slug already exists in the organization',
    				http: 409,
    				gqlCode: 'SLUG_EXISTS',
    				when: 'Slug is already taken',
    			},
    		},
    	},
    	policy: { auth: 'user' },
    	sideEffects: {
    		emits: [
    			{
    				key: 'tool.created',
    				version: '1.0.0',
    				stability: 'stable',
    				owners: ['@agent-console-team'],
    				tags: ['tool', 'created'],
    				when: 'Tool is successfully created',
    				payload: ToolSummaryModel,
    			},
    		],
    		audit: ['tool.created'],
    	},
    	acceptance: {
    		scenarios: [
    			{
    				key: 'create-tool-happy-path',
    				given: ['User is authenticated', 'Organization exists'],
    				when: ['User submits valid tool configuration'],
    				then: ['New tool is created', 'ToolCreated event is emitted'],
    			},
    			{
    				key: 'create-tool-slug-conflict',
    				given: ['Tool with same slug exists'],
    				when: ['User submits tool with duplicate slug'],
    				then: ['SLUG_EXISTS error is returned'],
    			},
    		],
    		examples: [
    			{
    				key: 'create-api-tool',
    				input: {
    					name: 'Weather API',
    					slug: 'weather-api',
    					category: 'api',
    					description: 'Fetches weather data',
    				},
    				output: {
    					id: 'tool-123',
    					name: 'Weather API',
    					slug: 'weather-api',
    					status: 'draft',
    				},
    			},
    		],
    	},
    });