Skip to main content
Glama
cheungxin

JianDaoYun MCP Server

by cheungxin

get_upload_token

Generate file upload tokens for file/image fields in JianDaoYun forms, enabling secure and traceable uploads by specifying app ID, form ID, and transaction ID.

Instructions

Get file upload tokens for file/image fields

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appIdYesThe JianDaoYun application ID
appKeyNoThe JianDaoYun application key (API key) (optional, will use JIANDAOYUN_APP_KEY from environment if not provided)
formIdYesThe form ID (can be form ID or app ID)
transactionIdYesTransaction ID to bind uploads to

Implementation Reference

  • MCP tool handler for 'get_upload_token': validates parameters, resolves form ID, instantiates client, calls getUploadToken, formats and returns response.
    case 'get_upload_token': { const { formId, transactionId } = args as { formId: string; transactionId: string; }; const { appId, appKey, baseUrl } = getDefaultParams(args); // 验证必需参数 if (!appKey) { throw new Error('appKey is required. Please set JIANDAOYUN_APP_KEY in MCP server configuration.'); } if (!appId) { throw new Error('appId is required. Please provide it as parameter.'); } try { // 创建客户端实例 const jdyClient = new JianDaoYunClient({ appId, appKey, baseUrl }); const resolved = await resolveFormId(formId, appKey); const result = await jdyClient.getUploadToken(resolved.formId, transactionId); return { content: [ { type: 'text', text: JSON.stringify({ success: true, result, formUsed: resolved.formId, appId: resolved.appId || appId }, null, 2), }, ], }; } catch (error) { throw createEnhancedError(error, '获取上传令牌'); } }
  • Schema definition and registration entry for the 'get_upload_token' tool in the MCP tools array.
    { name: 'get_upload_token', description: 'Get file upload tokens for file/image fields', inputSchema: { type: 'object', properties: { appId: { type: 'string', description: 'The JianDaoYun application ID', }, appKey: { type: 'string', description: 'The JianDaoYun application key (API key) (optional, will use JIANDAOYUN_APP_KEY from environment if not provided)', }, formId: { type: 'string', description: 'The form ID (can be form ID or app ID)', }, transactionId: { type: 'string', description: 'Transaction ID to bind uploads to', }, }, required: ['appId', 'formId', 'transactionId'], }, },
  • Core implementation of getUploadToken in JianDaoYunClient: POST request to JianDaoYun API endpoint '/v5/app/entry/file/get_upload_token' to retrieve upload token.
    async getUploadToken(formId: string, transactionId: string): Promise<any> { try { const response = await this.axios.post<ApiResponse>('/v5/app/entry/file/get_upload_token', { app_id: this.config.appId, entry_id: formId, transaction_id: transactionId }); if (response.data.code !== 0) { throw new Error(`Failed to get upload token: ${response.data.msg}`); } return response.data.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`API request failed: ${error.response?.data?.msg || error.message}`); } throw error; } }

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/cheungxin/jiandaoyun-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server