CodeSpace

开放能力概览

工具

名称

描述

支持说明

CodeSpace

run_code

在 Linux 平台上运行指定上下文中的代码并返回输出或错误。

支持

Shell

shell

执行 shell 命令并返回输出或错误。

支持

FileSystem

create_directory

创建一个新目录或确保目录存在。可以在一次操作中创建多个嵌套目录。如果目录已存在,此操作将静默成功。非常适合设置项目所需的目录结构或确保所需路径存在。仅在允许的目录中工作。

支持

edit_file

对文本文件进行基于行的编辑。每次编辑会用新内容替换精确的行序列。返回 git 样式的差异以显示所做的更改。仅在允许的目录中工作。

支持

get_file_info

检索文件或目录的详细元数据。返回包括大小、创建时间、最后修改时间、权限和类型的综合信息。此工具非常适合在不读取实际内容的情况下了解文件特性。仅在允许的目录中工作。

支持

read_file

从文件系统读取文件的内容。可以指定一个可选的 offset(以字节为单位)来从特定位置开始读取,以及一个可选的 length(以字节为单位)来限制要读取的字节数。如果 length 被省略或为 0,文件将读取到末尾。处理各种文本编码,并在文件无法读取时提供详细的错误信息。仅在允许的目录中工作。

支持

read_multiple_files

同时读取多个文件的内容。这比逐个读取文件更高效,当你需要分析或比较多个文件时。每个文件的内容会以其路径作为参考返回。单个文件读取失败不会停止整个操作。仅在允许的目录中工作。

支持

list_directory

获取指定路径中所有文件和目录的详细列表。结果通过 [FILE] 和 [DIR] 前缀清楚地区分文件和目录。此工具对于了解目录结构和查找特定文件非常有用。仅在允许的目录中工作。

支持

move_file

移动或重命名文件和目录。可以在一次操作中移动文件到不同目录并重命名。如果目标已存在,操作将失败。可以在不同目录之间工作,并可用于在同一目录内进行简单重命名。源和目标都必须在允许的目录中。

支持

search_files

递归搜索匹配模式的文件和目录。从起始路径搜索所有子目录。搜索区分大小写并匹配部分名称。返回所有匹配项的完整路径。非常适合在不知道确切位置时查找文件。仅在允许的目录中搜索。

支持

write_file

创建一个新文件或写入现有文件的内容。可以选择完全覆盖文件或通过指定 mode 参数追加到文件末尾。使用 overwrite 模式(默认)在写入前清除文件,或使用 append 模式将内容添加到文件末尾。处理带适当编码的文本内容。仅在允许的目录中工作。

支持

OSS

oss_env_init

创建并初始化 OSS 环境变量,指定 endpoint、access key ID、access key secret、security token 和 region。临时安全凭证通过 STS(Security Token Service)获取,更多信息请参见使用STS临时访问凭证访问OSS

支持

oss_upload

将本地文件或目录上传到指定的 OSS Bucket。如果上传目录,会先压缩为 zip 文件再上传。可以指定 OSS 中的对象名称,若未指定,则默认使用文件或 zip 名称。注意:使用此工具前必须调用oss_env_init 工具初始化 OSS 环境变量。

支持

oss_download

从指定的 OSS Bucket 下载对象到本地路径。如果父目录不存在,会自动创建。如果目标文件已存在,会被覆盖。注意:使用此工具前必须调用 oss_env_init 工具初始化 OSS 环境变量。

支持

oss_upload_annon

使用 HTTP PUT 将本地文件或目录上传到指定 URL。如果上传目录,会先压缩为 zip 文件再上传。如果目标已存在,会被覆盖。

支持

oss_download_annon

从指定 URL 下载文件到本地路径。如果父目录不存在,会自动创建。如果目标文件已存在,会被覆盖。

支持

CodeSpace

名称

描述

参数

run_code

在 Linux 平台上运行指定上下文中的代码并返回输出或错误。

