Skip to main content
Glama
Qihoo360

360 AI Cloud Drive MCP Server

by Qihoo360

file-move

Move files or folders within 360 AI Cloud Drive to organize content. Supports batch operations for multiple items at once.

Instructions

移动云盘中的文件或文件夹到指定位置。支持批量移动多个文件。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
src_nameYes源文件或文件夹路径,多个文件用竖线(|)分隔,例如:/文件1.txt|/文件2.txt
new_nameYes目标文件夹路径,例如:/目标文件夹/

Implementation Reference

  • Handler for 'file-move' tool: authenticates using getAuthInfo, calls moveFiles API, handles response and errors, returns formatted content.
    async ({ src_name, new_name }, mcpReq: any) => {
      const httpContext = gethttpContext(mcpReq, server);
      
      // 使用transport中的authInfo
      const transportAuthInfo = httpContext.authInfo;
      try {
        let authInfo: AuthInfo;
        const extraParams = {
          src_name: src_name,
          new_name: new_name
        };
        
        try {
          // 传入方法名和参数
          authInfo = await getAuthInfo({
            method: 'File.move',
            extraParams: extraParams
          }, transportAuthInfo);
          
          authInfo.request_url = getConfig(transportAuthInfo?.ecsEnv).request_url
        } catch (authError) {
          console.error("自动获取鉴权信息失败:", authError);
          throw new Error("获取鉴权信息失败,请提供有效的API_KEY");
        }
        
        // 调用API移动文件
        const apiResponse = await moveFiles(authInfo, src_name, new_name);
        
        // 检查API响应是否成功
        if (apiResponse && apiResponse.errno === 0) {
          // 计算移动的文件数
          const fileCount = src_name.split('|').length;
          const fileWord = fileCount > 1 ? "些文件" : "个文件";
          
          // 返回移动成功信息
          return {
            content: [
              {
                type: "text",
                text: `成功将${fileCount}${fileWord}移动到"${new_name}"!`,
              },
              {
                type: "text",
                text: TOOL_LIMIT_NOTE,
              },
            ],
          };
        } else {
          const errorMsg = apiResponse?.errmsg || "API请求失败";
          throw new Error(errorMsg);
        }
      } catch (error: any) {
        console.error("移动文件出错:", error);
        return {
          content: [
            {
              type: "text",
              text: `移动文件时发生错误: ${error.message}`,
            },
            {
              type: "text",
              text: TOOL_LIMIT_NOTE,
            },
          ],
        };
      }
    },
  • Input schema using Zod for src_name (source paths separated by |) and new_name (target directory).
    {
      src_name: z.string().describe("源文件或文件夹路径,多个文件用竖线(|)分隔,例如:/文件1.txt|/文件2.txt"),
      new_name: z.string().describe("目标文件夹路径,例如:/目标文件夹/"),
    },
  • Registers the 'file-move' tool on the MCP server, including name, description, schema, and handler.
    export function registerFileMoveTool(server: McpServer) {
      server.tool(
        "file-move",
        "移动云盘中的文件或文件夹到指定位置。支持批量移动多个文件。",
        {
          src_name: z.string().describe("源文件或文件夹路径,多个文件用竖线(|)分隔,例如:/文件1.txt|/文件2.txt"),
          new_name: z.string().describe("目标文件夹路径,例如:/目标文件夹/"),
        },
        async ({ src_name, new_name }, mcpReq: any) => {
          const httpContext = gethttpContext(mcpReq, server);
          
          // 使用transport中的authInfo
          const transportAuthInfo = httpContext.authInfo;
          try {
            let authInfo: AuthInfo;
            const extraParams = {
              src_name: src_name,
              new_name: new_name
            };
            
            try {
              // 传入方法名和参数
              authInfo = await getAuthInfo({
                method: 'File.move',
                extraParams: extraParams
              }, transportAuthInfo);
              
              authInfo.request_url = getConfig(transportAuthInfo?.ecsEnv).request_url
            } catch (authError) {
              console.error("自动获取鉴权信息失败:", authError);
              throw new Error("获取鉴权信息失败,请提供有效的API_KEY");
            }
            
            // 调用API移动文件
            const apiResponse = await moveFiles(authInfo, src_name, new_name);
            
            // 检查API响应是否成功
            if (apiResponse && apiResponse.errno === 0) {
              // 计算移动的文件数
              const fileCount = src_name.split('|').length;
              const fileWord = fileCount > 1 ? "些文件" : "个文件";
              
              // 返回移动成功信息
              return {
                content: [
                  {
                    type: "text",
                    text: `成功将${fileCount}${fileWord}移动到"${new_name}"!`,
                  },
                  {
                    type: "text",
                    text: TOOL_LIMIT_NOTE,
                  },
                ],
              };
            } else {
              const errorMsg = apiResponse?.errmsg || "API请求失败";
              throw new Error(errorMsg);
            }
          } catch (error: any) {
            console.error("移动文件出错:", error);
            return {
              content: [
                {
                  type: "text",
                  text: `移动文件时发生错误: ${error.message}`,
                },
                {
                  type: "text",
                  text: TOOL_LIMIT_NOTE,
                },
              ],
            };
          }
        },
      );
    } 
  • Top-level registration call for file-move tool within registerAllTools.
    registerFileMoveTool(server);
  • Helper function that makes the HTTP POST request to the cloud disk API to move files using form data.
    async function moveFiles(authInfo: AuthInfo, src_name: string, new_name: string): Promise<any> {
      try {
        const url = new URL(authInfo.request_url || '');
        
        // 构建请求头
        const headers = {
          'Access-Token': authInfo.access_token || '',
          'Content-Type': 'application/x-www-form-urlencoded'
        };
    
        // 构建请求参数
        const baseParams: Record<string, string> = {
          'method': 'File.move',
          'access_token': authInfo.access_token || '',
          'qid': authInfo.qid || '',
          'sign': authInfo.sign || '',
          'src_name': src_name,
          'new_name': new_name
        };
    
        // 构建表单数据
        const formData = new URLSearchParams();
        Object.entries(baseParams).forEach(([key, value]) => {
          formData.append(key, String(value));
        });
        
        const response = await fetch(url.toString(), {
          method: 'POST',
          headers: headers,
          body: formData
        });
        
        if (!response.ok) {
          throw new Error(`API 请求失败,状态码: ${response.status}`);
        }
        
        // 获取原始响应文本
        const responseText = await response.text();
        
        try {
          // 尝试解析为JSON
          const data = JSON.parse(responseText);
          return data;
        } catch (jsonError) {
          console.error("JSON解析错误:", jsonError);
          throw new Error(`无法解析API响应: ${responseText.substring(0, 100)}...`);
        }
      } catch (error) {
        console.error('移动文件失败:', error);
        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. It mentions batch support but lacks critical behavioral details: whether it overwrites existing files, requires specific permissions, handles errors, or provides confirmation. For a mutation tool, this is a significant gap in safety and operational 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?

Two sentences, front-loaded with core purpose and batch support. Zero wasted words, efficiently conveying essential information without redundancy.

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 details on behavioral traits (e.g., overwrite behavior, error handling), return values, or integration with sibling tools. The high schema coverage doesn't compensate for missing operational context.

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 both parameters thoroughly (src_name with format example, new_name with target folder). The description adds no additional parameter semantics beyond what the schema provides, meeting the baseline for high coverage.

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

Purpose5/5

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

The description clearly states the verb ('移动' meaning 'move') and resource ('云盘中的文件或文件夹' meaning 'files or folders in cloud storage'), specifying it supports batch operations ('批量移动多个文件'). It distinguishes from siblings like file-rename (renaming within same location) and file-save (saving new content).

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

Usage Guidelines3/5

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

The description implies usage for moving files/folders within cloud storage, but does not explicitly state when to use this vs. alternatives like file-rename (for renaming) or file-save (for creating/saving). No exclusions or prerequisites are mentioned.

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/Qihoo360/ecs_mcp_server'

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