Skip to main content
Glama

createWorkspace

Create a new workspace in Postman to organize your APIs and collaborate with your team.

Instructions

Creates a new workspace.

Note:

  • This endpoint returns a 403 `Forbidden` response if the user does not have permission to create workspaces. Admins and Super Admins can configure workspace permissions to restrict users and/or user groups from creating workspaces or require approvals for the creation of team workspaces.

  • Private and Partner Workspaces are available on Postman Team and Enterprise plans.

  • There are rate limits when publishing public workspaces.

  • Public team workspace names must be unique.

  • The `teamId` property must be passed in the request body if Postman Organizations is enabled.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceNoInformation about the workspace.

Implementation Reference

  • The main handler function for the 'createWorkspace' tool. It POSTs to the /workspaces endpoint with workspace data (name, type, description, about, teamId) via the PostmanAPIClient.
    export async function handler(
      args: z.infer<typeof parameters>,
      extra: { client: PostmanAPIClient; headers?: IsomorphicHeaders; serverContext?: ServerContext }
    ): Promise<CallToolResult> {
      try {
        const endpoint = `/workspaces`;
        const query = new URLSearchParams();
        const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
        const bodyPayload: any = {};
        if (args.workspace !== undefined) bodyPayload.workspace = args.workspace;
        const options: any = {
          body: JSON.stringify(bodyPayload),
          contentType: ContentType.Json,
          headers: extra.headers,
        };
        const result = await extra.client.post(url, options);
        return {
          content: [
            {
              type: 'text',
              text: `${typeof result === 'string' ? result : JSON.stringify(result, null, 2)}`,
            },
          ],
        };
      } catch (e: unknown) {
        if (e instanceof McpError) {
          throw e;
        }
        throw asMcpError(e);
      }
    }
  • Zod schema defining the input parameters for createWorkspace: workspace object with name (required string), type (enum: personal/private/public/team/partner), description (optional), about (optional), and teamId (optional string).
    export const parameters = z.object({
      workspace: z
        .object({
          name: z.string().describe("The workspace's name."),
          type: z
            .enum(['personal', 'private', 'public', 'team', 'partner'])
            .describe(
              'The type of workspace:\n- `personal`\n- `private` — Private workspaces are available on Postman [**Team** and **Enterprise** plans](https://www.postman.com/pricing).\n- `public`\n- `team`\n- `partner` — [Partner Workspaces](https://learning.postman.com/docs/collaborating-in-postman/using-workspaces/partner-workspaces/) are available on Postman [**Team** and **Enterprise** plans](https://www.postman.com/pricing)).\n'
            ),
          description: z.string().describe("The workspace's description.").optional(),
          about: z.string().describe('A brief summary about the workspace.').optional(),
          teamId: z
            .string()
            .describe(
              'The team ID to assign to the workspace. This property is required if Postman [Organizations](https://learning.postman.com/docs/administration/managing-your-team/overview) is enabled.'
            )
            .optional(),
        })
        .describe('Information about the workspace.')
        .optional(),
    });
  • Annotations/metadata for the createWorkspace tool including title, readOnlyHint, destructiveHint, and idempotentHint.
    export const annotations = {
      title:
        'Creates a new [workspace](https://learning.postman.com/docs/collaborating-in-postman/using-workspaces/creating-workspaces/).',
      readOnlyHint: false,
      destructiveHint: false,
      idempotentHint: false,
    };
  • Registration of 'createWorkspace' in the 'full' enabled resources list (line 109), and also in the 'minimal' set (line 169). This determines which toolset includes this tool.
    // Workspaces
    'createWorkspace',
  • src/index.ts:263-343 (registration)
    Dynamic registration of all tools (including createWorkspace) via server.registerTool(). The tool module is loaded dynamically and its method, description, parameters, and handler are used to register with the MCP server.
    for (const tool of tools) {
      server.registerTool(
        tool.method,
        {
          description: tool.description,
          inputSchema: tool.parameters.shape,
          annotations: tool.annotations || {},
        },
        async (args, extra) => {
          const toolName = tool.method;
          // Keep start event on stderr only to reduce client noise
          log('info', `Tool invocation started: ${toolName}`, { toolName });
    
          try {
            const start = Date.now();
    
            const result = await tool.handler(args, {
              client,
              headers: {
                ...extra?.requestInfo?.headers,
                'user-agent': clientInfo?.name,
              },
              serverContext,
            });
    
            const durationMs = Date.now() - start;
            // Completion: stderr only to avoid spamming client logs
            log('info', `Tool invocation completed: ${toolName} (${durationMs}ms)`, {
              toolName,
              durationMs,
            });
    
            // Apply template rendering
            if (result.content?.[0]?.type === 'text') {
              const rendered = renderTemplate(toolName, result.content[0].text);
              if (rendered) {
                return { content: [{ type: 'text' as const, text: rendered }] };
              }
            }
    
            return result;
          } catch (error: any) {
            const errMsg = String(error?.message || error);
            // Failures: notify both server stderr and client
            logBoth(server, 'error', `Tool invocation failed: ${toolName}: ${errMsg}`, { toolName });
            if (error instanceof McpError) {
              const httpStatus = (error.data as Record<string, unknown>)?.httpStatus;
              if (typeof httpStatus === 'number') {
                const rawBody = String((error.data as Record<string, unknown>)?.cause ?? '');
                let parsedBody: Record<string, unknown> | null = null;
                try {
                  parsedBody = JSON.parse(rawBody) as Record<string, unknown>;
                } catch {
                  /* not JSON */
                }
    
                // Unwrap common { error: { ... } } API response pattern
                const errorObj =
                  parsedBody?.error && typeof parsedBody.error === 'object'
                    ? (parsedBody.error as Record<string, unknown>)
                    : parsedBody;
    
                const rendered = renderErrorTemplate(toolName, httpStatus, {
                  toolName,
                  statusCode: httpStatus,
                  args,
                  errorMessage: error.message,
                  errorBody: rawBody,
                  error: errorObj,
                });
                if (rendered) {
                  throw new McpError(error.code, rendered, error.data);
                }
              }
              throw error;
            }
            throw new McpError(ErrorCode.InternalError, `API error: ${error.message}`);
          }
        }
      );
    }
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds transparency beyond annotations by detailing specific behaviors: returns 403 on permission failure, rate limits for public workspaces, unique name rule, and teamId requirement for Organizations. Annotations only set readOnlyHint=false, destructiveHint=false, idempotentHint=false, which are not contradicted.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with bullet points and a clear note section. It front-loads the main action and then provides supplementary details. Could be slightly more concise, but overall it is efficient and organized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (nested object parameter, no output schema), the description covers error responses, rate limits, naming constraints, and plan-specific requirements. It provides sufficient context for an agent to use this tool safely and correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with detailed parameter descriptions. The description adds value by explaining when teamId is required (if Organizations enabled) and implying that private/partner types require specific plans. This goes beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Creates a new workspace' and provides a link to documentation. It is distinct from sibling tools like createCollection or createMock.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes important usage conditions: permission requirements (403 Forbidden), rate limits for public workspaces, unique name requirement, and the teamId condition for Organizations. It does not explicitly mention when to avoid using this tool, but the context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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