Skip to main content
Glama

agentcast-mcp

npm tests mcp

AIアシスタントに構造化出力を強制する機能を提供するMCPサーバーです。雑多なLLMテキストからJSONを抽出し、形状仕様(shape spec)に基づいてゲート制御を行い、モデルが誤った形状を返した際に再試行用のフィードバックメッセージを生成します。

@mukundakatta/agentcastを基盤として構築されています。Claude Desktop、Cursor、Cline、Windsurf、Zed、およびその他のMCPクライアントで動作します。

公開されているツール

extract_json

雑多なLLM出力からJSON値を抽出します。テキスト全体、```json ```で囲まれたブロック、そして最も長いバランスの取れた{...} / [...]部分文字列の順に試行します。パースされた値と、どの戦略が成功したかを返します。

{
  "text": "Sure, here you go:\n```json\n{\"answer\": 42}\n```\nLet me know!"
}

→

{
  "value": { "answer": 42 },
  "found": true,
  "source": "fenced_json"
}

sourceはwhole、fenced_json、fenced_plain、balanced_substring、またはnoneのいずれかです。

validate_response

パースされたJSON値をagentcastの形状仕様(shape spec)に対して検証します。仕様はフィールド名を型(string、number、boolean、array、object)にマッピングします。末尾に?を付けると任意項目になります。

{
  "value": { "name": "ada" },
  "shape": { "name": "string", "age": "number" }
}

→

{
  "valid": false,
  "error": "missing required field 'age'"
}

build_retry_prompt

試行履歴に基づき、モデルが誤った形状を返した際にagentcastが会話に追加する検証エラーのフィードバックメッセージを生成します。手動で同じ再試行ループを実行したいNode.js以外のMCPクライアント向けに、「フィードバックとしての検証エラー」パターンをコード化します。

{
  "attempts": [
    { "text": "{\"name\":\"ada\"}", "error": "missing required field 'age'" }
  ],
  "expected_shape": { "name": "string", "age": "number" }
}

→

{
  "feedback": "Your previous response did not match the required shape. Error: missing required field 'age'\n\nTry again. Respond with ONLY valid JSON that fixes the error above.\n\nExpected shape: {\"name\":\"string\",\"age\":\"number\"}"
}

Related MCP server: genpark-structured-extract-schema-validator-skill

インストール

Claude Desktop

claude_desktop_config.jsonに追加します:

{
  "mcpServers": {
    "agentcast": {
      "command": "npx",
      "args": ["-y", "@mukundakatta/agentcast-mcp"]
    }
  }
}

Cursor / Cline / Windsurf / Zed

クライアントの適切なmcp.jsonに同様の形式で記述します。ほとんどのクライアントはnpx -y @mukundakatta/agentcast-mcpを介して自動検出します。

ローカルインストール

npm install -g @mukundakatta/agentcast-mcp
mcp-agentcast        # listens on stdio

なぜこれが重要なのか

LLMが構造化データを返す必要がある場合、JSONを文章やフェンス、あるいは幻覚的なフィールドで囲んでしまうことがあります。標準のJSON.parseではエラーが発生します。手作りの正規表現ではネストされた構造を見逃してしまいます。このMCPサーバーは、エージェントを駆動するあらゆるモデルに対し、(1)応答からJSONを抽出する、(2)期待される形状と一致するか確認する、(3)次のターンでモデルに修正を促す正確な再試行プロンプトを構築する、という実用的な手段を提供します。

ライセンス

MIT。

Available Tools

3 tools
build_retry_promptA

Given an attempt history, produce the retry feedback message agentcast would append to the conversation when the model returned the wrong shape. Codifies the "validation error as feedback" pattern for non-Node MCP clients.

Inputs: attempts (required), expected_shape.

extract_jsonA

Pull a JSON value out of messy LLM output. Tries the whole text, then a fenced json block, then the largest balanced {...}/[...] substring. Returns the parsed value plus which strategy succeeded.

Inputs: text (required).

validate_responseA

Validate a parsed JSON value against an agentcast shape spec. Spec maps field name to type: 'string', 'number', 'boolean', 'array', 'object'. Suffix with '?' for optional. Returns valid=true on success, or valid=false with a human-readable error string suitable for retry feedback.

Inputs: shape (required), value (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clear, distinct purpose: build_retry_prompt handles feedback generation, extract_json extracts JSON from text, and validate_response checks JSON against a spec. There is no functional overlap.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (build_retry_prompt, extract_json, validate_response), making them predictable and easy to understand.

    Tool Count4/5

    With only 3 tools, the server is slightly underpopulated but still appropriately scoped for the narrow domain of agent response validation and retry feedback. It covers the core workflow without unnecessary bloat.

    Completeness4/5

    The tools cover the essential pipeline of extracting JSON, validating it against a spec, and generating retry feedback. A minor gap is the lack of explicit handling of attempt history beyond what build_retry_prompt expects, but that is assumed provided by the client.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Deterministic JSON validation and repair for AI agents. Validates, repairs, schema-checks, and diffs JSON so long-running agents don't corrupt their session state with malformed writes.
      MIT