{
  "inputSchema": {
    "properties": {
      "code": {
        "description": "要执行的代码",
        "type": "string"
      },
      "language": {
        "description": "用于代码执行的编程语言。支持的值:'python', 'javascript'。如果未指定,默认使用 Python。",
        "type": "string"
      },
      "timeout_s": {
        "default": 300,
        "description": "命令执行超时时间(单位:秒)。如果未指定,默认值(例如 300 秒),最大 3600 秒。",
        "type": "integer"
      }
    },
    "required": ["code"],
    "type": "object"
  }
}

Shell

执行Shell命令(带超时控制)。

名称

描述

参数

shell

执行 shell 命令并返回输出或错误。

{
  "inputSchema": {
    "properties": {
      "command": {
        "description": "客户端输入的命令",
        "type": "string"
      },
      "timeout_ms": {
        "default": 1000,
        "description": "命令执行超时时间(单位:毫秒)。如果未指定,默认值(例如 1000 毫秒)",
        "type": "integer"
      }
    },
    "required": ["command", "timeout_ms"],
    "type": "object"
  }
}

FileSystem

提供文件系统操作(如上传、下载和管理)。

名称

描述

参数

create_directory

创建一个新目录或确保目录存在。可以在一次操作中创建多个嵌套目录。如果目录已存在,此操作将静默成功。非常适合设置项目所需的目录结构或确保所需路径存在。仅在允许的目录中工作。

{
  "inputSchema": {
    "properties": {
      "path": {
        "description": "要创建的目录路径。",
        "type": "string"
      }
    },
    "required": ["path"],
    "type": "object"
  }
}

edit_file

对文本文件进行基于行的编辑。每次编辑会用新内容替换精确的行序列。返回 git 样式的差异以显示所做的更改。仅在允许的目录中工作。

{
  "inputSchema": {
    "properties": {
      "dryRun": {
        "default": false,
        "description": "使用 git 样式的差异格式预览更改",
        "type": "boolean"
      },
      "edits": {
        "items": {
          "properties": {
            "newText": {
              "description": "要替换的新文本",
              "type": "string"
            },
            "oldText": {
              "description": "要搜索的文本 - 必须完全匹配",
              "type": "string"
            }
          },
          "required": ["oldText", "newText"],
          "type": "object"
        },
        "type": "array"
      },
      "path": {
        "description": "要编辑的文件路径。",
        "type": "string"
      }
    },
    "required": ["path", "edits"],
    "type": "object"
  }
}

get_file_info

检索文件或目录的详细元数据。返回包括大小、创建时间、最后修改时间、权限和类型的综合信息。此工具非常适合在不读取实际内容的情况下了解文件特性。仅在允许的目录中工作。

{
  "inputSchema": {
    "properties": {
      "path": {
        "description": "要检查的文件或目录路径。",
        "type": "string"
      }
    },
    "required": ["path"],
    "type": "object"
  }
}

read_file

从文件系统读取文件的内容。可以指定一个可选的 offset(以字节为单位)来从特定位置开始读取,以及一个可选的 length(以字节为单位)来限制要读取的字节数。如果 length 被省略或为 0,文件将读取到末尾。处理各种文本编码,并在文件无法读取时提供详细的错误信息。仅在允许的目录中工作。

{
  "inputSchema": {
    "properties": {
      "length": {
        "description": "要读取的字节数。如果省略或为 0,读取到文件末尾。",
        "minimum": 0,
        "type": "integer"
      },
      "offset": {
        "default": 0,
        "description": "从这个字节偏移量开始读取。",
        "minimum": 0,
        "type": "integer"
      },
      "path": {
        "description": "要读取的文件路径。",
        "type": "string"
      }
    },
    "required": ["path"],
    "type": "object"
  }
}

read_multiple_files

同时读取多个文件的内容。这比逐个读取文件更高效,当你需要分析或比较多个文件时。每个文件的内容会以其路径作为参考返回。单个文件读取失败不会停止整个操作。仅在允许的目录中工作。

