Skip to main content
Glama
terrakube-io

Terrakube MCP Server

by terrakube-io

get-workspace

Retrieve detailed information about a specific workspace in the Terrakube MCP Server by providing the organization and workspace IDs.

Instructions

Retrieves detailed information about a specific workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationIdYesOrganization ID
workspaceIdYesWorkspace ID

Implementation Reference

  • The handler function that performs an API GET request to retrieve detailed information about a specific workspace given organizationId and workspaceId, formats the response as JSON text, and returns it in the MCP content format.
    async ({ organizationId, workspaceId }) => {
      const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}`, {
        headers: {
          Authorization: `Bearer ${CONFIG.patToken}`,
          "Content-Type": "application/vnd.api+json"
        }
      });
    
      if (!response.ok) {
        throw new Error(`Failed to get workspace: ${response.statusText}`);
      }
    
      const data = await response.json();
      return {
        content: [{
          type: "text",
          text: JSON.stringify(data, null, 2)
        }]
      };
    }
  • Zod schema validating the input parameters: organizationId (string) and workspaceId (string).
    {
      organizationId: z.string().describe("Organization ID"),
      workspaceId: z.string().describe("Workspace ID")
    },
  • Direct registration of the get-workspace tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    server.tool(
      "get-workspace",
      "Retrieves detailed information about a specific workspace",
      {
        organizationId: z.string().describe("Organization ID"),
        workspaceId: z.string().describe("Workspace ID")
      },
      async ({ organizationId, workspaceId }) => {
        const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}`, {
          headers: {
            Authorization: `Bearer ${CONFIG.patToken}`,
            "Content-Type": "application/vnd.api+json"
          }
        });
    
        if (!response.ok) {
          throw new Error(`Failed to get workspace: ${response.statusText}`);
        }
    
        const data = await response.json();
        return {
          content: [{
            type: "text",
            text: JSON.stringify(data, null, 2)
          }]
        };
      }
    );
  • src/index.ts:23-23 (registration)
    Invocation of registerWorkspaceTools which registers the get-workspace tool (among others) on the main MCP server instance.
    registerWorkspaceTools(server);
Install Server

Other Tools

Related 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/terrakube-io/mcp-server-terrakube'

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