MCPcopy
hub / github.com/cloudflare/mcp-server-cloudflare / registerRadarTools

Function registerRadarTools

apps/radar/src/tools/radar.tools.ts:187–3382  ·  view source on GitHub ↗
(agent: RadarMCP)

Source from the content-addressed store, hash-verified

185}
186
187export function registerRadarTools(agent: RadarMCP) {
188 agent.server.registerTool(
189 'list_autonomous_systems',
190 {
191 description: 'List Autonomous Systems',
192 inputSchema: {
193 limit: PaginationLimitParam,
194 offset: PaginationOffsetParam,
195 location: LocationParam.optional(),
196 orderBy: AsOrderByParam,
197 },
198 },
199 async ({ limit, offset, location, orderBy }) => {
200 try {
201 const props = getProps(agent)
202 const client = getCloudflareClient(props.accessToken)
203 const r = await client.radar.entities.asns.list({
204 limit,
205 offset,
206 location,
207 orderBy,
208 })
209
210 return {
211 content: [
212 {
213 type: 'text',
214 text: JSON.stringify({
215 result: r.asns,
216 }),
217 },
218 ],
219 }
220 } catch (error) {
221 return {
222 content: [
223 {
224 type: 'text',
225 text: `Error listing ASes: ${error instanceof Error && error.message}`,
226 },
227 ],
228 }
229 }
230 }
231 )
232
233 agent.server.registerTool(
234 'get_as_details',
235 {
236 description: 'Get Autonomous System details by ASN',
237 inputSchema: {
238 asn: AsnParam,
239 },
240 },
241 async ({ asn }) => {
242 try {
243 const props = getProps(agent)
244 const client = getCloudflareClient(props.accessToken)

Callers 1

initMethod · 0.90

Calls 7

getPropsFunction · 0.90
getCloudflareClientFunction · 0.90
resolveAndInvokeFunction · 0.90
fetchRadarApiFunction · 0.85
listMethod · 0.65
getMethod · 0.65
replaceMethod · 0.65

Tested by

no test coverage detected