Skip to content

Update MCP response to improve agent's answers - #319

Open
vinamra28 wants to merge 1 commit into
redhat-data-and-ai:mainfrom
vinamra28:improve-skill
Open

Update MCP response to improve agent's answers#319
vinamra28 wants to merge 1 commit into
redhat-data-and-ai:mainfrom
vinamra28:improve-skill

Conversation

@vinamra28

@vinamra28 vinamra28 commented Aug 4, 2026

Copy link
Copy Markdown
Member

At the moment agent doesn't cite the sources which were used to answer the queries. Also in case of access issues, agent should give that as hint to the user.

Update the mcp tool descriptions and skills with the same

Summary by CodeRabbit

  • Documentation
    • Clarified that empty search results may indicate restricted or unavailable source-file access.
    • Added guidance requiring responses to cite the relevant file identifier.
    • Added Google Drive citation guidance, including links built from the provided file identifier.
    • Updated document retrieval and embedding-search instructions to promote clearer, traceable answers.

At the moment agent doesn't cite the sources which were used to answer
the queries. Also in case of access issues, agent should give that as
hint to the user.

Update the mcp tool descriptions and skills with the same

Signed-off-by: vinamra28 <vinjain@redhat.com>
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The MCP tool descriptions and unstructured-data skill guidance now explain access-related empty results and require citations that use file_id, including Google Drive URLs.

Changes

Citation and access guidance

Layer / File(s) Summary
Update tool and skill instructions
internal/mcp/tools/get_chunks.go, internal/mcp/tools/get_processed_document.go, skills/unstructured-data-mcp-skill.md
The instructions explain that empty results may indicate missing source-file access. They require citations with file_id and specify the Google Drive URL format.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately refers to updating MCP guidance to improve agent responses, but it does not specify citations or access hints.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/mcp/tools/get_chunks.go`:
- Around line 48-50: Make citation guidance conditional on verified
source-bearing success: in internal/mcp/tools/get_chunks.go lines 48-50, require
a citation only when the successful result includes a file_id and keep error
responses citation-free; in internal/mcp/tools/get_processed_document.go lines
46-47, do not treat an echoed request file_id as proof of successful retrieval;
in skills/unstructured-data-mcp-skill.md lines 15-17, require citations only
when source content and a returned file_id are both available.
- Around line 48-49: Update the empty-result guidance in
internal/mcp/tools/get_chunks.go lines 48-49 to present missing access as one
possible cause, not the default explanation or an automatic request for access;
retain the requirement to cite file_id and provide Google Drive URLs in the
specified format. Apply the same uncertainty guidance in
skills/unstructured-data-mcp-skill.md lines 14-17, correcting the grammar and
capitalizing “Google Drive” and “URL”.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7735716f-1776-49b3-a2bd-8f70dd1b3d7b

📥 Commits

Reviewing files that changed from the base of the PR and between 7e35584 and 3d19881.

📒 Files selected for processing (3)
  • internal/mcp/tools/get_chunks.go
  • internal/mcp/tools/get_processed_document.go
  • skills/unstructured-data-mcp-skill.md

Comment on lines +48 to +49
If no matching chunks are found, it could be because the user does not have access to the original source file — suggest they request access to it.
Always cite sources: include file_id in your answer so the user can visit the source file. For Google Drive sources, provide the URL as https://drive.google.com/file/d/<file_id>/view.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use neutral guidance for empty search results.

The tools return no access-status signal. An empty result can mean no relevant match or missing source access, so the agent cannot identify access as the cause.

  • internal/mcp/tools/get_chunks.go#L48-L49: Present missing access as one possible cause instead of defaulting to an access request.
  • skills/unstructured-data-mcp-skill.md#L14-L17: State the same uncertainty, correct the grammar, and capitalize Google Drive and URL.
📍 Affects 2 files
  • internal/mcp/tools/get_chunks.go#L48-L49 (this comment)
  • skills/unstructured-data-mcp-skill.md#L14-L17
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/mcp/tools/get_chunks.go` around lines 48 - 49, Update the
empty-result guidance in internal/mcp/tools/get_chunks.go lines 48-49 to present
missing access as one possible cause, not the default explanation or an
automatic request for access; retain the requirement to cite file_id and provide
Google Drive URLs in the specified format. Apply the same uncertainty guidance
in skills/unstructured-data-mcp-skill.md lines 14-17, correcting the grammar and
capitalizing “Google Drive” and “URL”.

Source: Linters/SAST tools

Comment on lines +48 to 50
If no matching chunks are found, it could be because the user does not have access to the original source file — suggest they request access to it.
Always cite sources: include file_id in your answer so the user can visit the source file. For Google Drive sources, provide the URL as https://drive.google.com/file/d/<file_id>/view.
On error: report the exact error to the user and STOP. Do NOT retry with other pipelines.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make citation requirements conditional on source-bearing success responses.

The current “always cite” rules conflict with error and empty-result behavior. These paths can return no verified file_id, so agents may fabricate a citation.

  • internal/mcp/tools/get_chunks.go#L48-L50: Require citations only when a successful result returns a file_id; keep errors citation-free.
  • internal/mcp/tools/get_processed_document.go#L46-L47: Do not treat an echoed request file_id as proof that document retrieval succeeded.
  • skills/unstructured-data-mcp-skill.md#L15-L17: Require citations only when source content and a returned file_id are available.
📍 Affects 3 files
  • internal/mcp/tools/get_chunks.go#L48-L50 (this comment)
  • internal/mcp/tools/get_processed_document.go#L46-L47
  • skills/unstructured-data-mcp-skill.md#L15-L17
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/mcp/tools/get_chunks.go` around lines 48 - 50, Make citation
guidance conditional on verified source-bearing success: in
internal/mcp/tools/get_chunks.go lines 48-50, require a citation only when the
successful result includes a file_id and keep error responses citation-free; in
internal/mcp/tools/get_processed_document.go lines 46-47, do not treat an echoed
request file_id as proof of successful retrieval; in
skills/unstructured-data-mcp-skill.md lines 15-17, require citations only when
source content and a returned file_id are both available.

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.

1 participant