Skip to main content
Glama

Flatfile MCP Server

by FlatFilers
duplicate-sheet.ts2.06 kB
/** * This file was generated. Do NOT edit this file. */ import fetch from 'node-fetch' import { type ZodRawShape, z } from 'zod' import { commons_SheetIdSchema } from '../schemas.js' import type { Tool } from './index.js' const params = { sheetId: commons_SheetIdSchema.describe('ID of sheet to duplicate'), name: z.string().optional().describe('Custom name for the duplicated sheet. Defaults to "Copy of [original name]"'), slug: z .string() .optional() .describe('Custom slug for the duplicated sheet. Defaults to "[original slug]-copy-[timestamp]"'), } as ZodRawShape export const duplicateSheet: Tool<typeof params> = { name: 'duplicateSheet', description: 'Duplicate a sheet: Creates a copy of a sheet including all its data within the same workbook', params, cb: async ({ sheetId, name, slug }) => { try { const searchParams = {} 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}/sheets/${sheetId}/duplicate${searchParamsString ? `?${searchParamsString}` : ''}` const response = await fetch(url, { method: 'POST', headers: { 'X-Disable-Hooks': 'true', Authorization: `Bearer ${process.env.FLATFILE_BEARER_TOKEN}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ name: name, slug: slug, }), }) 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