MCPcopy Create free account
hub / github.com/ShipSecAI/studio / resolvePorts

Function resolvePorts

worker/src/components/notification/slack.ts:128–170  ·  view source on GitHub ↗
(params: z.infer<typeof parameterSchema>)

Source from the content-addressed store, hash-verified

126 deprecated: false,
127 },
128 resolvePorts(params: z.infer<typeof parameterSchema>) {
129 const inputShape: Record<string, z.ZodTypeAny> = {
130 text: port(z.string(), { label: 'Message Text' }),
131 blocks: port(z.unknown().optional(), {
132 label: 'Blocks (JSON)',
133 allowAny: true,
134 reason: 'Slack blocks can be raw JSON or string templates.',
135 connectionType: { kind: 'primitive', name: 'json' },
136 }),
137 };
138
139 // Auth specific inputs
140 if (params.authType === 'webhook') {
141 inputShape.webhookUrl = port(z.unknown(), {
142 label: 'Webhook URL',
143 editor: 'secret',
144 allowAny: true,
145 reason: 'Webhook URLs are secrets.',
146 connectionType: { kind: 'primitive', name: 'secret' },
147 });
148 } else {
149 inputShape.slackToken = port(z.unknown(), {
150 label: 'Bot Token',
151 editor: 'secret',
152 allowAny: true,
153 reason: 'Slack bot tokens are secrets.',
154 connectionType: { kind: 'primitive', name: 'secret' },
155 });
156 inputShape.channel = port(z.string(), { label: 'Channel' });
157 inputShape.thread_ts = port(z.string().optional(), { label: 'Thread TS' });
158 }
159
160 // Dynamic variable inputs
161 if (params.variables && Array.isArray(params.variables)) {
162 for (const v of params.variables) {
163 if (!v || !v.name) continue;
164 const { schema, meta } = mapTypeToSchema(v.type || 'json', v.name);
165 inputShape[v.name] = port(schema, meta ?? { label: v.name });
166 }
167 }
168
169 return { inputs: inputs(inputShape) };
170 },
171 async execute({ inputs, params }, context) {
172 const { text, blocks, channel, thread_ts, slackToken, webhookUrl } = inputs as Record<
173 string,

Callers

nothing calls this directly

Calls 3

portFunction · 0.90
inputsFunction · 0.90
mapTypeToSchemaFunction · 0.70

Tested by

no test coverage detected