Skip to content

[Refactor] Add a shared response helper for HTTP and MCP outputs #63

@Robbo-lab

Description

@Robbo-lab

Issue Type

  • Bug report
  • Feature request
  • Documentation update
  • Other (please specify)

Other: utility / response-structure improvement

Description

The project currently builds response payloads in different places using small one-off dictionaries. That works, but it makes response formatting harder to keep consistent. A small shared helper would make HTTP and MCP responses easier to shape in the same way, while keeping core logic separate from transport code.

Steps to Reproduce (for bugs)

  1. Review the HTTP and MCP response paths in the project
  2. Note that response payloads are built in small ad hoc dictionaries
  3. Observe that response formatting is more scattered than it needs to be

Expected behaviour

HTTP and MCP layers should be able to use one small shared helper for response formatting.

Actual behaviour

Response formatting is currently spread across different places, which makes reuse and consistency harder.

Screenshots

Not applicable.

Additional context

Proposed scope:

  • Add a small shared helper for building response payloads
  • Support two simple cases:
    • success responses
    • error responses
  • Use it only at the transport boundary
  • Keep current behavior the same unless a small consistency fix is needed

Out of scope:

  • A full response framework
  • Refactoring the whole codebase to use it at once
  • Returning HTTP or MCP response objects from core logic
  • Redesigning the API

Acceptance criteria:

  • A shared response helper exists in the codebase
  • HTTP and/or MCP response formatting can use that helper instead of one-off dictionaries
  • Core logic stays transport-neutral
  • Current outward behavior stays the same, or only changes in a small intentional way

Possible Solution

Create one small helper, such as build_success_response() and build_error_response(), and use it first in one or two transport-facing paths. Keep the helper simple: it should only shape output data, not contain business logic.

Your Environment (for bugs):

  • Operating System: N/A
  • Browser (if applicable): N/A
  • Version of the software: current main branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXIssue would improve the developer experienceenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    Status
    In progress

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions