Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: parse JSON additional_fields (#1) #629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4erdenko wants to merge 1 commit into sooperset:main
base: main
Choose a base branch
Loading
from 4erdenko:main

Conversation

Copy link

@4erdenko 4erdenko commented Jul 27, 2025

PR Title

feat(jira): support `additional_fields` as dict or JSON string

Summary

This patch lets the Jira FastMCP server accept additional_fields when it is passed either as a native dict or as a JSON‐encoded str. It removes validation failures that occurred when XML‐to‐JSON converters wrapped the object in quotes.


Rationale

External clients (e.g. Anthropic Claude, Cursor) often emit tool calls in an XML‐like format. During XML → JSON‐RPC conversion, a nested JSON object is injected as a plain string:

"additional_fields": "{\"priority\": {\"id\": \"2\"}}"

Pydantic rejected this with dict_type. Accepting the string and parsing it server‐side solves the problem without breaking existing callers that already send a dict.


Technical Details

  • additional_fields type hint updated to dict[str, Any] | str | None.
  • New branch parses a JSON string via json.loads; rejects invalid JSON or values that are not objects.
  • Error messages clarified.

Code excerpt:

if additional_fields is None:
 extra_fields = {}
elif isinstance(additional_fields, dict):
 extra_fields = additional_fields
elif isinstance(additional_fields, str):
 extra_fields = json.loads(additional_fields)
 if not isinstance(extra_fields, dict):
 raise ValueError("parsed additional_fields is not an object")
else:
 raise ValueError("additional_fields must be a dict or JSON string")

Tests

  • test_create_issue_additional_fields_str_ok – JSON string accepted, issue created.
  • test_create_issue_additional_fields_str_invalid – invalid JSON string returns clear ValueError.
  • Existing tests for dict input remain green.

Backward Compatibility

  • No breaking changes.
  • Calls that already send a dict behave exactly as before.
  • Calls that send a non‐JSON string still fail fast with a clear error.

Documentation

  • Docstring for create_issue updated.
  • If the public OpenAPI / tool schema is exported, change the field definition to:
"additional_fields": { "type": ["object", "string", "null"] }

Related Issues

Fixes: #

* feat: parse additional_fields as JSON string
Allow create_issue to accept dict or JSON string. Added test and docs.
Copy link

This pull request has been automatically marked as stale because it has not had recent activity for 14 days. It will be closed if no further activity occurs. Please leave a comment or remove the 'stale' label if you believe this PR is still relevant. Thank you for your contributions!

Copy link
Author

Up.

Copy link

Works well!! Lets move this up 👍🏻

mliq reacted with thumbs up emoji 4erdenko reacted with heart emoji

Copy link

This pull request has been automatically marked as stale because it has not had recent activity for 14 days. It will be closed if no further activity occurs. Please leave a comment or remove the 'stale' label if you believe this PR is still relevant. Thank you for your contributions!

Copy link
Author

4erdenko commented Sep 8, 2025

@sooperset check this please

Copy link

mliq commented Sep 11, 2025
edited
Loading

please yes - this fixes create_issue. Still issues with update_issue though. Would it be possible to include that fix? I will work on it and make a new PR crediting @4erdenko for this work.

Copy link

This pull request has been automatically marked as stale because it has not had recent activity for 14 days. It will be closed if no further activity occurs. Please leave a comment or remove the 'stale' label if you believe this PR is still relevant. Thank you for your contributions!

nszceta added a commit to nszceta/mcp-atlassian that referenced this pull request Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /