Skip to main content
Glama

run_scenario_8632

Execute Scenario D - Subscenario by sending text input, enabling AI systems to trigger and interact with automation workflows on the Make MCP Server.

Instructions

Scenario D - Subscenario

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNo

Implementation Reference

  • Executes the 'run_scenario_8632' tool by parsing the scenario ID from the tool name, calling make.scenarios.run(8632, arguments), formatting the outputs as JSON text response, or error message.
    server.setRequestHandler(CallToolRequestSchema, async request => {
        if (/^run_scenario_\d+$/.test(request.params.name)) {
            try {
                const output = (
                    await make.scenarios.run(parseInt(request.params.name.substring(13)), request.params.arguments)
                ).outputs;
    
                return {
                    content: [
                        {
                            type: 'text',
                            text: output ? JSON.stringify(output, null, 2) : 'Scenario executed successfully.',
                        },
                    ],
                };
            } catch (err: unknown) {
                return {
                    isError: true,
                    content: [
                        {
                            type: 'text',
                            text: String(err),
                        },
                    ],
                };
            }
        }
        throw new Error(`Unknown tool: ${request.params.name}`);
    });
  • src/index.ts:37-57 (registration)
    Dynamically registers the 'run_scenario_8632' tool (and others) by listing on-demand scenarios from the Make API, generating name, description, and inputSchema for scenario ID 8632 if present.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
        const scenarios = await make.scenarios.list(teamId);
        return {
            tools: await Promise.all(
                scenarios
                    .filter(scenario => scenario.scheduling.type === 'on-demand')
                    .map(async scenario => {
                        const inputs = (await make.scenarios.interface(scenario.id)).input;
                        return {
                            name: `run_scenario_${scenario.id}`,
                            description: scenario.name + (scenario.description ? ` (${scenario.description})` : ''),
                            inputSchema: remap({
                                name: 'wrapper',
                                type: 'collection',
                                spec: inputs,
                            }),
                        };
                    }),
            ),
        };
    });
  • Converts Make scenario input specification to JSON Schema object used for the tool's inputSchema validation.
    export function remap(field: Input): unknown {
        switch (field.type) {
            case 'collection':
                const required: string[] = [];
                const properties: unknown = (Array.isArray(field.spec) ? field.spec : []).reduce((object, subField) => {
                    if (!subField.name) return object;
                    if (subField.required) required.push(subField.name);
    
                    return Object.defineProperty(object, subField.name, {
                        enumerable: true,
                        value: remap(subField),
                    });
                }, {});
    
                return {
                    type: 'object',
                    description: noEmpty(field.help),
                    properties,
                    required,
                };
            case 'array':
                return {
                    type: 'array',
                    description: noEmpty(field.help),
                    items:
                        field.spec &&
                        remap(
                            Array.isArray(field.spec)
                                ? {
                                      type: 'collection',
                                      spec: field.spec,
                                  }
                                : field.spec,
                        ),
                };
            case 'select':
                return {
                    type: 'string',
                    description: noEmpty(field.help),
                    enum: (field.options || []).map(option => option.value),
                };
            default:
                return {
                    type: PRIMITIVE_TYPE_MAP[field.type as keyof typeof PRIMITIVE_TYPE_MAP],
                    default: field.default != '' && field.default != null ? field.default : undefined,
                    description: noEmpty(field.help),
                };
        }
    }
  • Core helper method invoked to run scenario 8632 by posting input arguments to the Make API endpoint `/scenarios/8632/run`.
    async run(scenarioId: number, body: unknown): Promise<ScenarioRunServerResponse> {
        return await this.#fetch<ScenarioRunServerResponse>(`/scenarios/${scenarioId}/run`, {
            method: 'POST',
            body: JSON.stringify({ data: body, responsive: true }),
            headers: {
                'content-type': 'application/json',
            },
        });
    }
Install Server

Other Tools

Related 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/integromat/make-mcp-server'

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