Skip to content

Add missing CRUD tools#45

Open
loebpaul wants to merge 7 commits intoeffytech:mainfrom
loebpaul:main
Open

Add missing CRUD tools#45
loebpaul wants to merge 7 commits intoeffytech:mainfrom
loebpaul:main

Conversation

@loebpaul
Copy link
Copy Markdown

@loebpaul loebpaul commented Apr 6, 2026

Several entities were missing create/update/delete coverage, leaving the MCP server without full CRUD capability. Contacts and companies had no write operations beyond update; agents, groups, canned responses, and field types all lacked delete. The Solutions (knowledge base) API coverage was missing delete operations for all three resource levels and article search, leaving full CRUD incomplete.

Added tools

Contacts

  • create_contact() — requires at least one of email, phone, mobile, twitter_id
  • delete_contact()

Companies

  • create_company() — requires name
  • update_company()
  • delete_company()

Agents / Groups

  • delete_agent()
  • delete_group()

Canned Responses & Folders

  • delete_canned_response()
  • delete_canned_response_folder()

Fields

  • delete_contact_field()
  • delete_ticket_field()

Solutions

  • delete_solution_article(article_id)
  • delete_solution_folder(folder_id)
  • delete_solution_category(category_id)
  • search_solution_articles(term, page, per_page)

Search returns the standard {"articles": [...], "pagination": {...}} envelope.

All delete tools handle 204 No Content explicitly and return structured error dicts on failure, consistent with the existing delete implementations (e.g. delete_solution_article).

Copilot AI and others added 2 commits April 6, 2026 00:39
Copilot AI review requested due to automatic review settings April 6, 2026 00:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing Freshdesk Solutions (knowledge base) API coverage by introducing delete tools for articles/folders/categories and a search tool for solution articles, completing CRUD coverage for these resources.

Changes:

  • Added delete_solution_article, delete_solution_folder, and delete_solution_category MCP tools handling HTTP 204 success.
  • Added search_solution_articles(term, page, per_page) MCP tool returning an {articles, pagination} envelope parsed from the Link header.
  • Extended tests/test-fd-mcp.py with manual async functions exercising the new tools.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/freshdesk_mcp/server.py Implements new Solutions delete + article search MCP tools, including pagination parsing.
tests/test-fd-mcp.py Adds manual test helpers/imports for the new tools.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test-fd-mcp.py
Comment thread tests/test-fd-mcp.py
Comment thread src/freshdesk_mcp/server.py
Copilot AI and others added 4 commits April 6, 2026 01:36
… canned responses, and fields

Agent-Logs-Url: https://github.com/loebpaul/freshdesk_mcp/sessions/9af5c6b8-85d1-4eec-88a6-077d2e8f9b5e

Co-authored-by: loebpaul <5465651+loebpaul@users.noreply.github.com>
Add missing CRUD tools across contacts, companies, agents, groups, canned responses, and fields
…e tests, add unit tests

Agent-Logs-Url: https://github.com/loebpaul/freshdesk_mcp/sessions/102c57c8-c42d-4cb3-86b3-5a4bed954752

Co-authored-by: loebpaul <5465651+loebpaul@users.noreply.github.com>
Address review feedback on PR effytech#45: fix imports, guard destructive tests, add unit tests
@loebpaul
Copy link
Copy Markdown
Author

loebpaul commented Apr 6, 2026

Addresses the three review comments:

Changes

1. Fix tests/test-fd-mcp.py import path

Added a sys.path adjustment using the Path-based pattern (matching tests/test_company_functions.py) so the file can be run directly from a fresh checkout without installing the package:

SRC_DIR = Path(__file__).resolve().parents[1] / "src"
if str(SRC_DIR) not in sys.path:
    sys.path.insert(0, str(SRC_DIR))

The import now uses from freshdesk_mcp.server import ... (the installed package path exposed via src/).

2. Guard destructive tests behind RUN_DESTRUCTIVE_TESTS env flag

The three test_delete_solution_* functions now check for os.getenv("RUN_DESTRUCTIVE_TESTS") and skip with a message if the flag isn't set, preventing accidental execution during normal test discovery or CI runs.

3. Add mocked-httpx unit tests (tests/test_solution_functions.py)

New test file with 11 tests covering:

  • delete_solution_article / delete_solution_folder / delete_solution_category: assert {success: True, message: ...} on 204, and {error: ...} on HTTP error
  • search_solution_articles: assert {articles, pagination} envelope shape, Link header parsing (next/prev pages), input validation, and HTTP error propagation

@loebpaul loebpaul changed the title Add knowledge base delete and search tools Add missing CRUD tools Apr 6, 2026
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.

3 participants