Skip to content

Commit 4a7e60d

Browse files
committed
Linting fixes + add scopes
1 parent dac4636 commit 4a7e60d

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

apps/dns-analytics/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ export class DNSAnalyticsMCP extends McpAgent<Env, State, Props> {
9494
const AnalyticsScopes = {
9595
...RequiredScopes,
9696
'account:read': 'See your account info such as account details, analytics, and memberships.',
97+
'dns_settings:read': 'See your DNS settings',
98+
'dns_analytics:read': 'See your DNS analytics',
9799
} as const
98100

99101
export default {

apps/dns-analytics/src/tools/analytics.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type { AccountGetParams } from 'cloudflare/resources/accounts/accounts.mjs'
2-
import type { ReportGetParams } from 'cloudflare/resources/dns/analytics.mjs'
3-
import type { ZoneGetParams } from 'cloudflare/resources/dns/settings.mjs'
4-
import type { ZoneListParams } from 'cloudflare/resources/zones/zones.mjs'
51
import { z } from 'zod'
62

73
import { getCloudflareClient } from '@repo/mcp-common/src/cloudflare-api'
84
import { getEnv } from '@repo/mcp-common/src/env'
95

6+
import type { AccountGetParams } from 'cloudflare/resources/accounts/accounts.mjs'
7+
import type { ReportGetParams } from 'cloudflare/resources/dns/analytics.mjs'
8+
import type { ZoneGetParams } from 'cloudflare/resources/dns/settings.mjs'
9+
import type { ZoneListParams } from 'cloudflare/resources/zones/zones.mjs'
1010
import type { Env } from '../context'
1111
import type { DNSAnalyticsMCP } from '../index'
1212

@@ -29,7 +29,7 @@ export function registerAnalyticTools(agent: DNSAnalyticsMCP) {
2929
},
3030
async ({ zone, days }) => {
3131
try {
32-
const client = getCloudflareClient(env.DEV_CLOUDFLARE_API_TOKEN)
32+
const client = getCloudflareClient(agent.props.accessToken)
3333
const start_date = getStartDate(days)
3434
const params: ReportGetParams = {
3535
zone_id: zone,
@@ -77,7 +77,7 @@ export function registerAnalyticTools(agent: DNSAnalyticsMCP) {
7777
],
7878
}
7979
}
80-
const client = getCloudflareClient(env.DEV_CLOUDFLARE_API_TOKEN)
80+
const client = getCloudflareClient(agent.props.accessToken)
8181
const params: AccountGetParams = {
8282
account_id: accountId,
8383
}
@@ -113,7 +113,7 @@ export function registerAnalyticTools(agent: DNSAnalyticsMCP) {
113113
},
114114
async ({ zone }) => {
115115
try {
116-
const client = getCloudflareClient(env.DEV_CLOUDFLARE_API_TOKEN)
116+
const client = getCloudflareClient(agent.props.accessToken)
117117
const params: ZoneGetParams = {
118118
zone_id: zone,
119119
}
@@ -147,7 +147,7 @@ export function registerAnalyticTools(agent: DNSAnalyticsMCP) {
147147
'List zones under the current active account',
148148
async () => {
149149
try {
150-
const client = getCloudflareClient(env.DEV_CLOUDFLARE_API_TOKEN)
150+
const client = getCloudflareClient(agent.props.accessToken)
151151
const accountId = await agent.getActiveAccountId()
152152
if (!accountId) {
153153
return {

apps/workers-bindings/evals/kv_namespaces.eval.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ eachModel('$modelName', ({ model }) => {
3737
],
3838
task: async (input: string) => {
3939
const client = await initializeClient(/* Pass necessary mocks/config */)
40-
const { promptOutput, toolCalls, fullResult } = await runTask(client, model, input)
40+
const { promptOutput, toolCalls } = await runTask(client, model, input)
4141

4242
const toolCall = toolCalls.find((call) => call.toolName === 'kv_namespaces_list')
4343
expect(toolCall, 'Tool kv_namespaces_list was not called').toBeDefined()
@@ -58,7 +58,7 @@ eachModel('$modelName', ({ model }) => {
5858
],
5959
task: async (input: string) => {
6060
const client = await initializeClient(/* Pass necessary mocks/config */)
61-
const { promptOutput, toolCalls, fullResult } = await runTask(client, model, input)
61+
const { promptOutput, toolCalls } = await runTask(client, model, input)
6262

6363
const toolCall = toolCalls.find((call) => call.toolName === 'kv_namespace_update')
6464
expect(toolCall, 'Tool kv_namespace_update was not called').toBeDefined()
@@ -100,7 +100,7 @@ eachModel('$modelName', ({ model }) => {
100100
],
101101
task: async (input: string) => {
102102
const client = await initializeClient(/* Pass necessary mocks/config */)
103-
const { promptOutput, toolCalls, fullResult } = await runTask(client, model, input)
103+
const { promptOutput, toolCalls } = await runTask(client, model, input)
104104

105105
const toolCall = toolCalls.find((call) => call.toolName === 'kv_namespace_delete')
106106
expect(toolCall, 'Tool kv_namespace_delete was not called').toBeDefined()

apps/workers-bindings/evals/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export async function runTask(
5959
maxSteps: 10,
6060
})
6161

62-
for await (const part of res.fullStream) {
63-
}
62+
// for await (const part of res.fullStream) {
63+
// }
6464

6565
// convert into an LLM readable result so our factuality checker can validate tool calls
6666
let messagesWithTools = ''

apps/workers-bindings/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import OAuthProvider from '@cloudflare/workers-oauth-provider'
22
import { McpAgent } from 'agents/mcp'
33

4-
import { createApiHandler } from '@repo/mcp-common/src/api-handler'
54
import {
65
createAuthHandlers,
76
handleTokenExchangeCallback,

0 commit comments

Comments
 (0)