Skip to content

Commit 06cb747

Browse files
committed
Fix param ordering and add changeset
1 parent 2f6e886 commit 06cb747

File tree

4 files changed

+88
-63
lines changed

4 files changed

+88
-63
lines changed

.changeset/clever-humans-smell.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
'workers-observability': patch
3+
'cloudflare-casb-mcp-server': patch
4+
'cloudflare-browser-mcp-server': patch
5+
'containers-mcp': patch
6+
'workers-bindings': patch
7+
'docs-vectorize': patch
8+
'workers-builds': patch
9+
'@repo/eval-tools': patch
10+
'@repo/mcp-common': patch
11+
'dns-analytics': patch
12+
'dex-analysis': patch
13+
'docs-autorag': patch
14+
'cloudflare-ai-gateway-mcp-server': patch
15+
'auditlogs': patch
16+
'demo-day': patch
17+
'cloudflare-autorag-mcp-server': patch
18+
'graphql-mcp-server': patch
19+
'logpush': patch
20+
'cloudflare-radar-mcp-server': patch
21+
---
22+
23+
feat: Add MCP tool titles and hints to all Cloudflare tools

packages/mcp-common/src/tools/account.tools.ts

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { CloudflareMcpAgent } from '../types/cloudflare-mcp-agent.types'
88
export function registerAccountTools(agent: CloudflareMcpAgent) {
99
// Tool to list all accounts
1010
agent.server.tool(
11-
'accounts_list',
11+
'accounts_list',
1212
'List all accounts in your Cloudflare account',
1313
{},
1414
{
@@ -18,50 +18,51 @@ export function registerAccountTools(agent: CloudflareMcpAgent) {
1818
},
1919
},
2020
async () => {
21-
try {
22-
const results = await handleAccountsList({
23-
client: getCloudflareClient(agent.props.accessToken),
24-
})
25-
// Sort accounts by created_on date (newest first)
26-
const accounts = results
27-
// order by created_on desc ( newest first )
28-
.sort((a, b) => {
29-
if (!a.created_on) return 1
30-
if (!b.created_on) return -1
31-
return new Date(b.created_on).getTime() - new Date(a.created_on).getTime()
32-
})
33-
// Remove fields not needed by the LLM
34-
.map((account) => {
35-
return {
36-
id: account.id,
37-
name: account.name,
38-
created_on: account.created_on,
39-
}
21+
try {
22+
const results = await handleAccountsList({
23+
client: getCloudflareClient(agent.props.accessToken),
4024
})
25+
// Sort accounts by created_on date (newest first)
26+
const accounts = results
27+
// order by created_on desc ( newest first )
28+
.sort((a, b) => {
29+
if (!a.created_on) return 1
30+
if (!b.created_on) return -1
31+
return new Date(b.created_on).getTime() - new Date(a.created_on).getTime()
32+
})
33+
// Remove fields not needed by the LLM
34+
.map((account) => {
35+
return {
36+
id: account.id,
37+
name: account.name,
38+
created_on: account.created_on,
39+
}
40+
})
4141

42-
return {
43-
content: [
44-
{
45-
type: 'text',
46-
text: JSON.stringify({
47-
accounts,
48-
count: accounts.length,
49-
}),
50-
},
51-
],
52-
}
53-
} catch (e) {
54-
agent.server.recordError(e)
55-
return {
56-
content: [
57-
{
58-
type: 'text',
59-
text: `Error listing accounts: ${e instanceof Error && e.message}`,
60-
},
61-
],
42+
return {
43+
content: [
44+
{
45+
type: 'text',
46+
text: JSON.stringify({
47+
accounts,
48+
count: accounts.length,
49+
}),
50+
},
51+
],
52+
}
53+
} catch (e) {
54+
agent.server.recordError(e)
55+
return {
56+
content: [
57+
{
58+
type: 'text',
59+
text: `Error listing accounts: ${e instanceof Error && e.message}`,
60+
},
61+
],
62+
}
6263
}
6364
}
64-
})
65+
)
6566

6667
// Only register set_active_account tool when user token is provided, as it doesn't make sense to expose
6768
// this tool for account scoped tokens, given that they're scoped to a single account

packages/mcp-common/src/tools/worker.tools.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,19 @@ export function registerWorkersTools(agent: CloudflareMcpAgent) {
2323
// Tool to list all workers
2424
agent.server.tool(
2525
'workers_list',
26+
fmt.trim(`
27+
List all Workers in your Cloudflare account.
28+
29+
If you only need details of a single Worker, use workers_get_worker.
30+
`),
31+
{},
2632
{
2733
title: 'List Workers',
2834
annotations: {
2935
readOnlyHint: true,
3036
destructiveHint: false,
3137
},
3238
},
33-
fmt.trim(`
34-
List all Workers in your Cloudflare account.
35-
36-
If you only need details of a single Worker, use workers_get_worker.
37-
`),
3839
async () => {
3940
const accountId = await agent.getActiveAccountId()
4041
if (!accountId) {
@@ -97,17 +98,17 @@ export function registerWorkersTools(agent: CloudflareMcpAgent) {
9798
// Tool to get a specific worker's script details
9899
agent.server.tool(
99100
'workers_get_worker',
101+
'Get the details of the Cloudflare Worker.',
102+
{
103+
scriptName: workerNameParam,
104+
},
100105
{
101106
title: 'Get Worker details',
102107
annotations: {
103108
readOnlyHint: true,
104109
destructiveHint: false,
105110
},
106111
},
107-
'Get the details of the Cloudflare Worker.',
108-
{
109-
scriptName: workerNameParam,
110-
},
111112
async (params) => {
112113
const accountId = await agent.getActiveAccountId()
113114
if (!accountId) {
@@ -170,15 +171,15 @@ export function registerWorkersTools(agent: CloudflareMcpAgent) {
170171
// Tool to get a specific worker's script content
171172
agent.server.tool(
172173
'workers_get_worker_code',
174+
'Get the source code of a Cloudflare Worker. Note: This may be a bundled version of the worker.',
175+
{ scriptName: workerNameParam },
173176
{
174177
title: 'Get Worker code',
175178
annotations: {
176179
readOnlyHint: true,
177180
destructiveHint: false,
178181
},
179182
},
180-
'Get the source code of a Cloudflare Worker. Note: This may be a bundled version of the worker.',
181-
{ scriptName: workerNameParam },
182183
async (params) => {
183184
const accountId = await agent.getActiveAccountId()
184185
if (!accountId) {

packages/mcp-common/src/tools/zone.tools.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ export function registerZoneTools(agent: CloudflareMcpAgent) {
88
// Tool to list all zones under an account
99
agent.server.tool(
1010
'zones_list',
11-
{
12-
title: 'List zones',
13-
annotations: {
14-
readOnlyHint: true,
15-
destructiveHint: false,
16-
},
17-
},
1811
'List all zones under a Cloudflare account',
1912
{
2013
name: z.string().optional().describe('Filter zones by name'),
@@ -35,6 +28,13 @@ export function registerZoneTools(agent: CloudflareMcpAgent) {
3528
.default('desc')
3629
.describe('Direction to order results (asc, desc)'),
3730
},
31+
{
32+
title: 'List zones',
33+
annotations: {
34+
readOnlyHint: true,
35+
destructiveHint: false,
36+
},
37+
},
3838
async (params) => {
3939
const accountId = await agent.getActiveAccountId()
4040
if (!accountId) {
@@ -87,17 +87,17 @@ export function registerZoneTools(agent: CloudflareMcpAgent) {
8787
// Tool to get zone details by ID
8888
agent.server.tool(
8989
'zone_details',
90+
'Get details for a specific Cloudflare zone',
91+
{
92+
zoneId: z.string().describe('The ID of the zone to get details for'),
93+
},
9094
{
9195
title: 'Get zone details',
9296
annotations: {
9397
readOnlyHint: true,
9498
destructiveHint: false,
9599
},
96100
},
97-
'Get details for a specific Cloudflare zone',
98-
{
99-
zoneId: z.string().describe('The ID of the zone to get details for'),
100-
},
101101
async (params) => {
102102
const accountId = await agent.getActiveAccountId()
103103
if (!accountId) {

0 commit comments

Comments
 (0)