Skip to content

Documentation / @agentick/core / MCPComponentProps

Interface: MCPComponentProps

Defined in: core/src/mcp/mcp-component.tsx:33

Extends

  • ComponentBaseProps.Partial<EngineComponent>

Properties

key?

optional key: string | number

Defined in: core/src/jsx/jsx-types.ts:22

Key for React-like reconciliation (optional). Used by compiler to track component instances across renders.

Inherited from

ComponentBaseProps.key


listResourcesToolName?

optional listResourcesToolName: string

Defined in: core/src/mcp/mcp-component.tsx:57

Custom resource tool names.


name?

optional name: string

Defined in: core/src/component/component.ts:179

Inherited from

Partial.name


onAfterCompile()?

optional onAfterCompile: (ctx, compiled, state, afterCompileCtx) => void | Promise<void>

Defined in: core/src/component/component.ts:236

Called after each compilation pass, before the final render is applied. Use this to inspect the compiled structure and potentially request re-compilation if state changes are needed (e.g., context summarization, tool adjustments).

The compilation loop continues until no component calls ctx.requestRecompile() or the maximum iteration limit is reached.

Parameters

ctx

ContextObjectModel

The persistent Context Object Model for this execution.

compiled

CompiledStructure

The compiled structure from this compilation pass.

state

TickState

Current tick state.

afterCompileCtx

AfterCompileContext

Context containing iteration metadata.

Returns

void | Promise<void>

Inherited from

Partial.onAfterCompile


onComplete()?

optional onComplete: (ctx, finalState) => void | Promise<void>

Defined in: core/src/component/component.ts:264

Called after the entire execution completes (all ticks finished). At this point, the final COMInput is available. Use this for final state processing, persistence, reporting, side effects, etc. Called before onUnmount.

Note: This is for side effects only, not rendering. Rendering should happen in render(). Model outputs are automatically included in the final COM state.

Parameters

ctx

ContextObjectModel

The persistent Context Object Model for this execution.

finalState

COMInput

The final COMInput state after all ticks.

Returns

void | Promise<void>

Inherited from

Partial.onComplete


onError()?

optional onError: (ctx, state) => void | RecoveryAction | Promise<void | RecoveryAction>

Defined in: core/src/component/component.ts:305

Called when an error occurs during engine execution. Components can use this to handle errors and potentially recover.

Parameters

ctx

ContextObjectModel

The persistent Context Object Model for this execution.

state

TickState

Current tick state including error information.

Returns

void | RecoveryAction | Promise<void | RecoveryAction>

RecoveryAction to indicate whether to continue execution, or void/undefined to let error propagate

Inherited from

Partial.onError


onMessage()?

optional onMessage: (ctx, message, state) => void | Promise<void>

Defined in: core/src/component/component.ts:295

Called immediately when a message is sent to the running execution.

Messages can arrive via:

  • RuntimeSession.sendMessage() - Direct programmatic injection
  • ExecutionHandle.send() - Via handle reference
  • Channel events with type='message' - From client

This hook is called immediately when the message arrives, not at tick boundaries. Use ctx.abort() to interrupt execution if needed, or update state for the next tick. Messages are also available in TickState.queuedMessages during render.

Parameters

ctx

ContextObjectModel

The persistent Context Object Model for this execution.

message

ExecutionMessage

The message sent to the execution.

state

TickState

Current tick state.

Returns

void | Promise<void>

Example

typescript
class InteractiveAgent extends Component {
  onMessage(ctx, message, state) {
    if (message.type === 'stop') {
      ctx.abort('User requested stop');
    } else if (message.type === 'feedback') {
      ctx.setState('userFeedback', message.content);
    }
  }
}

Inherited from

Partial.onMessage


onMount()?

optional onMount: (ctx) => void | Promise<void>

Defined in: core/src/component/component.ts:194

Called when the component is mounted to the engine. Use this to register static resources like tools.

Parameters

ctx

ContextObjectModel

The persistent Context Object Model for this execution.

Returns

void | Promise<void>

Inherited from

Partial.onMount


onStart()?

optional onStart: (ctx) => void | Promise<void>

Defined in: core/src/component/component.ts:207

Called once before the first tick, after the COM is created. Use this for initialization that needs to happen before execution starts.

Parameters

ctx

ContextObjectModel

The persistent Context Object Model for this execution.

Returns

void | Promise<void>

Inherited from

Partial.onStart


onTickEnd()?

optional onTickEnd: (ctx, state) => void | Promise<void>

Defined in: core/src/component/component.ts:251

Called after model execution completes for this tick. At this point, current is available (contains model outputs from this tick). Use this for per-tick processing, validation, or side effects. Note: Model outputs are automatically included in the next tick's previous.

Parameters

ctx

ContextObjectModel

The persistent Context Object Model for this execution.

state

TickState

Current tick state including previous and current.

Returns

void | Promise<void>

Inherited from

Partial.onTickEnd


onTickStart()?

optional onTickStart: (ctx, state) => void | Promise<void>

Defined in: core/src/component/component.ts:209

Parameters

ctx

ContextObjectModel

state

TickState

Returns

void | Promise<void>

Inherited from

Partial.onTickStart


onUnmount()?

optional onUnmount: (ctx) => void | Promise<void>

Defined in: core/src/component/component.ts:200

Called when the component is unmounted from the engine.

Parameters

ctx

ContextObjectModel

The persistent Context Object Model for this execution.

Returns

void | Promise<void>

Inherited from

Partial.onUnmount


readResourceToolName?

optional readResourceToolName: string

Defined in: core/src/mcp/mcp-component.tsx:58


ref?

optional ref: string

Defined in: core/src/jsx/jsx-types.ts:16

Reference name for accessing this component instance. Use ctx.getRef<ComponentType>('myRef') to access the instance.

Example

tsx
<Harness ref="myHarness" component={MyAgent} props={input} />
const harness = ctx.getRef<HarnessComponent>('myHarness');

Inherited from

ComponentBaseProps.ref


render()?

optional render: (ctx, state) => void | Element | Promise<void | Element | null> | null

Defined in: core/src/component/component.ts:218

Declaratively render context for the current tick. Components should interact with the COM to compose the context. OR return a Virtual DOM tree (JSX.Element) to be rendered by the Engine.

Parameters

ctx

ContextObjectModel

The persistent Context Object Model for this execution.

state

TickState

Current tick state including input and previous render.

Returns

void | Element | Promise<void | Element | null> | null

Inherited from

Partial.render


servers

servers: Record<string, MCPServerConfig | MCPConfig>

Defined in: core/src/mcp/mcp-component.tsx:39

MCP servers to connect to.

Map of server name → config. Supports Cursor-style or full MCPConfig.


tool?

optional tool: ExecutableTool<(input, ctx?) => ContentBlock[] | Promise<ContentBlock[]>>

Defined in: core/src/component/component.ts:187

The channels declaration for the component. Components can declare channels to publish and subscribe to.

Inherited from

Partial.tool


toolFilter?

optional toolFilter: Record<string, { exclude?: string[]; include?: string[]; prefix?: string; }>

Defined in: core/src/mcp/mcp-component.tsx:45

Tool filtering per server. Key is server name, value is include/exclude lists.

Released under the ISC License.