MCPcopy Create free account
hub / github.com/cloudflare/mcp / cloudflareTypesForAccount

Function cloudflareTypesForAccount

src/tools/execute.ts:211–237  ·  view source on GitHub ↗

* The `CLOUDFLARE_TYPES` block plus a per-session comment describing how * `accountId` is resolved for this token (pinned, single account, or chosen * per call).

(props?: AuthProps)

Source from the content-addressed store, hash-verified

209 * per call).
210 */
211function cloudflareTypesForAccount(props?: AuthProps): string {
212 // Single-account user token: name the account so the LLM can confirm it.
213 if (isSingleAccountUser(props)) {
214 return (
215 CLOUDFLARE_TYPES +
216 `\n// accountId is pre-set to "${props.accounts[0].id}" (${props.accounts[0].name}) — use it directly in API paths.\n`
217 )
218 }
219
220 // Any other pinned account id (account-scoped token).
221 const pinnedAccountId = autoResolvedAccountId(props)
222 if (pinnedAccountId) {
223 return (
224 CLOUDFLARE_TYPES +
225 `\n// accountId is pre-set to "${pinnedAccountId}" — use it directly in API paths.\n`
226 )
227 }
228
229 if (isMultiAccountUser(props)) {
230 return (
231 CLOUDFLARE_TYPES +
232 `\n// accountId is set from the optional account_id tool argument. Reading it before selecting an account throws an error.\n`
233 )
234 }
235
236 return CLOUDFLARE_TYPES
237}
238
239/**
240 * Description for the `execute` tool, including the per-session Cloudflare type

Callers 1

executeToolDescriptionFunction · 0.85

Calls 3

isSingleAccountUserFunction · 0.90
autoResolvedAccountIdFunction · 0.90
isMultiAccountUserFunction · 0.90

Tested by

no test coverage detected