@smartsheet/smar-mcp
Version:
A Model Context Protocol (MCP) server for interacting with the Smartsheet API. This server provides tools for searching, retrieving, and updating Smartsheet sheets through the MCP protocol.
56 lines (55 loc) • 1.53 kB
JavaScript
/**
* Workspace-specific API methods for Smartsheet
*/
export class SmartsheetWorkspaceAPI {
api;
constructor(api) {
this.api = api;
}
/**
* Gets workspaces
* @returns workspaces data
*/
async getWorkspaces() {
return this.api.request('GET', `/workspaces`);
}
/**
* Gets a workspace by ID
* @param workspaceId workspace ID
* @returns workspace data
*/
async getWorkspace(workspaceId) {
return this.api.request('GET', `/workspaces/${workspaceId}`);
}
/**
* Creates a workspace
* @param workspaceName Name of the workspace to create
* @returns Created workspace data
*/
async createWorkspace(workspaceName) {
const data = {
name: workspaceName
};
return this.api.request('POST', `/workspaces`, data);
}
/**
* Lists folders in a workspace
* @param workspaceId Workspace ID
* @returns List of folders in the workspace
*/
async listWorkspaceFolders(workspaceId) {
return this.api.request('GET', `/workspaces/${workspaceId}/folders`);
}
/**
* Creates a folder in a workspace
* @param workspaceId Workspace ID
* @param folderName Name of the folder to create
* @returns Created folder data
*/
async createWorkspaceFolder(workspaceId, folderName) {
const data = {
name: folderName
};
return this.api.request('POST', `/workspaces/${workspaceId}/folders`, data);
}
}