Skip to main content
Glama
cheungxin

JianDaoYun MCP Server

by cheungxin

get_form_data

Retrieve a specific data entry from JianDaoYun forms using app ID, form ID, and data entry ID for form data management.

Instructions

Get a specific data entry from a JianDaoYun form

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)
dataIdYesThe data entry ID

Implementation Reference

  • src/index.ts:304-329 (registration)
    Registration of the 'get_form_data' tool, including name, description, and input schema definition.
    {
      name: 'get_form_data',
      description: 'Get a specific data entry from a JianDaoYun form',
      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)',
          },
          dataId: {
            type: 'string',
            description: 'The data entry ID',
          },
        },
        required: ['appId', 'formId', 'dataId'],
      },
    },
  • The MCP tool handler for 'get_form_data', which validates parameters, resolves formId, creates client instance, calls getFormData, and formats response.
    case 'get_form_data': {
      const { formId, dataId } = args as { formId: string; dataId: 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 data = await jdyClient.getFormData(resolved.formId, dataId);
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                data,
                formUsed: resolved.formId,
                appId: resolved.appId || appId
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        throw createEnhancedError(error, '获取表单数据');
      }
    }
  • Core implementation in JianDaoYunClient that makes the API POST request to retrieve specific form data entry by ID.
    async getFormData(formId: string, dataId: string): Promise<any> {
      try {
        const response = await this.axios.post<ApiResponse>('/v5/app/entry/data/get', {
          app_id: this.config.appId,
          entry_id: formId,
          data_id: dataId
        });
    
        if (response.data.code !== 0) {
          throw new Error(`Failed to get form data: ${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;
      }
    }

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