Skip to main content
Glama
terrakube-io

Terrakube MCP Server

by terrakube-io

list-workspaces

Retrieve all workspaces within a specified organization using the Terrakube MCP Server. Manage infrastructure efficiently by accessing and organizing workspace details.

Instructions

Lists all workspaces in the specified organization

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationIdYesOrganization ID

Implementation Reference

  • Handler function for 'list-workspaces' tool that fetches workspaces from the API for the given organizationId and returns JSON-formatted data.
    async ({ organizationId }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace`, { headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" } }); if (!response.ok) { throw new Error(`Failed to list workspaces: ${response.statusText}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; }
  • Input schema for 'list-workspaces' tool using Zod, requiring an organizationId string.
    { organizationId: z.string().describe("Organization ID") },
  • Registers the 'list-workspaces' tool on the MCP server, including name, description, input schema, and handler function.
    server.tool( "list-workspaces", "Lists all workspaces in the specified organization", { organizationId: z.string().describe("Organization ID") }, async ({ organizationId }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace`, { headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" } }); if (!response.ok) { throw new Error(`Failed to list workspaces: ${response.statusText}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );
  • src/index.ts:23-23 (registration)
    Top-level call to registerWorkspaceTools in the main server setup, which registers the 'list-workspaces' tool among others.
    registerWorkspaceTools(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