get_spaces
Retrieve all workspace spaces from ClickUp to view and manage project organization.
Instructions
Get all spaces in the workspace
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_spaces"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Defines the 'get_spaces' tool using defineTool, specifying name, description, empty input schema, and handler that calls spaceService.getSpaces() to fetch spaces and returns formatted JSON response.
const getSpacesTool = defineTool((z) => ({ name: "get_spaces", description: "Get all spaces in the workspace", inputSchema: {}, handler: async (input) => { const response = await spaceService.getSpaces(); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }, })); - src/index.ts:19-19 (registration)Imports the getSpacesTool from space.controller for use in tool registration.
import { getSpacesTool } from "./controllers/space.controller"; - src/index.ts:38-38 (registration)Includes getSpacesTool in the array of tools to be registered with the MCP server.
getSpacesTool, - src/index.ts:89-91 (registration)Loop that registers every tool in the tools array (including getSpacesTool) by calling server.tool with its properties.
tools.forEach((tool) => { server.tool(tool.name, tool.description, tool.inputSchema, tool.handler); }); - src/services/space.service.ts:28-30 (helper)Implements the core logic to fetch spaces via ClickUp API request, used by the tool handler.
async getSpaces() { return this.request<{ spaces: any[] }>(`/team/${this.workspaceId}/space`); }