Skip to main content
Glama
createEnvironment.ts1.09 kB
import { z } from 'zod'; import { createSuccessResponse, withErrorHandling, } from '../../utils/response.js'; import { BaseToolSchema, createToolClient } from '../../utils/tools.js'; import type { ContentfulConfig } from '../../config/types.js'; export const CreateEnvironmentToolParams = BaseToolSchema.extend({ environmentId: z.string().describe('The ID of the environment to create'), name: z.string().describe('The name of the environment to create'), }); type Params = z.infer<typeof CreateEnvironmentToolParams>; export function createEnvironmentTool(config: ContentfulConfig) { async function tool(args: Params) { const contentfulClient = createToolClient(config, args); // Create the environment const environment = await contentfulClient.environment.createWithId( { spaceId: args.spaceId, environmentId: args.environmentId, }, { name: args.name, }, ); return createSuccessResponse('Environment created successfully', { environment, }); } return withErrorHandling(tool, 'Error creating environment'); }

Latest Blog Posts

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/contentful/contentful-mcp-server'

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