Skip to main content
Glama

businessobject-function-update

Create or update JavaScript functions in server-side Business Objects to implement custom business logic and integrate with connectors or other business objects.

Instructions

#Create or update a Business Object Function

Creates or updates a JavaScript function within a server-side Business Object. Functions contain business logic code and can call connectors or other business objects.

Common Base Data Type IDs:

  • String: "22ED1F787B6B0926AB0577860AF7543705341C053EB1B4A74E7CC199A0645E52"

  • Integer: "B9B1191E0B70BA0845CF4F6A4F4C017594F8BA84FD2F1849966081D53A8C836D"

  • Boolean: "2788FB5AA776C62635F156C820190D0FD3D558765201881A77382093F7248B39"

  • Date: "06A9841478D7BE17C423F11C38CD6829E372093DBEC144F2A85FC7165BE8CD80"

  • Float: "C09139C72F5A8A7E0036BA66CE301748BD617F463683EE03F92EDAAAA4AF8BC7"

  • Any: "D31053204B4A612390A2D6ECDF623E979C14ADC070A7CB9B08B2099C3011BCAB"

Parameter Structure: Each parameter needs name, dataTypeId, and isOptional. Description and alias are optional.

Code: Standard JavaScript code.

Parameter access in the code: Input parameters can be accessed with let myVar = input.parameter_name; Output parameters can be assigned with output.parameter_name = someOfMyResults; Attention: In case an alias is defined for a parameter, you have use "alias" instead of "parameter_name". Example: output.alias = someOfMyResults; You can do an early return of output, but you don't need to end with a return. The function code will be postfixed with a "return output" anyway. If you do a return instead of return output, then in the first case you will return undefined output parameters - this is most probably not what you want to do.

Business Objects Development Guide

Overview

This guide provides comprehensive information for implementing Business Object functions in Simplifier, including Object API usage, connector access patterns, and Business Object to Business Object communication.

Server-Side Business Object API

The Simplifier object provides access to various server-side methods and components:

Available Components

  • Logging: Server-side logging capabilities e.g. Simplifier.Log.info("my log") - see details: simplifier://documentation/server-businessobjects/api/Logging

  • Utilities/Tools: Helper functions and tools - see details: simplifier://documentation/server-businessobjects/api/Utils

  • Connectors: Access to data connectors - TODO add information later

  • Business Objects: Access to other Business Objects - see this description

  • Users: User management - see details: simplifier://documentation/server-businessobjects/api/User

Simplifier.Log.info(...) is logging to a Simplifier Log inside the database. The logged entries can be seen by the user but cannot be accessed by this MCP so far. console.log(...) is logging to the Simplifier logfile. The logged entries can be accessed by Simplifier Administrators only. The MCP cannot access these logs.

Accessing Other Business Objects

Basic Syntax

// Access other Business Objects
Simplifier.BusinessObject.<BOName>.<MethodName>(payload?)

// Access current Business Object methods
Simplifier.CurrentBusinessObject.<MethodName>(payload?)

// Access connector calls (find the available connector calls via resources)
Simplifier.Connector.<ConnectorName>.<ConnectorCallName>(payload?)

Examples

// Call another Business Object function
var userInfo = Simplifier.BusinessObject.UserManager.getUserById({
  userId: "12345"
});

// Call a function in the current Business Object
var result = Simplifier.CurrentBusinessObject.validateInput({
  data: input.userData
});

Configuration Requirements

Adding Dependencies

When accessing other Business Objects or connectors from a Business Object function, these components MUST be added as dependencies. (see schema for tool about getting, updating and creating Business Objects)

Dependency Types

  • Business Objects: Other BOs that will be called

  • Connectors: Data connectors that will be accessed

Dynamic Access Methods

Variables Approach

// Using variables for dynamic calls
var boName = "UserManager";
var methodName = "getUser";
var result = Simplifier.BusinessObject[boName][methodName](payload);

Dynamic Call Function

// Using dynamic call patterns
var result = Simplifier.BusinessObject.call(boName, methodName, payload);

Parameter Validation

// Always validate input parameters
if (!input.userId || input.userId.length === 0) {
  output.error = "UserId is required";
  return output;
}

var userResult = Simplifier.BusinessObject.UserService.getUser({
  userId: input.userId
});

Security Considerations

  • Always validate input parameters

  • Validate data types and ranges for all inputs

Performance Tips

  • Cache frequently accessed data when appropriate

  • Avoid unnecessary nested Business Object calls

