MCPcopy
hub / github.com/codeaashu/claude-code / call

Function call

src/tools/RemoteTriggerTool/RemoteTriggerTool.ts:78–151  ·  view source on GitHub ↗
(input: Input, context: ToolUseContext)

Source from the content-addressed store, hash-verified

76 return PROMPT
77 },
78 async call(input: Input, context: ToolUseContext) {
79 await checkAndRefreshOAuthTokenIfNeeded()
80 const accessToken = getClaudeAIOAuthTokens()?.accessToken
81 if (!accessToken) {
82 throw new Error(
83 'Not authenticated with a claude.ai account. Run /login and try again.',
84 )
85 }
86 const orgUUID = await getOrganizationUUID()
87 if (!orgUUID) {
88 throw new Error('Unable to resolve organization UUID.')
89 }
90
91 const base = `${getOauthConfig().BASE_API_URL}/v1/code/triggers`
92 const headers = {
93 Authorization: `Bearer ${accessToken}`,
94 'Content-Type': 'application/json',
95 'anthropic-version': '2023-06-01',
96 'anthropic-beta': TRIGGERS_BETA,
97 'x-organization-uuid': orgUUID,
98 }
99
100 const { action, trigger_id, body } = input
101 let method: 'GET' | 'POST'
102 let url: string
103 let data: unknown
104 switch (action) {
105 case 'list':
106 method = 'GET'
107 url = base
108 break
109 case 'get':
110 if (!trigger_id) throw new Error('get requires trigger_id')
111 method = 'GET'
112 url = `${base}/${trigger_id}`
113 break
114 case 'create':
115 if (!body) throw new Error('create requires body')
116 method = 'POST'
117 url = base
118 data = body
119 break
120 case 'update':
121 if (!trigger_id) throw new Error('update requires trigger_id')
122 if (!body) throw new Error('update requires body')
123 method = 'POST'
124 url = `${base}/${trigger_id}`
125 data = body
126 break
127 case 'run':
128 if (!trigger_id) throw new Error('run requires trigger_id')
129 method = 'POST'
130 url = `${base}/${trigger_id}/run`
131 data = {}
132 break
133 }
134
135 const res = await axios.request({

Callers

nothing calls this directly

Calls 5

getOrganizationUUIDFunction · 0.85
getOauthConfigFunction · 0.85
jsonStringifyFunction · 0.85
requestMethod · 0.45

Tested by

no test coverage detected