Surface chapter kind through the MCP server

create_chapter/update_chapter now pass kind through to the API,
matching the FrontMatter/Body/BackMatter option added to the embedded
agent's toolset.
This commit is contained in:
James Wampler
2026-08-19 18:03:18 -07:00
parent 7f56c79b20
commit 6b0cdd0d71
+9 -5
View File
@@ -24,13 +24,15 @@ public static class ManuscriptTools
api.GetAsync($"/api/chapters/{chapterId}", ct); api.GetAsync($"/api/chapters/{chapterId}", ct);
[McpServerTool(Name = "create_chapter")] [McpServerTool(Name = "create_chapter")]
[Description("Add a chapter to a novel. It goes at the end of the manuscript unless you supply a number.")] [Description("Add a chapter to a novel. It goes at the end of the manuscript unless you supply a number. "
+ "Use 'kind' for a foreword, prologue, afterword, or other unnumbered front/back matter.")]
public static Task<CallToolResult> CreateChapter( public static Task<CallToolResult> CreateChapter(
NovelApiClient api, NovelApiClient api,
[Description("The novel's id.")] Guid novelId, [Description("The novel's id.")] Guid novelId,
[Description("Chapter title.")] string title, [Description("Chapter title.")] string title,
CancellationToken ct, CancellationToken ct,
[Description("Position in the manuscript, 1-based.")] int? number = null, [Description("Manuscript position, 1-based, counting front and back matter.")] int? number = null,
[Description("FrontMatter, Body, or BackMatter. Defaults to Body.")] string? kind = null,
[Description("The chapter's outline summary paragraph.")] string? summary = null, [Description("The chapter's outline summary paragraph.")] string? summary = null,
[Description("Where and when the chapter takes place. Unknown locations are created.")] string[]? locations = null, [Description("Where and when the chapter takes place. Unknown locations are created.")] string[]? locations = null,
[Description("Planned, Outlined, Drafted, Revised or Final.")] string? status = null, [Description("Planned, Outlined, Drafted, Revised or Final.")] string? status = null,
@@ -41,6 +43,7 @@ public static class ManuscriptTools
{ {
title, title,
number, number,
kind = kind ?? "Body",
summary, summary,
locations, locations,
status = status ?? "Planned", status = status ?? "Planned",
@@ -50,7 +53,7 @@ public static class ManuscriptTools
}, ct); }, ct);
[McpServerTool(Name = "update_chapter")] [McpServerTool(Name = "update_chapter")]
[Description("Revise a chapter's title, number, summary, locations, notes, status " [Description("Revise a chapter's title, number, kind, summary, locations, notes, status "
+ "or drafted prose. Use 'prose' to write or replace the chapter's draft text in " + "or drafted prose. Use 'prose' to write or replace the chapter's draft text in "
+ "markdown; the word count is recomputed automatically.")] + "markdown; the word count is recomputed automatically.")]
public static Task<CallToolResult> UpdateChapter( public static Task<CallToolResult> UpdateChapter(
@@ -58,7 +61,8 @@ public static class ManuscriptTools
[Description("The chapter's id.")] Guid chapterId, [Description("The chapter's id.")] Guid chapterId,
CancellationToken ct, CancellationToken ct,
[Description("New title.")] string? title = null, [Description("New title.")] string? title = null,
[Description("Position in the manuscript.")] int? number = null, [Description("Manuscript position, 1-based, counting front and back matter.")] int? number = null,
[Description("FrontMatter, Body, or BackMatter.")] string? kind = null,
[Description("The chapter's outline summary paragraph.")] string? summary = null, [Description("The chapter's outline summary paragraph.")] string? summary = null,
[Description("Where and when the chapter takes place. Replaces the existing locations. Unknown locations are created.")] string[]? locations = null, [Description("Where and when the chapter takes place. Replaces the existing locations. Unknown locations are created.")] string[]? locations = null,
[Description("Anything else worth recording.")] string? notes = null, [Description("Anything else worth recording.")] string? notes = null,
@@ -67,5 +71,5 @@ public static class ManuscriptTools
[Description("The chapter's drafted text, in markdown.")] string? prose = null, [Description("The chapter's drafted text, in markdown.")] string? prose = null,
[Description("Tags for cross-referencing. Replaces the existing tags.")] string[]? tags = null) => [Description("Tags for cross-referencing. Replaces the existing tags.")] string[]? tags = null) =>
api.PatchAsync($"/api/chapters/{chapterId}", api.PatchAsync($"/api/chapters/{chapterId}",
new { title, number, summary, locations, notes, status, targetWordCount, prose, tags }, ct); new { title, number, kind, summary, locations, notes, status, targetWordCount, prose, tags }, ct);
} }