Debugging Tips

  • To track down an issue (e.g. the connector issue) put the failing part into a very small bo function and return the result with JSON.stringify as a string, then you can check, whether the expected result is delivered. Indicate in the name of the function, that it can be deleted after debugging.


This documentation provides the essential patterns and best practices for implementing robust Business Object functions in Simplifier. Remember to always add dependencies and follow security best practices when accessing external components. Dependencies for yourself do not need to be added, but you can access own functions like Simplifier.CurrentBusinessObject.(payload?).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
businessObjectNameYes
functionNameYes
descriptionNo
codeNoJavaScript function codereturn {};
validateInNoIf true, validates that all mandatory input parameters are present before execution. Catches missing parameters early with clear validation errors (HTTP 422). If false, allows incomplete requests through, resulting in backend errors (HTTP 500).
validateOutNoIf true, validates and filters the output response against the defined datatype structure, returning only defined fields. If false, returns the complete raw API response without filtering or validation.
inputParametersNo
outputParametersNo

Implementation Reference

  • The handler function that implements the core logic for the 'businessobject-function-update' tool. It fetches existing function if any, prepares the function data including parameters mapping, and calls create or update on SimplifierClient.
    }, async ({ businessObjectName, functionName, description, code, validateIn, validateOut, inputParameters, outputParameters }) => {
      return wrapToolResult(`create or update Business Object function ${businessObjectName}.${functionName}`, async () => {
        const trackingKey = trackingToolPrefix + toolNameBusinessObjectFunctionUpdate
        let oExisting: any;
        try {
          oExisting = await simplifier.getServerBusinessObjectFunction(businessObjectName, functionName, trackingKey);
        } catch { }
    
        const functionData: SimplifierBusinessObjectFunction = {
          businessObjectName,
          name: functionName,
          description,
          validateIn,
          validateOut,
          inputParameters: (inputParameters || []).map(p => ({
            name: p.name,
            description: p.description || "",
            alias: p.alias || p.name,
            dataTypeId: p.dataTypeId,
            dataType: null,
            isOptional: p.isOptional || false
          })),
          outputParameters: (outputParameters || []).map(p => ({
            name: p.name,
            description: p.description || "",
            alias: p.alias || p.name,
            dataTypeId: p.dataTypeId,
            dataType: null,
            isOptional: p.isOptional || false
          })),
          functionType: "JavaScript",
          code
        };
    
        if (oExisting) {
          return simplifier.updateServerBusinessObjectFunction(businessObjectName, functionName, functionData);
        } else {
          return simplifier.createServerBusinessObjectFunction(businessObjectName, functionData);
        }
      });
    });
  • The Zod schema defining the input parameters for the 'businessobject-function-update' tool, including business object name, function name, code, validation flags, and input/output parameters structures.
    {
      businessObjectName: z.string(),
      functionName: z.string(),
      description: z.string().optional().default(""),
      code: z.string().optional().default("return {};").describe("JavaScript function code"),
      validateIn: z.boolean().optional().default(false)
        .describe(`If true, validates that all mandatory input parameters are present before execution. Catches missing parameters early with clear validation errors (HTTP 422). If false, allows incomplete requests through, resulting in backend errors (HTTP 500).`),
      validateOut: z.boolean().optional().default(false)
        .describe(`If true, validates and filters the output response against the defined datatype structure, returning only defined fields. If false, returns the complete raw API response without filtering or validation.`),
      inputParameters: z.array(z.object({
        name: z.string(),
        description: z.string().optional().default(""),
        alias: z.string().optional().default(""),
        dataTypeId: z.string().default("D31053204B4A612390A2D6ECDF623E979C14ADC070A7CB9B08B2099C3011BCAB"),
        isOptional: z.boolean().optional().default(false)
      })).optional().default([]),
      outputParameters: z.array(z.object({
        name: z.string(),
        description: z.string().optional().default(""),
        alias: z.string().optional().default(""),
        dataTypeId: z.string().default("D31053204B4A612390A2D6ECDF623E979C14ADC070A7CB9B08B2099C3011BCAB")
          .describe("Initially it could make sense, to give the Any type as output data type, and only later create a fitting datatype, when the output schema is fix."),
        isOptional: z.boolean().optional().default(false)
      })).optional().default([])
    },
    {
  • The registration of the 'businessobject-function-update' tool using McpServer.tool(), including name constant, description reference, input schema, metadata hints, and handler function.
    const toolNameBusinessObjectFunctionUpdate = "businessobject-function-update"
    server.tool(toolNameBusinessObjectFunctionUpdate,
      functionUpdateDescription,
      {
        businessObjectName: z.string(),
        functionName: z.string(),
        description: z.string().optional().default(""),
        code: z.string().optional().default("return {};").describe("JavaScript function code"),
        validateIn: z.boolean().optional().default(false)
          .describe(`If true, validates that all mandatory input parameters are present before execution. Catches missing parameters early with clear validation errors (HTTP 422). If false, allows incomplete requests through, resulting in backend errors (HTTP 500).`),
        validateOut: z.boolean().optional().default(false)
          .describe(`If true, validates and filters the output response against the defined datatype structure, returning only defined fields. If false, returns the complete raw API response without filtering or validation.`),
        inputParameters: z.array(z.object({
          name: z.string(),
          description: z.string().optional().default(""),
          alias: z.string().optional().default(""),
          dataTypeId: z.string().default("D31053204B4A612390A2D6ECDF623E979C14ADC070A7CB9B08B2099C3011BCAB"),
          isOptional: z.boolean().optional().default(false)
        })).optional().default([]),
        outputParameters: z.array(z.object({
          name: z.string(),
          description: z.string().optional().default(""),
          alias: z.string().optional().default(""),
          dataTypeId: z.string().default("D31053204B4A612390A2D6ECDF623E979C14ADC070A7CB9B08B2099C3011BCAB")
            .describe("Initially it could make sense, to give the Any type as output data type, and only later create a fitting datatype, when the output schema is fix."),
          isOptional: z.boolean().optional().default(false)
        })).optional().default([])
      },
      {
        title: "Create or update a Business Object Function",
        readOnlyHint: false,
        destructiveHint: false,
        idempotentHint: false,
        openWorldHint: true
      }, async ({ businessObjectName, functionName, description, code, validateIn, validateOut, inputParameters, outputParameters }) => {
        return wrapToolResult(`create or update Business Object function ${businessObjectName}.${functionName}`, async () => {
          const trackingKey = trackingToolPrefix + toolNameBusinessObjectFunctionUpdate
          let oExisting: any;
          try {
            oExisting = await simplifier.getServerBusinessObjectFunction(businessObjectName, functionName, trackingKey);
          } catch { }
    
          const functionData: SimplifierBusinessObjectFunction = {
            businessObjectName,
            name: functionName,
            description,
            validateIn,
            validateOut,
            inputParameters: (inputParameters || []).map(p => ({
              name: p.name,
              description: p.description || "",
              alias: p.alias || p.name,
              dataTypeId: p.dataTypeId,
              dataType: null,
              isOptional: p.isOptional || false
            })),
            outputParameters: (outputParameters || []).map(p => ({
              name: p.name,
              description: p.description || "",
              alias: p.alias || p.name,
              dataTypeId: p.dataTypeId,
              dataType: null,
              isOptional: p.isOptional || false
            })),
            functionType: "JavaScript",
            code
          };
    
          if (oExisting) {
            return simplifier.updateServerBusinessObjectFunction(businessObjectName, functionName, functionData);
          } else {
            return simplifier.createServerBusinessObjectFunction(businessObjectName, functionData);
          }
        });
      });
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations provide readOnlyHint=false and destructiveHint=false, indicating mutation capability without destruction. The description adds valuable behavioral context beyond annotations: it explains code execution patterns (early returns, automatic postfixing), logging behavior (Simplifier.Log vs console.log differences), dependency requirements, and security/performance considerations. No contradiction with annotations exists.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is excessively long (over 1000 words) and poorly structured. It mixes tool-specific instructions with general development guides, burying critical information. While some content is valuable, much could be trimmed or moved to external documentation. The front-loaded section is useful but followed by extensive tangential material.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (8 parameters, mutation capability, no output schema) and low schema coverage, the description provides comprehensive context: it covers parameter semantics, code patterns, dependencies, security, performance, and debugging. It adequately compensates for missing structured fields, though the excessive length reduces usability.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With only 38% schema description coverage, the description compensates significantly by explaining parameter structure (name, dataTypeId, isOptional), common data type IDs, code parameter access patterns (input/output with alias handling), and validation options (validateIn/validateOut implications). It adds substantial meaning beyond the sparse schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Creates or updates a JavaScript function within a server-side Business Object.' It specifies the verb (create/update), resource (Business Object Function), and scope (server-side). However, it doesn't explicitly differentiate from sibling tools like 'businessobject-function-delete' or 'businessobject-update' beyond the create/update distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through extensive development guidance (e.g., when to use dependencies, parameter validation patterns), but doesn't explicitly state when to choose this tool over alternatives like 'businessobject-update' or 'businessobject-function-test'. It provides best practices rather than direct usage rules.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/simplifier-ag/simplifier-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server