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
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"organizationId": "<organizationId>",
"workspaceId": "<workspaceId>"
},
"name": "get-workspace"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | Organization ID | |
| workspaceId | Yes | Workspace ID |
Implementation Reference
- src/tools/workspaces.ts:41-60 (handler)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) }] }; } - src/tools/workspaces.ts:37-40 (schema)Zod schema validating the input parameters: organizationId (string) and workspaceId (string).
{ organizationId: z.string().describe("Organization ID"), workspaceId: z.string().describe("Workspace ID") }, - src/tools/workspaces.ts:34-61 (registration)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);