Skip to main content
Glama

json_import

Import multiple to-dos and projects into Things 3 from JSON data with support for nested structures.

Instructions

JSON批量导入待办事项和项目。支持复杂的嵌套结构。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesJSON数据数组,包含to-do和project对象
authTokenNo授权令牌(如包含更新操作则必需)
revealNo是否显示第一个创建的项

Implementation Reference

  • The main handler function for the 'json_import' tool. It processes the input arguments, checks for updates requiring auth, builds a Things URL scheme command using buildThingsUrl('json', params), opens it, and returns a success message.
    async handleJsonImport(args) {
      const authToken = args.authToken || DEFAULT_AUTH_TOKEN;
      const params = {
        data: JSON.stringify(args.data),
        reveal: args.reveal,
      };
    
      // 如果数据中包含更新操作,需要授权令牌
      const hasUpdate = args.data.some(item => item.operation === 'update');
      if (hasUpdate && !authToken) {
        throw new Error('JSON数据包含更新操作,需要授权令牌');
      }
    
      if (authToken) {
        params.authToken = authToken;
      }
    
      const url = buildThingsUrl('json', params);
      await this.openThingsUrl(url);
    
      return {
        content: [
          {
            type: 'text',
            text: `✅ JSON导入命令已发送 (${args.data.length}个项目)`,
          },
        ],
      };
    }
  • Input schema definition for the json_import tool, specifying the expected JSON data array, optional authToken, and reveal flag.
    inputSchema: {
      type: 'object',
      properties: {
        data: {
          type: 'array',
          description: 'JSON数据数组,包含to-do和project对象',
        },
        authToken: {
          type: 'string',
          description: '授权令牌(如包含更新操作则必需)',
        },
        reveal: {
          type: 'boolean',
          description: '是否显示第一个创建的项',
        },
      },
      required: ['data'],
    },
  • src/index.js:445-446 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes calls to the json_import handler function.
    case 'json_import':
      return await this.handleJsonImport(args);
  • src/index.js:360-381 (registration)
    Tool descriptor registration in the ListToolsRequestSchema response, defining name, description, and schema.
    {
      name: 'json_import',
      description: 'JSON批量导入待办事项和项目。支持复杂的嵌套结构。',
      inputSchema: {
        type: 'object',
        properties: {
          data: {
            type: 'array',
            description: 'JSON数据数组,包含to-do和project对象',
          },
          authToken: {
            type: 'string',
            description: '授权令牌(如包含更新操作则必需)',
          },
          reveal: {
            type: 'boolean',
            description: '是否显示第一个创建的项',
          },
        },
        required: ['data'],
      },
    },
  • Helper function specifically for building Things URLs for JSON imports, handling JSON serialization. Used indirectly via the general buildThingsUrl in the handler.
    export function buildJsonUrl(data, options = {}) {
      // JSON需要先序列化再编码
      const jsonString = JSON.stringify(data);
    
      const params = {
        data: jsonString,
        ...options,
      };
    
      return buildThingsUrl('json', params);
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool performs imports (implying write operations) and supports complex nested structures, but fails to mention critical aspects like required permissions, error handling, rate limits, or whether it's idempotent. This leaves significant gaps for a mutation tool.

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

Conciseness4/5

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

The description is concise with two sentences that efficiently convey the core functionality and a key feature (support for complex nested structures). It's front-loaded with the main purpose, though it could be slightly more structured.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It lacks information about return values, error conditions, authentication requirements (beyond the authToken parameter), and how it differs from sibling tools. The mention of nested structures is helpful but insufficient.

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 the schema already documents all three parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., no examples of nested structures or format details). Baseline 3 is appropriate when schema does the heavy lifting.

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 ('JSON批量导入' - JSON batch import) and target resources ('待办事项和项目' - to-dos and projects), which is specific and actionable. However, it doesn't explicitly differentiate from sibling tools like 'add_project' or 'add_todo' that handle individual creations, though the batch nature is implied.

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 like 'add_project' or 'add_todo'. It mentions support for complex nested structures, which hints at usage for bulk operations, but lacks explicit when/when-not instructions or named alternatives.

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/Mieluoxxx/things_mcp'

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