Files
sim/apps/sim/tools/gitlab/create_issue_note.ts
T
Waleed ee7572185a improvement(tools): added visibility for tools that were missing it, added new google and github tools (#2874)
* improvement(tools): added visibility for tools that were missing it, added new google tools

* fixed the name for google forms

* revert schema enrichers change

* fixed block ordering
2026-01-17 20:51:15 -08:00

82 lines
1.9 KiB
TypeScript

import type { GitLabCreateIssueNoteParams, GitLabCreateNoteResponse } from '@/tools/gitlab/types'
import type { ToolConfig } from '@/tools/types'
export const gitlabCreateIssueNoteTool: ToolConfig<
GitLabCreateIssueNoteParams,
GitLabCreateNoteResponse
> = {
id: 'gitlab_create_issue_note',
name: 'GitLab Create Issue Comment',
description: 'Add a comment to a GitLab issue',
version: '1.0.0',
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'GitLab Personal Access Token',
},
projectId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Project ID or URL-encoded path',
},
issueIid: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Issue internal ID (IID)',
},
body: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Comment body (Markdown supported)',
},
},
request: {
url: (params) => {
const encodedId = encodeURIComponent(String(params.projectId))
return `https://gitlab.com/api/v4/projects/${encodedId}/issues/${params.issueIid}/notes`
},
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'PRIVATE-TOKEN': params.accessToken,
}),
body: (params) => ({
body: params.body,
}),
},
transformResponse: async (response) => {
if (!response.ok) {
const errorText = await response.text()
return {
success: false,
error: `GitLab API error: ${response.status} ${errorText}`,
output: {},
}
}
const note = await response.json()
return {
success: true,
output: {
note,
},
}
},
outputs: {
note: {
type: 'object',
description: 'The created comment',
},
},
}