Skip to content

feat: add optional JSON output format for all tools#26

Merged
CodeKeanu merged 2 commits into
mainfrom
feature/issue-14-json-output-mode
Dec 12, 2025
Merged

feat: add optional JSON output format for all tools#26
CodeKeanu merged 2 commits into
mainfrom
feature/issue-14-json-output-mode

Conversation

@CodeKeanu
Copy link
Copy Markdown
Owner

Summary

  • Added supports_json parameter to the @endpoint decorator that auto-adds a format parameter
  • When format="json" is passed, endpoints return structured JSON instead of human-readable text
  • Text output remains unchanged (backward compatible)

Changes

  • Enhanced @endpoint decorator in base.py to support supports_json=True option
  • Auto-adds format parameter with enum ["text", "json"] and default "text"
  • Implemented JSON output for 5 key endpoints:
    • get_player_summary: Player profile data with status/visibility enums
    • get_friend_list: Friends array with steam_id and friend_since timestamps
    • get_owned_games: Games array with playtime stats and metadata
    • get_player_achievements: Achievement list with unlock times and completion stats
    • get_app_details: Full app metadata including pricing, platforms, genres

Testing

  • All existing tests pass (187 tests)
  • Text output unchanged (backward compatible)

Checklist from Issue

  • format parameter available on key endpoints
  • JSON output is valid and well-structured
  • Text output unchanged (backward compatible)
  • At least 5 endpoints support JSON mode

Closes #14

🤖 Generated with Claude Code

Add `supports_json` parameter to the @endpoint decorator that
auto-adds a `format` parameter to endpoints. When format="json"
is passed, endpoints return structured JSON instead of text.

Changes:
- Enhanced @endpoint decorator with supports_json=True option
- Auto-adds format parameter with enum ["text", "json"]
- Implemented JSON output for 5 key endpoints:
  - get_player_summary: Player profile data
  - get_friend_list: Friends with timestamps
  - get_owned_games: Games with playtime stats
  - get_player_achievements: Achievements with unlock times
  - get_app_details: App metadata, pricing, platforms
- Text output remains unchanged (backward compatible)
- JSON output uses consistent snake_case field names

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@CodeKeanu
Copy link
Copy Markdown
Owner Author

Code Review - JSON Output Format

Verdict: ✅ Approve

Strengths:

  • Clean decorator extension with supports_json=True
  • Backward compatible (default "text")
  • Proper dict(params) copy to avoid mutation

Minor Notes (non-blocking):

  • format shadows builtin - acceptable for local param
  • Inconsistent error JSON: get_owned_games returns {"error": msg, "games": []}, others return just {"error": msg}. Consider standardizing in follow-up.

Review by @agent-ml-python-mcp-expert

All JSON error responses now consistently return {"error": msg}
without extra fields like empty arrays or IDs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@CodeKeanu CodeKeanu merged commit 87c7f5e into main Dec 12, 2025
1 check passed
@CodeKeanu CodeKeanu deleted the feature/issue-14-json-output-mode branch December 12, 2025 09:00
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.

Architecture: Structured JSON Output Mode

1 participant