Skip to main content
Glama
r-huijts
by r-huijts

get_workspace

Retrieve workspace configuration, metadata, and user access details using a unique workspace identifier from Portkey's AI management platform.

Instructions

Retrieve detailed information about a specific workspace, including its configuration, metadata, and user access details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace_idYesThe unique identifier of the workspace to retrieve. This can be found in the workspace's URL or from the list_workspaces tool response

Implementation Reference

  • The main handler function for the 'get_workspace' MCP tool. It extracts workspace_id from params, calls portkeyService.getWorkspace, formats the response including users list, and handles errors.
      async (params) => {
        try {
          const workspace = await portkeyService.getWorkspace(params.workspace_id);
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({
                id: workspace.id,
                name: workspace.name,
                slug: workspace.slug,
                description: workspace.description,
                created_at: workspace.created_at,
                last_updated_at: workspace.last_updated_at,
                defaults: workspace.defaults,
                users: workspace.users.map(user => ({
                  id: user.id,
                  name: `${user.first_name} ${user.last_name}`,
                  organization_role: user.org_role,
                  workspace_role: user.role,
                  status: user.status,
                  created_at: user.created_at,
                  last_updated_at: user.last_updated_at
                }))
              }, null, 2)
            }]
          };
        } catch (error) {
          return {
            content: [{ 
              type: "text", 
              text: `Error fetching workspace details: ${error instanceof Error ? error.message : 'Unknown error'}`
            }]
          };
        }
      }
    );
  • Zod input schema validating the required 'workspace_id' parameter for the get_workspace tool.
    {
      workspace_id: z.string().describe(
        "The unique identifier of the workspace to retrieve. " +
        "This can be found in the workspace's URL or from the list_workspaces tool response"
      )
    },
  • src/index.ts:140-142 (registration)
    Registration of the 'get_workspace' tool with the MCP server, specifying name and description.
    server.tool(
      "get_workspace",
      "Retrieve detailed information about a specific workspace, including its configuration, metadata, and user access details",
  • Helper method in PortkeyService that makes the API call to retrieve single workspace details from Portkey API.
    async getWorkspace(workspaceId: string): Promise<SingleWorkspaceResponse> {
      try {
        const response = await fetch(`${this.baseUrl}/admin/workspaces/${workspaceId}`, {
          method: 'GET',
          headers: {
            'x-portkey-api-key': this.apiKey,
            'Accept': 'application/json'
          }
        });
    
        if (!response.ok) {
          throw new Error(`HTTP error! status: ${response.status}`);
        }
    
        return await response.json() as SingleWorkspaceResponse;
      } catch (error) {
        console.error('PortkeyService Error:', error);
        throw new Error('Failed to fetch workspace details from Portkey API');
      }
    }
  • TypeScript interface defining the structure of the SingleWorkspaceResponse returned by the getWorkspace service method.
    interface SingleWorkspaceResponse {
      id: string;
      name: string;
      slug: string;
      description: string | null;
      created_at: string;
      last_updated_at: string;
      defaults: {
        is_default: number;
        metadata: Record<string, string>;
        object: 'workspace';
      } | null;
      users: WorkspaceUser[];
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It describes the operation as a retrieval (implying read-only) and specifies the type of information returned, but lacks details on permissions required, error handling, or response format. This is adequate for a simple read tool but misses behavioral context like rate limits or authentication needs.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose and includes key details without redundancy. Every word adds value, making it appropriately sized and easy to parse for an AI agent.

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

Completeness4/5

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

Given the tool's simplicity (1 parameter, no output schema, no annotations), the description is mostly complete: it states the purpose, scope, and return details. However, it could improve by mentioning the lack of output schema or clarifying that it returns unstructured data, which would help the agent understand response handling.

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

Parameters3/5

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

Schema description coverage is 100%, with the single parameter (workspace_id) well-documented in the schema. The description does not add any parameter-specific details beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate since the schema handles the parameter documentation effectively.

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 the verb ('retrieve') and resource ('workspace'), specifying the scope ('detailed information about a specific workspace') and what details are included ('configuration, metadata, and user access details'). It distinguishes this from siblings like list_workspaces by focusing on a single workspace rather than listing multiple.

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 implies usage for retrieving details of a specific workspace, which differentiates it from list_workspaces (for listing multiple) and other siblings like get_user_stats (for user data). However, it does not explicitly state when not to use this tool or name alternatives, such as clarifying that list_workspaces should be used first to find workspace IDs.

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/r-huijts/portkey-admin-mcp-server'

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