{
  "inputSchema": {
    "properties": {
      "paths": {
        "description": "要读取的文件路径数组。",
        "items": {
          "type": "string"
        },
        "type": "array"
      }
    },
    "required": ["paths"],
    "type": "object"
  }
}

list_directory

获取指定路径中所有文件和目录的详细列表。结果通过 [FILE] 和 [DIR] 前缀清楚地区分文件和目录。此工具对于了解目录结构和查找特定文件非常有用。仅在允许的目录中工作。

{
  "inputSchema": {
    "properties": {
      "path": {
        "description": "要列出的目录路径。",
        "type": "string"
      }
    },
    "required": ["path"],
    "type": "object"
  }
}

move_file

移动或重命名文件和目录。可以在一次操作中移动文件到不同目录并重命名。如果目标已存在,操作将失败。可以在不同目录之间工作,并可用于在同一目录内进行简单重命名。源和目标都必须在允许的目录中。

{
  "inputSchema": {
    "properties": {
      "destination": {
        "description": "目标文件或目录路径。",
        "type": "string"
      },
      "source": {
        "description": "源文件或目录路径。",
        "type": "string"
      }
    },
    "required": ["source", "destination"],
    "type": "object"
  }
}

search_files

递归搜索匹配模式的文件和目录。从起始路径搜索所有子目录。搜索区分大小写并匹配部分名称。返回所有匹配项的完整路径。非常适合在不知道确切位置时查找文件。仅在允许的目录中搜索。

{
  "inputSchema": {
    "properties": {
      "excludePatterns": {
        "default": [],
        "description": "要排除的模式(可选)。",
        "items": {
          "type": "string"
        },
        "type": "array"
      },
      "path": {
        "description": "要开始搜索的目录路径。",
        "type": "string"
      },
      "pattern": {
        "description": "要匹配的模式。",
        "type": "string"
      }
    },
    "required": ["path", "pattern"],
    "type": "object"
  }
}

write_file

创建一个新文件或写入现有文件的内容。可以选择完全覆盖文件或通过指定 mode 参数追加到文件末尾。使用 overwrite 模式(默认)在写入前清除文件,或使用 append 模式将内容添加到文件末尾。处理带适当编码的文本内容。仅在允许的目录中工作。

{
  "inputSchema": {
    "properties": {
      "content": {
        "description": "要写入的内容。",
        "type": "string"
      },
      "mode": {
        "default": "overwrite",
        "description": "写入模式:'overwrite' 清除文件,'append' 添加到文件末尾。",
        "enum": ["overwrite", "append"],
        "type": "string"
      },
      "path": {
        "description": "要写入的文件路径。",
        "type": "string"
      }
    },
    "required": ["path", "content"],
    "type": "object"
  }
}

OSS

提供对象存储服务(OSS)集成。

名称

描述

参数

oss_env_init

创建并初始化 OSS 环境变量,指定 endpoint、access key ID、access key secret、security token 和 region。临时安全凭证通过 STS(Security Token Service)获取,更多信息请参见使用STS临时访问凭证访问OSS

{
  "inputSchema": {
    "properties": {
      "access_key_id": {
        "description": "OSS 身份验证的访问密钥 ID",
        "type": "string"
      },
      "access_key_secret": {
        "description": "OSS 身份验证的访问密钥 Secret",
        "type": "string"
      },
      "endpoint": {
        "description": "OSS 服务端点,例如:若未指定,默认为 https://oss-cn-hangzhou.aliyuncs.com",
        "type": "string"
      },
      "region": {
        "description": "OSS 区域,例如:cn-hangzhou。若未指定,默认为 cn-hangzhou",
        "type": "string"
      },
      "security_token": {
        "description": "OSS 身份验证的安全令牌",
        "type": "string"
      }
    },
    "required": ["access_key_id", "access_key_secret", "security_token"],
    "type": "object"
  }
}

oss_upload

将本地文件或目录上传到指定的 OSS Bucket。如果上传目录,会先压缩为 zip 文件再上传。可以指定 OSS 中的对象名称,若未指定,则默认使用文件或 zip 名称。注意:使用此工具前必须调用 oss_env_init 工具初始化 OSS 环境变量。

{
  "inputSchema": {
    "properties": {
      "bucket": {
        "description": "OSS Bucket 名称",
        "type": "string"
      },
      "object": {
        "description": "OSS Bucket 中的对象路径,例如:test/test.txt",
        "type": "string"
      },
      "path": {
        "description": "要上传的本地文件或非空目录的完整路径,例如:/tmp/test.txt /tmp(Linux)或 C:/tmp/test.txt C:/tmp(Windows)",
        "type": "string"
      }
    },
    "required": ["bucket", "object", "path"],
    "type": "object"
  }
}

oss_download

从指定的 OSS Bucket 下载对象到本地路径。如果父目录不存在,会自动创建。如果目标文件已存在,会被覆盖。注意:使用此工具前必须调用 oss_env_init 工具初始化 OSS 环境变量。

{
  "inputSchema": {
    "properties": {
      "bucket": {
        "description": "OSS Bucket 名称",
        "type": "string"
      },
      "object": {
        "description": "OSS Bucket 中的对象路径,例如:test/test.txt",
        "type": "string"
      },
      "path": {
        "description": "保存下载文件的本地完整路径,例如:/tmp/test.txt(Linux)或 C:/tmp/test.txt(Windows)",
        "type": "string"
      }
    },
    "required": ["bucket", "object", "path"],
    "type": "object"
  }
}

oss_upload_annon

使用 HTTP PUT 将本地文件或目录上传到指定 URL。如果上传目录,会先压缩为 zip 文件再上传。如果目标已存在,会被覆盖。

{
  "inputSchema": {
    "properties": {
      "path": {
        "description": "要上传的本地文件或非空目录的完整路径,例如:/tmp/test.txt /tmp(Linux)或 C:/tmp/test.txt  C:/tmp(Windows)",
        "type": "string"
      },
      "url": {
        "description": "上传文件的 HTTP/HTTPS URL",
        "type": "string"
      }
    },
    "required": ["url", "path"],
    "type": "object"
  }
}

oss_download_annon

从指定 URL 下载文件到本地路径。如果父目录不存在,会自动创建。如果目标文件已存在,会被覆盖。

{
  "inputSchema": {
    "properties": {
      "path": {
        "description": "保存下载文件的本地完整路径,例如:/tmp/test.txt(Linux)或 C:/tmp/test.txt(Windows)",
        "type": "string"
      },
      "url": {
        "description": "下载文件的 HTTP/HTTPS URL",
        "type": "string"
      }
    },
    "required": ["url", "path"],
    "type": "object"
  }
}

MCP Tool List

