이 문서에서는 필요한 데이터를 추출하여 작업 플로우의 나중 단계에서 사용할 수 있도록 사용자 지정 코드를 사용하여 MCP 작업의 출력을 처리합니다. MCP 서버가 각 도구가 리턴하는 데이터를 항상 정의하는 것은 아니므로 MCP 도구의 출력을 사용하기 위해 약간의 추가 작업이 필요할 수도 있습니다. 이 사용법에서 그 방법을 설명합니다. 이 문서의 예에서는 Asana를 사용하지만 MCP 서버에서 리턴한 개체에도 동일한 접근 방식이 적용됩니다.
이 문서에서는 다음과 같은 주제를 다룹니다.
고려 사항
이 튜토리얼에서는 작업 플로우와 MCP에 어느 정도 익숙하다고 가정합니다. 작업 플로우 및 작업 빌더를 처음 사용하는 경우에는 다음을 참조하세요.
사용법: 작업 플로우에서 MCP 도구의 개체 처리하기
다음 단계는 MCP 작업을 테스트하여 어떤 데이터를 리턴하는지 확인하고 사용자 지정 코드 단계를 사용하여 JSON 개체를 작업 플로우의 나중 단계에서 사용할 수 있는 개별 필드로 전환하는 방법을 설명합니다.
-
MCP 서버 연결 .
이 예에서는 Asana의 MCP 서버를 사용합니다.
- 작업 플로우를 만들거나 편집합니다.
- 작업 플로우 트리거를 추가한 후 MCP 도구를 작업 플로우의 단계로 추가합니다 .
- 저장을 클릭합니다.
-
작업 플로우를 테스트합니다.
테스트가 성공적으로 완료되면 화살표를 클릭하여 MCP 단계 출력을 확장합니다.

- MCP 단계의 출력을 검토하여 사용하려는 데이터를 식별합니다. 이 예에서 Get 프로젝트 작업은 다음과 유사한 JSON 개체를 리턴합니다.
{ "archived": false, "color": "purple", "completed": false, "completed_at": null, "created_at": "2026-04-28T02:58:53.099Z", "current_status": { "gid": "1234535757412345", "modified_at": "2026-04-28T04:39:04.032Z", "resource_type": "project_status", "text": "Summary\n\nFollowing on from the successful robot uprising, a T800 infiltration unit has been built and dispatched to 1984 in search of Sarah Connor.\n\n----------------------------------------\n\n\n", "title": "Operation Cyberdyne - Apr 28" }, "custom_fields": [], "name": "Operation Cyberdyne", "notes": "" }이 예에서는 그러한 특성 중 다음 3개만 필요합니다.namecurrent_status.textcurrent_status.modified_at
-
작업 플로우에 사용자 지정 코드 단계를 추가하여 MCP 응답과 필요한 특정 값을 처리하세요.다음 예는 Asana에서 Get 프로젝트 단계의 출력을 가져와서 나머지 작업 플로우에 필요한 3개의 필드를 추출합니다. 이 예를 자체 사용자 지정 코드의 시작점으로 사용하거나 AI 사용하여 사용자 지정 코드 단계를 작성하는 데 도움을 줄 수 있습니다.
module.exports = (inputs) => { // This code takes an object input named 'output' // and returns 'name', 'current_status_modified_at', and 'current_status_text'. // If any property is missing or invalid, the code returns an empty string. // Make sure to create the following inputs: // output (object) - stringified object or actual object // Accept 'output' either as a stringified JSON object or as an object. let outputObj; if (typeof inputs.output === 'string') { try { outputObj = JSON.parse(inputs.output); } catch { outputObj = {}; } } else if (typeof inputs.output === 'object' && inputs.output !== null) { outputObj = inputs.output; } else { outputObj = {}; } const name = typeof outputObj.name === 'string' ? outputObj.name : ""; const current_status_modified_at = outputObj.current_status && typeof outputObj.current_status.modified_at === 'string' ? outputObj.current_status.modified_at : ""; const current_status_text = outputObj.current_status && typeof outputObj.current_status.text === 'string' ? outputObj.current_status.text : ""; // Make sure to create the following outputs: // name (Text) // current_status_modified_at (Date and time) // current_status_text (Text) return { name, current_status_modified_at, current_status_text }; }; - 작업 플로우를 완료하는 데 필요한 모든 추가 단계를 추가합니다. 예를 들어, 다음과 같은 작업을 수행하고자 할 수 있습니다.
- 다음을 사용하세요. Zendesk: 티켓 업데이트 티켓 댓글에 값을 추가하거나, 외부 작업: Slack: 메시지 게시 작업을 통해 추출된 값으로 Slack 의 채널에 메시지를 보낼 수 있습니다.
- 값을 사용자 지정 작업을 위한 입력으로 사용합니다.
- (플로우에서 요청 시 실행 작업 플로우 트리거를 사용하는 경우에만) 출력 보내기 단계를 사용하여 추출된 값을 자동 지원 에 보냅니다.
- 작업 플로우를 저장하고 테스트합니다.
- 작업 플로우를 사용할 준비가 되었으면 활성화를 클릭합니다.
AI 사용하여 사용자 지정 코드 작성하기
전체 테스트 출력을 선호하는 AI 도구에 붙여넣고 사용자 지정 코드 작성을 도와달라고 요청할 수 있습니다. 다음은 시작하기 위한 프롬프트입니다.
Write JavaScript code that exports a function taking an inputs object and returning an outputs object. For example:
module.exports = (inputs) => {
let msg = "Your text was " + inputs.inputText + "."
return {
outputMessage: msg
}
}
Supported data types:
Strings, numbers, booleans, dates (YY-MM-DD), datetimes (YY-MM-DDTHH:mm:SSZ), objects, and arrays are supported.
Arrays must contain only one data type.
Arrays of arrays, arrays of objects, and mixed-type arrays are not supported.
If these are used as inputs or outputs, they must be stringified and passed as strings.
Handle missing data:
Check for missing or invalid data and handle it gracefully by returning valid default values:
- strings: ""
- numbers: -1
- booleans: false
- arrays: []
- objects: {}
Comment the code:
Include a brief comment at the top describing what the code does.
Add comments telling the reader to create the inputs and outputs, for example:
// Make sure to create the following inputs: field_tag (Text)
In comments, use these friendly names for data types:
- string: use "Date" for dates, "Date and time" for datetimes, otherwise "Text"
- number: use "Number" or "Decimal"
- boolean: use "True/False"
- array: use "Number array", "Text array", and so on
Code functionality:
The code should take an input like the example below and ...
<DESCRIBE WHAT YOU WANT YOUR CODE TO DO HERE>
<PASTE YOUR TEST OUTPUT HERE - BE MINDFUL OF PASSING SENSITIVE DATA TO AN AI>
번역 고지 사항: 본 문서는 콘텐츠에 대한 기본적인 이해를 제공하기 위해 자동 번역 소프트웨어를 사용하여 번역되었습니다. 정확한 번역을 제공하고자 합당한 노력을 기울였으나 Zendesk는 번역의 정확성을 보장하지 않습니다.
번역된 문서에 포함된 정보의 정확성과 관련하여 질문이 있으시면 문서의 공식 버전인 영문 버전을 참조하시기 바랍니다.