Skill Wiki v0.1.0

文档 / reference / mcp

本页目录

MCP 工具 schema

@skill-wiki/mcp-server-core 暴露的 5 个工具。schema 在启动时通过 MCP SDK 注册。

prime_query

按 intent 加预算搜排序后的原子。

Input:
{
  "scope":          string,           // optional, e.g. "focus:cta"
  "tags":           string[],          // optional, multi-axis tags
  "level":          "summary" | "core" | "full",
  "budget_tokens":  number,            // optional cap; default 1200
  "kinds":          string[],          // optional kind filter
  "exclude_ids":    string[]           // optional anti-list
}

Output:
{
  "hits": [
    {
      "id":          string,           // "@scope/kind-name"
      "kind":        string,
      "tokens":      number,           // for the requested level
      "path":        string,           // file path the agent should Read
      "explanation": string            // human-readable rank reasoning
    }
  ],
  "total_tokens": number
}

prime_resolve

brief 转排序后的原子(内部把 L1、L2、L3 走完)。

Input:
{
  "brief":      string,                // free-text task
  "max_tokens": number,                // optional, default 1500
  "domain":     string                 // optional override
}

Output:
{
  "intent":     IntentObject,          // L1 output (domain-shape)
  "hits":       Hit[],                  // L2 retrieval
  "contract":   {                       // L3 contract resolution
    "must_include": string[],
    "must_avoid":   string[]
  },
  "total_tokens": number
}

prime_intent

brief 转 IntentObject(只走 L1,做分类器测试时有用)。

Input:
{
  "brief": string,
  "domain": string
}

Output: IntentObject  // domain-defined shape (per domain.yaml)

prime_validate

生成产物加原子集合,给出裁决(L5)。

Input:
{
  "artifact":  string,                  // generated output
  "atom_set":  string[],                // atom ids that contributed
  "validators": string[]                // optional; default: all from domain.yaml
}

Output:
{
  "ok": boolean,
  "fixes": [
    {
      "validator":  string,
      "severity":   "warning" | "error",
      "message":    string,
      "suggestion": string                // optional
    }
  ]
}

prime_compile

临时编译一份 .prime 源码,调试用。

Input:
{
  "source": string,                     // .prime file content
  "deep":   boolean                     // include L2 (default false)
}

Output:
{
  "ok":            boolean,
  "diagnostics":   Diagnostic[],
  "compiled":      {
    "atom_yaml":   object,              // parsed atom.yaml
    "graph_yaml":  object,              // parsed graph.yaml
    "chunks":      {
      "summary":   string,
      "core":      string,
      "full":      string
    }
  } | null
}

公共类型

type Hit = {
  id: string,
  kind: string,
  tokens: number,
  path: string,
  explanation: string
};

type Diagnostic = {
  level: "error" | "warning" | "info",
  layer: "L1" | "L2" | "L3",
  atom: string,
  message: string,
  hint?: string,
  source?: { file: string, line: number }
};

版本

工具 schema 是协议表面的一部分。破坏性改动走 @skill-wiki/mcp-server-core 的主版本号; 非破坏性新增走次版本号。