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.
Assigns a tool to an agent with optional configuration.
Goal
Enable agents to use specific tools.
Context
Agent configuration UI - tool selection.
Source Definition
import {
defineCommand,
defineQuery,
} from '@lssm-tech/lib.contracts-spec/operations';
import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
import { AgentStatusEnum, ModelProviderEnum } from './agent.enum';
import { AgentCreatedEvent } from './agent.event';
import {
AgentSummaryModel,
AgentWithToolsModel,
CreateAgentInputModel,
UpdateAgentInputModel,
} from './agent.schema';
export const AssignToolToAgentCommand = defineCommand({
meta: {
key: 'agent-console.agent.assignTool',
version: '1.0.0',
stability: 'stable',
owners: ['@agent-console-team'],
tags: ['agent', 'tool', 'assign'],
description: 'Assigns a tool to an agent with optional configuration.',
goal: 'Enable agents to use specific tools.',
context: 'Agent configuration UI - tool selection.',
},
io: {
input: defineSchemaModel({
name: 'AssignToolToAgentInput',
fields: {
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
config: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
},
}),
output: defineSchemaModel({
name: 'AssignToolToAgentOutput',
fields: {
agentToolId: {
type: ScalarTypeEnum.String_unsecure(),
isOptional: false,
},
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
},
}),
errors: {
TOOL_ALREADY_ASSIGNED: {
description: 'This tool is already assigned to the agent',
http: 409,
gqlCode: 'TOOL_ALREADY_ASSIGNED',
when: 'Tool assignment already exists',
},
},
},
policy: { auth: 'user' },
sideEffects: { audit: ['agent.tool.assigned'] },
acceptance: {
scenarios: [
{
key: 'assign-tool-happy-path',
given: ['Agent exists', 'Tool exists and is not assigned'],
when: ['User assigns tool to agent'],
then: ['Tool is assigned', 'Assignment ID is returned'],
},
{
key: 'assign-tool-already-assigned',
given: ['Tool is already assigned to agent'],
when: ['User attempts to assign again'],
then: ['TOOL_ALREADY_ASSIGNED error is returned'],
},
],
examples: [
{
key: 'assign-basic',
input: { agentId: 'agent-123', toolId: 'tool-456' },
output: {
agentToolId: 'at-789',
agentId: 'agent-123',
toolId: 'tool-456',
},
},
],
},
});