Skip to content

feat: add MCP prompts for document conversion, generation, and manipulation#92

Open
vivek12345 wants to merge 1 commit into
docling-project:mainfrom
vivek12345:feat/add-prompts
Open

feat: add MCP prompts for document conversion, generation, and manipulation#92
vivek12345 wants to merge 1 commit into
docling-project:mainfrom
vivek12345:feat/add-prompts

Conversation

@vivek12345
Copy link
Copy Markdown

@vivek12345 vivek12345 commented Mar 25, 2026

This PR introduces MCP Prompts to the Docling MCP server — a first-class MCP
protocol feature that exposes reusable, parameterized prompt templates to clients
like Claude Desktop.

Previously, the server exposed only tools. Users had to know the correct tool
names and call sequences to accomplish multi-step workflows. Prompts solve this
by encoding those workflows as invocable templates with named arguments.

What's added:
docling_mcp/prompts/ — new package with 3 modules:

  • conversion.py — 3 prompts:
    • generate_docling_document_from_pdf(file_path) — convert a local PDF and
      return the document key
    • convert_and_summarize(source) — convert any document and produce a
      structured summary (title, sections, key takeaways)
    • convert_directory_and_list(directory) — batch convert a directory and
      display results as a table
  • generation.py — 2 prompts:
    • author_structured_document(topic, sections) — guides the LLM through the
      full document creation sequence including the open/close list stack discipline
    • convert_and_rewrite(source, instructions) — convert a source document then
      rewrite it following custom instructions into a new Docling document
  • manipulation.py — 2 prompts:
    • review_and_edit_document(document_key) — shows document structure via
      anchors then interactively edits based on user input
    • find_and_replace_in_document(document_key, search_text, replacement_text)
      search-then-update workflow with confirmation for non-exact matches
      docling_mcp/servers/mcp_server.py — prompts are imported unconditionally inside
      main() after the tool group imports, so they are always registered regardless
      of which tool groups are selected.
      How prompts appear in clients:
      In Claude Desktop, registered prompts appear in the prompt picker and can be
      invoked with named arguments. Each prompt injects a user message that encodes
      the correct tool call sequence for that workflow.
      Checklist for the PR template sections:

Issue resolved by this Pull Request:
Resolves # #36

Screenshot 2026-03-25 at 15 54 22

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 25, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

…lation

Signed-off-by: Vivek Nayyar <vivek.of.nayyar@gmail.com>
@vivek12345
Copy link
Copy Markdown
Author

@ceberam Please help review

@vivek12345
Copy link
Copy Markdown
Author

Hello @ceberam. Is there anything you would like me to add to this?

@vivek12345
Copy link
Copy Markdown
Author

Hello @ceberam any chance to review this?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

DCO Check Passed

Thanks @vivek12345, all your commits are properly signed off. 🎉

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 0% with 28 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
docling_mcp/prompts/conversion.py 0.00% 10 Missing ⚠️
docling_mcp/prompts/generation.py 0.00% 7 Missing ⚠️
docling_mcp/prompts/manipulation.py 0.00% 7 Missing ⚠️
docling_mcp/servers/mcp_server.py 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant