# Zephyr MCP Tool Docstring Hints
# Generated from src/tools/*.py
=== fetch_branch_or_pr ===
Source: src/tools/fetch_branch_or_pr.py
Function Description: Fetch a branch or pull request from a Git repository and checkout
功能描述: 从Git仓库获取分支或拉取请求并检出
Parameters:
参数说明:
- project_dir (str): Required. Project directory
- project_dir (str): 必须。项目目录
- branch_name (Optional[str]): Optional. Branch name to fetch
- branch_name (Optional[str]): 可选。要获取的分支名称
- pr_number (Optional[int]): Optional. Pull request number to fetch
- pr_number (Optional[int]): 可选。要获取的拉取请求编号
- remote_name (str): Optional. Remote name, default is "origin"
- remote_name (str): 可选。远程仓库名称,默认为"origin"
Returns:
返回值:
- Dict[str, Any]: Contains status, log and error information
- Dict[str, Any]: 包含状态、日志和错误信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中
=== get_git_config_status ===
Source: src/tools/get_git_config_status.py
Function Description: Get current Git configuration status
功能描述: 获取当前Git配置状态
Parameters:
参数说明:
- project_dir (Optional[str]): Optional. Project directory to check local configuration
- project_dir (Optional[str]): 可选。项目目录,用于检查本地配置
Returns:
返回值:
- Dict[str, Any]: Contains Git configuration information
- Dict[str, Any]: 包含Git配置信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中
=== get_git_redirect_status ===
Source: src/tools/get_git_redirect_status.py
Function Description: Get current Git redirect configuration status
功能描述: 获取当前Git重定向配置状态
Parameters:
参数说明:
- No parameters
- 无参数
Returns:
返回值:
- Dict[str, Any]: Contains redirect configuration status information
- Dict[str, Any]: 包含重定向配置状态信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中
=== get_zephyr_status ===
Source: src/tools/get_zephyr_status.py
Function Description: Get Git status information of Zephyr project
功能描述: 获取Zephyr项目的Git状态信息
Parameters:
参数说明:
Returns:
返回值:
Exception Handling:
异常处理:
=== trigger_remote_test ===
Source: src/tools/trigger_remote_test.py
Function Description: Create a remote test trigger prompt template
功能描述: 生成远程测试触发请求的模板
Parameters:
参数说明:
- jobFullName (str): Remote job full name. Default: "zephyr_test_pipe_quick".
- jobFullName (str): 远程作业完整名称,默认为 "zephyr_test_pipe_quick"。
- parameters (Optional[Dict[str, Any]]): Optional parameter overrides (structured output only).
- parameters (Optional[Dict[str, Any]]): 可选参数覆盖(仅结构化输出)。
Returns:
返回值:
- Dict[str, Any]:
- status: "success"
- prompt: The template text to paste/edit
- request: A machine-readable request object (jobFullName + parameters)
- instructions: Short instructions asking user to update content
- Dict[str, Any]:
- status: "success"
- prompt: 可粘贴/编辑的模板文本
- request: 机器可读的请求对象(jobFullName + parameters)
- instructions: 提示用户更新内容的简短说明
Exception Handling:
异常处理:
- No direct remote execution is performed; only prompt/template generation.
- 不直接执行远程操作,仅生成请求模板。
=== git_checkout ===
Source: src/tools/git_checkout.py
Function Description: Switch to specified Git reference (SHA, tag or branch) in Zephyr project directory
功能描述: 在Zephyr项目目录中切换到指定的Git引用(SHA号、tag或分支)
Parameters:
参数说明:
- project_dir (str): Required. Zephyr project directory
- project_dir (str): 必须。Zephyr项目目录
- ref (str): Required. Git reference (SHA, tag or branch name)
- ref (str): 必须。Git引用(SHA号、tag或分支名称)
Returns:
返回值:
- Dict[str, Any]: Contains status, log and error information
- Dict[str, Any]: 包含状态、日志和错误信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中
=== git_rebase ===
Source: src/tools/git_rebase.py
Function Description: Execute Git rebase operation
功能描述: 执行Git rebase操作
Parameters:
参数说明:
- project_dir (str): Required. Project directory
- project_dir (str): 必须。项目目录
- source_branch (str): Required. Source branch to rebase from
- source_branch (str): 必须。要从中rebase的源分支
- onto_branch (Optional[str]): Optional. Target branch to rebase onto. If None, rebases current branch onto source_branch
- onto_branch (Optional[str]): 可选。要rebase到的目标分支。如果为None,则将当前分支rebase到source_branch上
- interactive (bool): Optional. Whether to perform interactive rebase. Default: False
- interactive (bool): 可选。是否执行交互式rebase。默认:False
- force (bool): Optional. Whether to force rebase without confirmation. Default: False
- force (bool): 可选。是否强制rebase而不进行确认。默认:False
Returns:
返回值:
- Dict[str, Any]: Contains status, log and error information
- Dict[str, Any]: 包含状态、日志和错误信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中
=== git_redirect_zephyr_mirror ===
Source: src/tools/git_redirect_zephyr_mirror.py
Function Description: Configure Git global redirect to redirect GitHub Zephyr repository to specified mirror
功能描述: 配置Git全局重定向,将GitHub的Zephyr仓库地址重定向到指定的镜像源
Parameters:
参数说明:
- enable (bool): Optional. Whether to enable redirect, default is True (enabled)
- enable (bool): 可选。是否启用重定向,默认为True(启用)
- mirror_url (Optional[str]): Optional. Mirror URL, defaults to domestic mirror
- mirror_url (Optional[str]): 可选。镜像源地址,默认为国内镜像源
Returns:
返回值:
- Dict[str, Any]: Contains status, log and error information
- Dict[str, Any]: 包含状态、日志和错误信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中
=== init_llm ===
Source: src/tools/llm_tools.py
Initialize LLM integration
初始化LLM集成
Args:
config: LLM configuration dictionary
config: LLM配置字典
=== get_llm ===
Source: src/tools/llm_tools.py
Get LLM integration instance
获取LLM集成实例
Returns:
LLMIntegration: LLM integration instance
LLMIntegration: LLM集成实例
=== get_registered_tools ===
Source: src/tools/llm_tools.py
Get information about all registered LLM tools
获取所有注册的LLM工具信息
Returns:
Dict: Tool information dictionary
Dict: 工具信息字典
=== llm_tools ===
Source: src/tools/llm_tools.py
MCP tool entrypoint providing LLM tool metadata and status.
This is designed to be registered via `mcp.add_tool('llm_tools', llm_tools)`.
=== register_llm_tools ===
Source: src/tools/llm_tools.py
Register LLM-related tools on a given MCP instance.
Supports fastmcp.FastMCP (via mcp.tool) and simple MCP mocks (via add_tool).
=== generate_text ===
Source: src/tools/llm_tools.py
Generate text response using large language model
使用大模型生成文本响应
Args:
prompt: User prompt text
prompt: 用户提示文本
model: Model name to use (uses default if not specified)
model: 要使用的模型名称(如不指定,使用默认模型)
system_prompt: System prompt text to guide model behavior
system_prompt: 系统提示文本,用于指导模型行为
temperature: Generation temperature, controls output randomness (0.0-2.0)
temperature: 生成温度,控制输出的随机性 (0.0-2.0)
max_tokens: Maximum number of tokens to generate
max_tokens: 最大生成的token数量
Returns:
Dictionary containing generated text and metadata
包含生成文本和元数据的字典
=== analyze_code ===
Source: src/tools/llm_tools.py
Analyze code and answer related questions using large language model
使用大模型分析代码并回答相关问题
Args:
code: Code to analyze
code: 要分析的代码
query: Question about the code
query: 关于代码的问题
model: Model name to use
model: 要使用的模型名称
Returns:
Dictionary containing analysis results
包含分析结果的字典
=== explain_error ===
Source: src/tools/llm_tools.py
Explain error messages and provide solutions using large language model
使用大模型解释错误信息并提供解决方案
Args:
error_message: Error message
error_message: 错误信息
context: Context where the error occurred (code snippet, execution environment, etc.)
context: 错误发生的上下文(如代码片段、执行环境等)
model: Model name to use
model: 要使用的模型名称
Returns:
Dictionary containing error explanation and solutions
包含错误解释和解决方案的字典
=== generate_tool_documentation ===
Source: src/tools/llm_tools.py
Generate documentation for the specified tool function
为指定的工具函数生成文档
Args:
tool_function_name: Tool function name
tool_function_name: 工具函数名称
model: Model name to use
model: 要使用的模型名称
Returns:
Dictionary containing generated documentation
包含生成文档的字典
=== llm_chat ===
Source: src/tools/llm_tools.py
Conduct multi-turn conversations using large language model
使用大模型进行多轮对话
Args:
messages: List of conversation messages, each containing role and content
messages: 对话消息列表,每个消息包含role和content
model: Model name to use
model: 要使用的模型名称
temperature: Generation temperature
temperature: 生成温度
max_tokens: Maximum number of tokens to generate
max_tokens: 最大生成token数
Returns:
Dictionary containing conversation response
包含对话响应的字典
=== get_llm_status ===
Source: src/tools/llm_tools.py
Get large language model integration status
获取大模型集成状态
Returns:
Dictionary containing large language model status information
包含大模型状态信息的字典
=== run_twister ===
Source: src/tools/run_twister.py
Function Description: Execute twister test or build command and return structured results
功能描述: 执行twister测试或编译命令并返回结构化结果
Parameters:
参数说明:
- platform (Optional[str]): Optional. Target hardware platform
- platform (Optional[str]): 可选。目标硬件平台
- tests (Optional[Union[List[str], str]]): Optional. Test path or suite name (using -T parameter)
- tests (Optional[Union[List[str], str]]): 可选。测试路径或套件名称(使用-T参数)
- test_cases (Optional[Union[List[str], str]]): Optional. Test case name (using -s parameter)
- test_cases (Optional[Union[List[str], str]]): 可选。测试用例名称(使用-s参数)
- enable_slow (bool): Optional. Whether to enable slow tests, default is False
- enable_slow (bool): 可选。是否启用慢测试,默认为False
- build_only (bool): Optional. Whether to build only, default is False
- build_only (bool): 可选。是否仅编译,默认为False
- extra_args (Optional[str]): Optional. Additional twister parameters
- extra_args (Optional[str]): 可选。额外的twister参数
- project_dir (str): Required. Zephyr project root directory
- project_dir (str): 必须。Zephyr项目根目录
Returns:
返回值:
- Dict[str, Any]: Contains status, log, statistics and error information
- Dict[str, Any]: 包含状态、日志、统计信息和错误信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中
=== set_git_credentials ===
Source: src/tools/set_git_credentials.py
Function Description: Set Git credentials for authentication
功能描述: 设置Git认证凭据
Parameters:
参数说明:
- username (str): Required. Git username or access token
- username (str): 必须。Git用户名或访问令牌
- password (str): Required. Git password or personal access token
- password (str): 必须。Git密码或个人访问令牌
- project_dir (Optional[str]): Optional. Project directory for local configuration
- project_dir (Optional[str]): 可选。项目目录,用于本地配置
Returns:
返回值:
- Dict[str, Any]: Contains status, log and error information
- Dict[str, Any]: 包含状态、日志和错误信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中
=== print ===
Source: src/tools/setup_zephyr_environment.py
Module-local print that logs to file.
This keeps legacy `print(...)` call sites working while ensuring output goes to
the repo `logs/` folder (and can be captured by debug capture handlers).
=== setup_zephyr_environment ===
Source: src/tools/setup_zephyr_environment.py
Set up a complete Zephyr RTOS development environment according to official getting started guide.
This tool automates the process of setting up a Zephyr RTOS development environment by:
1. Creating the workspace directory structure
2. Installing necessary Python dependencies (west, pyelftools, pykwalify, etc.)
3. Initializing a West workspace with the specified Zephyr version
4. Installing the Zephyr SDK (if enabled)
5. Setting up platform-specific environment variables
6. Handling common issues and providing detailed error messages
Args:
workspace_path: Path where the Zephyr workspace will be created
zephyr_version: Zephyr version to install (e.g., "main", "v3.5.0", or "latest")
install_sdk: Whether to install the Zephyr SDK
sdk_version: Version of the Zephyr SDK to install
platforms: List of target platforms to support (e.g., ["arm", "riscv", "x86"])
force: Overwrite existing workspace if it exists
Returns:
Dict with keys:
- "status": "success" or "error"
- "message": Summary of the operation
- "details": Additional information (workspace path, SDK path, etc.)
- "warnings": Any non-critical issues encountered
Example:
>>> result = setup_zephyr_environment("C:/zephyr", zephyr_version="v3.5.0")
>>> if result["status"] == "success":
... logger.info(f"Zephyr environment set up at: {result['details']['workspace_path']}")
=== validate_zephyr_environment ===
Source: src/tools/setup_zephyr_environment.py
Validate that a Zephyr environment is properly set up according to official requirements.
Args:
workspace_path: Path to the Zephyr workspace
Returns:
Dict containing validation results with status and detailed information
=== switch_zephyr_version ===
Source: src/tools/switch_zephyr_version.py
Function Description: Switch to specified Zephyr version (SHA or tag) and run west update
功能描述: 切换到指定的Zephyr版本(SHA号或tag)并运行west update
Parameters:
参数说明:
- project_dir (str): Required. Zephyr project directory
- project_dir (str): 必须。Zephyr项目目录
- ref (str): Required. Git reference (SHA, tag or branch name)
- ref (str): 必须。Git引用(SHA号、tag或分支名称)
Returns:
返回值:
- Dict[str, Any]: Contains status, log and error information
- Dict[str, Any]: 包含状态、日志和错误信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中
=== test_git_connection ===
Source: src/tools/test_git_connection.py
Function Description: Test Git connection with provided credentials
功能描述: 使用提供的凭据测试Git连接
Parameters:
参数说明:
- repo_url (str): Required. Git repository URL to test
- repo_url (str): 必须。要测试的Git仓库地址
- username (Optional[str]): Optional. Git username for authentication
- username (Optional[str]): 可选。Git认证用户名
- password (Optional[str]): Optional. Git password for authentication
- password (Optional[str]): 可选。Git认证密码
- project_dir (Optional[str]): Optional. Project directory for testing
- project_dir (Optional[str]): 可选。项目目录,用于测试
Returns:
返回值:
- Dict[str, Any]: Contains status, connection test results and error information
- Dict[str, Any]: 包含状态、连接测试结果和错误信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中
=== validate_west_init_params ===
Source: src/tools/validate_west_init_params.py
Function Description: Validate west init parameters and provide helpful suggestions
功能描述: 验证west init参数并提供有用的建议
Parameters:
参数说明:
- repo_url (Optional[str]): Git repository URL to validate
- repo_url (Optional[str]): Git仓库地址用于验证
- branch (Optional[str]): Git branch name to validate
- branch (Optional[str]): Git分支名称用于验证
- project_dir (Optional[str]): Local project directory to validate
- project_dir (Optional[str]): 本地项目目录用于验证
- auth_method (str): Authentication method to validate
- auth_method (str): 认证方法用于验证
Returns:
返回值:
- Dict[str, Any]: Contains validation status, suggestions, and error information
- Dict[str, Any]: 包含验证状态、建议和错误信息
Exception Handling:
异常处理:
- Does not throw exceptions, only returns validation results
- 不抛出异常,仅返回验证结果
=== west_flash ===
Source: src/tools/west_flash.py
Function Description: Execute west flash command to flash firmware
功能描述: 执行west flash命令烧录固件
Parameters:
参数说明:
- build_dir (str): Required. Build output directory
- build_dir (str): 必须。构建输出目录
- board (Optional[str]): Optional. Target hardware board model
- board (Optional[str]): 可选。目标硬件板型号
- runner (Optional[str]): Optional. Flasher type (e.g., jlink, pyocd, openocd, etc.)
- runner (Optional[str]): 可选。烧录器类型(如jlink, pyocd, openocd等)
- probe_id (Optional[str]): Optional. Flasher ID/serial number
- probe_id (Optional[str]): 可选。烧录器ID/序列号
- flash_extra_args (Optional[str]): Optional. Additional flash parameters
- flash_extra_args (Optional[str]): 可选。额外的flash参数
Returns:
返回值:
- Dict[str, Any]: Contains status, log and error information
- Dict[str, Any]: 包含状态、日志和错误信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中
=== west_update ===
Source: src/tools/west_update.py
Function Description: Run west update command in Zephyr project directory
功能描述: 在Zephyr项目目录中运行west update命令
Parameters:
参数说明:
- project_dir (str): Required. Zephyr project directory
- project_dir (str): 必须。Zephyr项目目录
Returns:
返回值:
- Dict[str, Any]: Contains status, log and error information
- Dict[str, Any]: 包含状态、日志和错误信息
Exception Handling:
异常处理:
- Tool detection failure or command execution exception will be reflected in the returned error information
- 工具检测失败或命令执行异常会体现在返回的错误信息中