用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/advent259141/astrbot_self_manager_skill --skill tool-manager命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | tool-manager |
| description | 管理 LLM 工具和内置指令的启停和列出操作 |
| version | 2.0.0 |
| author | AstrBot Community |
| requires_admin | true |
| requires_computer_use | true |
管理 LLM 工具(FunctionTool)和内置指令(Command)。
async def list_llm_tools(context):
try:
tools = context.get_llm_tool_manager().func_list
if not tools:
return "没有已注册的 LLM 工具。"
lines = ["🛠️ 已注册的 LLM 工具:\n"]
for tool in tools:
name = tool.name
desc = tool.description or "无描述"
active = getattr(tool, 'active', True)
status = "✅启用" if active else "❌禁用"
lines.append(f"- [{status}] **{name}**: {desc}")
return "\n".join(lines)
except Exception as e:
return f"❌ 列出工具失败:{e}"
event = globals().get('event')
if not event.is_admin():
print("❌ 错误:仅管理员可用")
import sys; sys.exit(1)
context = globals().get('context')
result = await list_llm_tools(context)
print(result)
async def toggle_llm_tool(context, tool_name: str, enable: bool):
try:
tool_mgr = context.get_llm_tool_manager()
tool = tool_mgr.get_func(tool_name)
if not tool:
return f"❌ 工具「{tool_name}」不存在。"
tool.active = enable
action = "启用" if enable else "禁用"
return f"✅ 已{action}工具「{tool_name}」。"
except Exception as e:
return f"❌ 操作失败:{e}"
result = await toggle_llm_tool(context, tool_name="<工具名>", enable=False)
print(result)
async def list_commands(context):
try:
from astrbot.core.star.star_handler import CommandHandler
commands = CommandHandler.get_all_commands()
if not commands:
return "没有已注册的指令。"
lines = ["⚡ 已注册的指令:\n"]
for cmd in commands:
name = cmd.get("name", "")
desc = cmd.get("description", "无描述")
enabled = cmd.get("enabled", True)
status = "✅启用" if enabled else "❌禁用"
lines.append(f"- [{status}] **/{name}**: {desc}")
return "\n".join(lines)
except Exception as e:
return f"❌ 列出指令失败:{e}"
result = await list_commands(context)
print(result)
async def toggle_command(context, command_name: str, enable: bool):
try:
from astrbot.core.star.star_handler import CommandHandler
success = CommandHandler.set_command_enabled(command_name, enable)
if success:
action = "启用" if enable else "禁用"
return f"✅ 已{action}指令「/{command_name}」。"
else:
return f"❌ 指令「/{command_name}」不存在。"
except Exception as e:
return f"❌ 操作失败:{e}"
result = await toggle_command(context, command_name="<指令名>", enable=False)
print(result)