Skip to main content
Glama

Flatfile MCP Server

by FlatFilers
list-canvas-areas.ts2.44 kB
/** * This file was generated. Do NOT edit this file. */ import fetch from 'node-fetch' import { type ZodRawShape, z } from 'zod' import { commons_CanvasAreaIdSchema, commons_CanvasIdSchema, commons_EnvironmentIdSchema, commons_SpaceIdSchema, } from '../schemas.js' import type { Tool } from './index.js' const params = { canvasId: commons_CanvasIdSchema.optional().describe('ID of the canvas to filter areas by'), parentId: commons_CanvasAreaIdSchema.optional().describe('ID of the parent canvas area to filter by'), spaceId: commons_SpaceIdSchema.optional().describe('ID of the space to filter areas by'), environmentId: commons_EnvironmentIdSchema.optional().describe('ID of the environment to filter areas by'), pageSize: z.number().int().optional().describe('Number of areas to return in a page (default 20)'), pageNumber: z.number().int().optional().describe('Based on pageSize, which page of areas to return'), } as ZodRawShape export const listCanvasAreas: Tool<typeof params> = { name: 'listCanvasAreas', description: 'List canvas areas: Returns a list of canvas areas filtered by canvas, space, or environment', params, cb: async ({ canvasId, parentId, spaceId, environmentId, pageSize, pageNumber }) => { try { const searchParams = { canvasId, parentId, spaceId, environmentId, pageSize, pageNumber } const searchParamsString = new URLSearchParams(JSON.parse(JSON.stringify(searchParams))).toString() const baseUrl = process.env.FLATFILE_API_URL || 'https://platform.flatfile.com/api/v1' const url = `${baseUrl}/canvas-areas${searchParamsString ? `?${searchParamsString}` : ''}` const response = await fetch(url, { method: 'GET', headers: { 'X-Disable-Hooks': 'true', Authorization: `Bearer ${process.env.FLATFILE_BEARER_TOKEN}`, 'Content-Type': 'application/json', }, }) if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status} - ${response.statusText}`) } const data = (await response.json()) as { data: unknown } return { content: [ { type: 'text', text: JSON.stringify(data.data, null, 2), }, ], status: 'success', } } catch (error) { return { content: [{ type: 'text', text: `Error: ${error}` }], status: 'failed', } } }, }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/FlatFilers/mcp-server-flatfile'

If you have feedback or need assistance with the MCP directory API, please join our Discord server