Skip to content

feat(mcp): introduce self-healing validation tool for LLM agents#140

Closed
Siddhantdamre wants to merge 1 commit intoaccordproject:mainfrom
Siddhantdamre:feat/mcp-self-healing-agent
Closed

feat(mcp): introduce self-healing validation tool for LLM agents#140
Siddhantdamre wants to merge 1 commit intoaccordproject:mainfrom
Siddhantdamre:feat/mcp-self-healing-agent

Conversation

@Siddhantdamre
Copy link
Copy Markdown

Description

This PR addresses the "Hardening and Developer/Agent Experience" requirements of the APAP MCP Server (GSoC 2025) by introducing a self-healing loop for LLM clients.

Large Language Models (like Claude/ChatGPT) frequently hallucinate or generate improperly nested JSON when trying to adhere to strict Concerto legal models. Previously, this would result in unhandled errors and broken agent workflows during the trigger or create phases.

This introduces a new validate-agreement-data MCP tool.

How it works:

  1. It safely exposes the existing concertoValidation engine to the MCP router.
  2. It uses targeted prompt engineering in the tool description to explicitly instruct the LLM to validate its drafted JSON before attempting to trigger/create an agreement.
  3. If the JSON is structurally invalid, it returns the exact Concerto schema errors to the LLM, allowing the agent to self-correct and re-submit autonomously.

Impact

  • Zero Breaking Changes: Built additively; existing trigger and convert tools are untouched.
  • Code Reuse: Leverages the existing concertovalidation.ts logic rather than reinventing the wheel.
  • Agent UX: Massively improves the success rate of LLMs when interacting with complex APAP templates.

Testing

  • Verified tool registration on the SSE/HTTP transport.
  • Tested JSON parsing error boundaries.
  • Verified Concerto success/failure paths bubble up to the MCP content array.

@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Apr 10, 2026
Signed-off-by: Siddhantdamre <143316859+Siddhantdamre@users.noreply.github.com>
@Siddhantdamre Siddhantdamre force-pushed the feat/mcp-self-healing-agent branch from 338d4c0 to 364034b Compare April 12, 2026 08:57
@Siddhantdamre
Copy link
Copy Markdown
Author

I’m still working on this. I’ve updated the commit to fix DCO. Requesting workflow approval and review.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant