本文へ移動
cccskills
無料GitHub で公開

tool

Guide for creating tools using CallableTool2 and Params pattern, plus YAML agent registration

インストール方法を見る

含まれるファイル(2)

  • SKILL.md2.5 KB
  • references/guide.md10.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Tool Development Guide

Create custom tools with the CallableTool2 + Params pattern, then register them in a YAML agent file.

Quick Template

"""Brief description of what this tool does."""
from kimi_agent_sdk import CallableTool2, ToolError, ToolOk, ToolReturnValue

class Params(BaseModel):
    """Define tool parameters here."""
    required_param: str = Field(
        description="Description of this parameter for the LLM."
    )
    optional_param: str | None = Field(
        default=None,
        description="Optional parameter with default value."
    )

class MyTool(CallableTool2):
    name: str = "MyTool" # Tool identifier
    description: str = "What this tool does."  # For LLM to understand usage
    params: type[Params] = Params # Link to Params class

    async def __call__(self, params: Params) -> ToolReturnValue:
        """Execute the tool logic."""
        try:
            # Your tool logic here
            result = f"Processed: {params.required_param}"
            return ToolOk(output=result)
        except Exception as e:
            return ToolError(
                message=str(e),
                output="Partial output if available",
                brief="Short error summary"
            )

Key Patterns

  • Return values: ToolOk(output=...) on success; ToolError(message=..., output=..., brief=...) on failure.
  • Validators: ge/le/gt/lt (numeric), min_length/max_length/pattern (strings/collections), default_factory for mutable defaults.
  • Best practices: type hints everywhere; clear Field(description=...); always async __call__; handle exceptions → ToolError; one tool = one job.

Registration

Every new tool must be registered in a YAML agent file as "module.path:ClassName" under tools:. KimiToolset.load_tools() splits on the last :, imports the module, gets the class, instantiates, and adds it. Agent files: agent_worker.json (default), agent_boss.json, agent_subagent.json; base agents in kimi-cli/src/kimi_cli/agents/default/ (agent.yaml, coder.yaml, explore.yaml, plan.yaml). Child YAML tools: replaces the parent's list; use allowed_tools:/exclude_tools: to restrict. Use kimix.tools.* prefix for new tools under src/kimix/tools/.

Full complete example, Params reference, background-task tools, interactive-session reuse, and YAML details: read references/guide.md.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

app

無料

Guide for the Kimix web frontend (src/app/) — vanilla TypeScript + Vite, SSE-based chat UI mirroring sse_cli.py. Use when modifying the frontend, adding new UI features, changing the API client, or understanding the message rendering pipeline.

日本語の概要は準備中です。原文の説明を表示しています。

Sikao-Engine/KimiX1142026年10月10日 更新

doc

無料

Guide for navigating and maintaining Kimix project documentation. Use when: (1) user asks about the docs structure, (2) user wants to add, update, or append content to project documents.

日本語の概要は準備中です。原文の説明を表示しています。

Sikao-Engine/KimiX1142026年10月10日 更新

kimix_api

無料

Guide for using KimiX API utilities covering kimix, kimix.utils, kimix.base, kimix.dag, kimix.network, kimix.server, kimix.parser, kimix.tools, kimix.cot, kimix.retrieval, kimix.summarize, and kimi_agent_sdk.

日本語の概要は準備中です。原文の説明を表示しています。

Sikao-Engine/KimiX1142026年10月10日 更新

Guide for Kimix opencode-style HTTP server (FastAPI + SSE), including route definitions, builtin endpoints, and app.post usage.

日本語の概要は準備中です。原文の説明を表示しています。

Sikao-Engine/KimiX1142026年10月10日 更新

serve

無料

Guide for the Kimix HTTP serve system — FastAPI backend + TypeScript/Vite frontend. Use when adding new backend endpoints, modifying the session manager, changing the frontend API client, or understanding how data flows from backend to UI. Covers dummy_app.py, dummy_session_manager.py, sse_cli.py, and src/app/.

日本語の概要は準備中です。原文の説明を表示しています。

Sikao-Engine/KimiX1142026年10月10日 更新

Guide for creating effective skills. Use when users want to create or update a skill that extends agent's capabilities.

日本語の概要は準備中です。原文の説明を表示しています。

Sikao-Engine/KimiX1142026年10月10日 更新

Sikao-Engine のスキルをすべて見る

このスキルの問題を報告する