Skip to main content
Glama
cheungxin

JianDaoYun MCP Server

by cheungxin

get_upload_token

Obtain secure upload tokens for file and image fields in JianDaoYun forms to enable file attachments in form submissions.

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

  • src/index.ts:462-487 (registration)
    Registration of the 'get_upload_token' tool in the MCP server, including name, description, and input schema.
    {
      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'],
      },
    },
  • MCP server handler for 'get_upload_token' tool: validates params, resolves formId, creates client, calls getUploadToken, and formats 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, '获取上传令牌');
      }
    }
  • Core implementation of getUploadToken: makes API POST request to JianDaoYun 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;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but lacks behavioral details. It doesn't disclose whether this is a read-only operation (implied by 'Get'), authentication requirements (though hinted in schema), rate limits, or what the tokens are used for (e.g., temporary upload permissions). The description is too vague for a mutation-sensitive context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and wastes no space, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (4 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain what the upload tokens are, how they're used, or what the output looks like (e.g., token strings, URLs). For a tool that likely returns critical data for subsequent operations, this leaves significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema itself. The description adds no additional meaning beyond implying tokens are for 'file/image fields', which doesn't clarify parameter usage. This meets the baseline for high schema coverage but doesn't enhance understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('file upload tokens for file/image fields'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its siblings (like get_form_data or get_form_fields), which all involve retrieving information but for different resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an appId or transactionId), use cases (e.g., preparing for file uploads in forms), or exclusions (e.g., not for other field types). This leaves the agent without context for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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