{"codespace":{"tools":[{"name":"run_code","description":"Runs the code in the specified context with timeout and returns the output or an error on linux platform.","inputSchema":{"properties":{"code":{"description":"Code to execute","type":"string"},"language":{"description":"The programming language to use for code execution. Supported values: 'python', 'javascript'. If not specified, Python will be used by default.","type":"string"},"timeout_s":{"default":300,"description":"Command execution timeout (unit: seconds). If not specified, the default value (such as 300 seconds) is used, Maximum 3600 seconds","type":"integer"}},"required":["code"],"type":"object"}}]},"shell":{"tools":[{"name":"shell","description":"Executes an shell command with timeout and returns the output or an error on linux platform.","inputSchema":{"properties":{"command":{"description":"client input command","type":"string"},"timeout_ms":{"default":1000,"description":"Command execution timeout (unit: milliseconds). If not specified, the default value (such as 1000 milliseconds) is used","type":"integer"}},"required":["command","timeout_ms"],"type":"object"}}]},"filesystem":{"tools":[{"name":"create_directory","description":"Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. If the directory already exists, this operation will succeed silently. Perfect for setting up directory structures for projects or ensuring required paths exist. Only works within allowed directories.","inputSchema":{"properties":{"path":{"description":"Directory path to create.","type":"string"}},"required":["path"],"type":"object"}},{"name":"edit_file","description":"Make line-based edits to a text file. Each edit replaces exact line sequences with new content. Returns a git-style diff showing the changes made. Only works within allowed directories.","inputSchema":{"properties":{"dryRun":{"default":false,"description":"Preview changes using git-style diff format","type":"boolean"},"edits":{"items":{"properties":{"newText":{"description":"Text to replace with","type":"string"},"oldText":{"description":"Text to search for - must match exactly","type":"string"}},"required":["oldText","newText"],"type":"object"},"type":"array"},"path":{"description":"File path to edit.","type":"string"}},"required":["path","edits"],"type":"object"}},{"name":"get_file_info","description":"Retrieve detailed metadata about a file or directory. Returns comprehensive information including size, creation time, last modified time, permissions, and type. This tool is perfect for understanding file characteristics without reading the actual content. Only works within allowed directories.","inputSchema":{"properties":{"path":{"description":"File or directory path to inspect.","type":"string"}},"required":["path"],"type":"object"}},{"name":"read_file","description":"Read the contents of a file from the file system. You can specify an optional 'offset' (in bytes) to start reading from a specific position, and an optional 'length' (in bytes) to limit how many bytes to read. If 'length' is omitted or 0, the file will be read to the end. Handles various text encodings and provides detailed error messages if the file cannot be read. Only works within allowed directories.","inputSchema":{"properties":{"length":{"description":"Number of bytes to read. If omitted or 0, read to end of file.","minimum":0,"type":"integer"},"offset":{"default":0,"description":"Start reading from this byte offset.","minimum":0,"type":"integer"},"path":{"description":"File path to read.","type":"string"}},"required":["path"],"type":"object"}},{"name":"read_multiple_files","description":"Read the contents of multiple files simultaneously. This is more efficient than reading files one by one when you need to analyze or compare multiple files. Each file's content is returned with its path as a reference. Failed reads for individual files won't stop the entire operation. Only works within allowed directories.","inputSchema":{"properties":{"paths":{"description":"Array of file paths to read.","items":{"type":"string"},"type":"array"}},"required":["paths"],"type":"object"}},{"name":"list_directory","description":"Get a detailed listing of all files and directories in a specified path. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is essential for understanding directory structure and finding specific files within a directory. Only works within allowed directories.","inputSchema":{"properties":{"path":{"description":"Directory path to list.","type":"string"}},"required":["path"],"type":"object"}},{"name":"move_file","description":"Move or rename files and directories. Can move files between directories and rename them in a single operation. If the destination exists, the operation will fail. Works across different directories and can be used for simple renaming within the same directory. Both source and destination must be within allowed directories.","inputSchema":{"properties":{"destination":{"description":"Destination file or directory path.","type":"string"},"source":{"description":"Source file or directory path.","type":"string"}},"required":["source","destination"],"type":"object"}},{"name":"search_files","description":"Recursively search for files and directories matching a pattern. Searches through all subdirectories from the starting path. The search is case-sensitive and matches partial names. Returns full paths to all matching items. Great for finding files when you don't know their exact location. Only searches within allowed directories.","inputSchema":{"properties":{"excludePatterns":{"default":[],"description":"Patterns to exclude (optional).","items":{"type":"string"},"type":"array"},"path":{"description":"Directory path to start search.","type":"string"},"pattern":{"description":"Pattern to match.","type":"string"}},"required":["path","pattern"],"type":"object"}},{"name":"write_file","description":"Create a new file or write content to an existing file. You can choose to completely overwrite the file or append to the end by specifying the 'mode' parameter. Use 'overwrite' mode (default) to clear the file before writing, or 'append' mode to add content to the end of the file. Handles text content with proper encoding. Only works within allowed directories.","inputSchema":{"properties":{"content":{"description":"Content to write.","type":"string"},"mode":{"default":"overwrite","description":"Write mode: 'overwrite' to clear file, 'append' to add to end.","enum":["overwrite","append"],"type":"string"},"path":{"description":"File path to write.","type":"string"}},"required":["path","content"],"type":"object"}}]},"oss":{"tools":[{"name":"oss_env_init","description":"Create and initialize OSS environment variables with the specified endpoint, access key ID, access key secret, security token, and region. The temporary security credentials obtained from the STS (Security Token Service). For more information, see: https://help.aliyun.com/zh/oss/developer-reference/use-temporary-access-credentials-provided-by-sts-to-access-oss?spm=a2c4g.11186623.help-menu-search-31815.d_1#9ab17afd7cs4t .","inputSchema":{"properties":{"access_key_id":{"description":"The Access Key ID for OSS authentication","type":"string"},"access_key_secret":{"description":"The Access Key Secret for OSS authentication","type":"string"},"endpoint":{"description":"The OSS service endpoint, e.g.,  If not specified, the default is https://oss-cn-hangzhou.aliyuncs.com","type":"string"},"region":{"description":"The OSS region, e.g., cn-hangzhou. If not specified, the default is cn-hangzhou","type":"string"},"security_token":{"description":"The Security Token for OSS authentication","type":"string"}},"required":["access_key_id","access_key_secret","security_token"],"type":"object"}},{"name":"oss_upload","description":"Upload a local file or directory to the specified OSS bucket. If a directory is specified, it will be compressed into a zip file before uploading. The object name in OSS can be specified; if not, the file or zip name will be used by default. Note: You must call the oss_env_init tool to initialize OSS environment variables before using this tool.","inputSchema":{"properties":{"bucket":{"description":"OSS bucket name","type":"string"},"object":{"description":"Object path in OSS bucket, e.g., test/test.txt","type":"string"},"path":{"description":"Local file or not empty directory full path to upload, e.g., /tmp/test.txt /tmp on Linux or C:/tmp/test.txt C:/tmp on Windows","type":"string"}},"required":["bucket","object","path"],"type":"object"}},{"name":"oss_download","description":"Download an object from the specified OSS bucket to the given local path. If the parent directory does not exist, it will be created automatically. If the target file already exists, it will be overwritten. Note: You must call the oss_env_init tool to initialize OSS environment variables before using this tool.","inputSchema":{"properties":{"bucket":{"description":"OSS bucket name","type":"string"},"object":{"description":"Object path in OSS bucket, e.g., test/test.txt","type":"string"},"path":{"description":"Local full path to save the downloaded file, e.g., /tmp/test.txt on Linux or C:/tmp/test.txt on Windows","type":"string"}},"required":["bucket","object","path"],"type":"object"}},{"name":"oss_upload_annon","description":"Upload a local file or directory to the specified URL using HTTP PUT. If a directory is specified, it will be compressed into a zip file before uploading. If the upload target already exists, it will be overwritten.","inputSchema":{"properties":{"path":{"description":"Local file or not empty directory full path to upload, e.g., /tmp/test.txt /tmp on Linux or C:/tmp/test.txt  C:/tmp on Windows","type":"string"},"url":{"description":"The HTTP/HTTPS URL to upload the file to","type":"string"}},"required":["url","path"],"type":"object"}},{"name":"oss_download_annon","description":"Download a file from the specified URL to the given local path. If the parent directory does not exist, it will be created automatically. If the target file already exists, it will be overwritten.","inputSchema":{"properties":{"path":{"description":"The full local file path to save the downloaded file, e.g., /tmp/test.txt on Linux or C:/tmp/test.txt on Windows","type":"string"},"url":{"description":"The HTTP/HTTPS URL to download the file from","type":"string"}},"required":["url","path"],"type":"object"}}]}}