Skip to content

MCP Tools Reference

Complete reference for all papersmith MCP tools.

build_document

The most efficient way to create documents. Instead of making 10+ individual tool calls, provide all content in a single structured payload.

Parameter Type Default Description
content list[dict] required List of content items (see below)
preset str "academic" Style preset name
metadata dict? None {author, title, subject, scrub}
cover_page dict? None {title, author, institution, subtitle, date}
header str? None Header text for all pages
footer str? None Footer text for all pages
page_numbers str? None Position, e.g. "footer-center"
include_toc bool False Add Table of Contents
save_path str? None Save immediately to this path

Content item types:

Type Fields
heading text, level
text text, bold, italic
equation latex
table headers, rows
code code, language
numbered_list items
bullet_list items
page_break (none)
image path, width, caption
chart chart_type, data, title, xlabel, ylabel, caption

Session Management

create_document

Create a new document session with a style preset.

Parameter Type Default Description
preset str "academic" Style preset name
name str? auto-generated Optional session name

open_document

Open an existing .docx file into a session.

Parameter Type Default Description
path str required Path to the .docx file
name str? auto-generated Optional session name

list_documents

List all open document session IDs. No parameters.


Content

add_heading

Parameter Type Default Description
doc_id str required Document session ID
text str required Heading text
level int 1 Heading level (1–6)

add_text

Add a paragraph. Supports inline LaTeX with $...$.

Parameter Type Default Description
doc_id str required Document session ID
text str required Paragraph text
bold bool False Bold formatting
italic bool False Italic formatting

add_equation

Parameter Type Default Description
doc_id str required Document session ID
latex str required LaTeX expression (no $ delimiters)

add_table

Parameter Type Default Description
doc_id str required Document session ID
headers list[str] required Column headers
rows list[list[str]] required Table data rows

add_code_block

Parameter Type Default Description
doc_id str required Document session ID
code str required Code text
language str? None Programming language

add_image

Parameter Type Default Description
doc_id str required Document session ID
image_path str required Absolute path to image file
width float 12.0 Image width in cm
caption str? None Caption text

add_chart

Parameter Type Default Description
doc_id str required Document session ID
chart_type str required bar, line, pie, or scatter
data dict[str, float] required Label→value mapping
title str? None Chart title
xlabel str? None X-axis label
ylabel str? None Y-axis label
caption str? None Caption text

Structure

add_cover_page

Parameter Type Default Description
doc_id str required Document session ID
title str required Document title
author str? None Author name
institution str? None Institution
subtitle str? None Subtitle

add_page_break

Insert a page break. Only requires doc_id.

add_toc

Parameter Type Default Description
doc_id str required Document session ID
title str "Table of Contents" TOC title
max_level int 3 Max heading level

add_numbered_list / add_bullet_list

Parameter Type Default Description
doc_id str required Document session ID
items list[str] required List items

Layout

Parameter Type Default Description
doc_id str required Document session ID
text str required Header/footer text

add_page_numbers

Parameter Type Default Description
doc_id str required Document session ID
position str "footer-center" Position string

Document Editing

get_document_info

Get a comprehensive summary of the document in one call: paragraph count, heading outline, metadata, word count, and text preview.

Parameter Type Default Description
doc_id str required Document session ID

get_outline

Returns the document heading structure as a list of {level, text} objects.

get_full_text

Returns all document text joined by newlines.

get_section_text

Parameter Type Default Description
doc_id str required Document session ID
heading str required Exact heading text

replace_section

Replace the content under a heading (keeping the heading itself).

Parameter Type Default Description
doc_id str required Document session ID
heading str required Exact heading text
new_content str required New text content

delete_section

Delete a heading and all its content.

Parameter Type Default Description
doc_id str required Document session ID
heading str required Exact heading text

append_to_section

Append content items (same format as build_document content) to the document.

Parameter Type Default Description
doc_id str required Document session ID
heading str required Context heading
content list[dict] required Content items to add

find_replace

Parameter Type Default Description
doc_id str required Document session ID
old str required Text to find
new str required Replacement text

add_comment

Parameter Type Default Description
doc_id str required Document session ID
heading str required Section to comment on
comment str required Comment text
author str "Reviewer" Comment author

Citations

set_citation_style

Parameter Type Default Description
doc_id str required Document session ID
style str required ieee, apa, harvard, mla, or chicago

add_citation

Register a citation source for later use in the bibliography.

Parameter Type Default Description
doc_id str required Document session ID
key str required Citation key (e.g. "smith2024")
author str required Author name(s)
title str required Work title
year int required Publication year
source_type str "article" article, book, conference, etc.
journal str? None Journal name
publisher str? None Publisher name
volume str? None Volume number
pages str? None Page range
doi str? None DOI identifier

add_bibliography

Parameter Type Default Description
doc_id str required Document session ID
heading str "References" Bibliography heading

Metadata

set_metadata

Parameter Type Default Description
doc_id str required Document session ID
author str? None Author name
title str? None Document title
scrub bool False Scrub all metadata

Export

save_document

Save to .docx. Falls back to returning base64 if filesystem write fails.

export_pdf

Export to PDF. Requires docx2pdf and Office/LibreOffice.

get_document_base64

Get document bytes as base64 — sandbox-proof, never touches filesystem.


MCP Prompts

Prompts are templates that guide the AI to collect user information before generating a document.

Prompt Description
academic_paper Collects title, author, institution, citation style, etc.
business_report Collects title, department, company, chart data, etc.
quick_document Generates immediately with defaults — no questions asked
edit_document Guides through opening, inspecting, and editing an existing doc