Estimated reading time: 4 minutes Updated: 7/22/2026 Created by: Botmaker Team

How to create an MCP-type code action

MCP (Model Context Protocol) code actions allow you to define custom functions that agents can execute in a structured way that AI models can understand.



CREATE AN MCP CODE ACTION

  1. Go to the "Code" section in the left sidebar.



  1. Click Create New Code Action.



  1. Choose the AI Function type



  1. A base template will be generated with the minimum required structure.



When you click "Save," the action will be published automatically.


 Required structure

Every MCP action must meet the following conditions:

Element

Description

A single default exported function

There must be a single export default function.

Defined parameters

Each parameter must have a name, data type, and description.

JSDoc documentation

The function and its parameters must be documented using the standard JSDoc format.


Basic example

/**

 * this function multiply by 2

 * 

 * @param myNumber the number to multiply by 2

 * 

 * @return the double

 */

export default function double(myNumber: number): number {

  return myNumber * 2;

}


EXAMPLE BREAKDOWN:

Element

Description

/** ... */

Indicates the JSDoc documentation block.

this function multiply by 2

General description of the function. Explains what it does.

@param myNumber the number to multiply by 2

Parameter: name (myNumber), type (number), and description.

@return the double

Return value: explains what the function returns.

export default function double(...)

Defines the single exported function that the MCP code will run.


Recommendations

  • Always include a clear description of the function and each parameter.
  • Use simple, expressive names (in English or Spanish, according to internal standards).
  • Test your code with simple examples before implementing it in production.
  • If you get an error, check that your function meets all the points above.

CURRENT Limitations (beta MODE)

  • Only works with models compatible with MCP (ChatGPT-4).
  • Other functions cannot be imported.
  • Some environment features are not yet available.

Important

MCP-type code actions are available in beta mode. Their functionality may change in future versions.


Remember to visit our Help Center for further information.




Botmaker Team