@boldsign/mcp
Version:
Model Context Protocol (MCP) server for BoldSign API
33 lines (32 loc) • 1.39 kB
JavaScript
import { TeamsApi } from 'boldsign';
import { z } from 'zod';
import * as commonSchema from '../../utils/commonSchema.js';
import { configuration } from '../../utils/constants.js';
import { handleMcpError, handleMcpResponse } from '../../utils/toolsUtils.js';
import ToolNames from '../toolNames.js';
const GetTeamSchema = z.object({
teamId: commonSchema.InputIdSchema.describe('Required. The unique identifier (ID) of the team to retrieve. This can be obtained from the list teams tool.'),
});
export const getTeamToolDefinition = {
method: ToolNames.GetTeam.toString(),
name: 'Get team',
description: 'Retrieve detailed information about an existing team in your BoldSign organization. This API provides access to team-specific properties, such as team name, users, created date, and modified date, by specifying the unique team ID.',
inputSchema: GetTeamSchema,
async handler(args) {
return await getTeamHandler(args);
},
};
async function getTeamHandler(payload) {
try {
const teamsApi = new TeamsApi();
teamsApi.basePath = configuration.getBasePath();
teamsApi.setApiKey(configuration.getApiKey());
const teamResponse = await teamsApi.getTeam(payload.teamId);
return handleMcpResponse({
data: teamResponse,
});
}
catch (error) {
return handleMcpError(error);
}
}