run_scenario_11652
Run scenarios to add new items to inventory by specifying the item name, enabling AI assistants to trigger automation workflows on the Make MCP Server.
Instructions
Tool: Add to Inventory (Add a new item to the inventory.)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Item name |
Implementation Reference
- src/index.ts:59-87 (handler)Handler for CallToolRequestSchema that matches tool names like 'run_scenario_11652', parses the scenario ID, executes make.scenarios.run, and returns the output or error.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)Registers dynamic tools for on-demand scenarios, naming them 'run_scenario_<id>' (e.g., run_scenario_11652), fetches interface for schema.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, }), }; }), ), }; });
- src/utils.ts:60-108 (schema)Converts Make scenario input spec to JSON schema for tool inputSchema, used dynamically for each scenario including 11652.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), }; } }
- src/make.ts:32-40 (helper)Core helper method in Scenarios class that runs the scenario by POSTing inputs to the Make API endpoint.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', }, });