epam / epam/ai-dial-quickapps-backend

Support agent-home-relative file references in MCP dial_url parameters

Open
#445 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
10
Forks
3
Avg merge
3d 10h
Merged PRs (30d)
17

Description

### QuickApps version

latest

### What is the problem this feature will solve?

MCP tool parameters marked `dial_url: true` reject agent-home-relative references (e.g. `reports/img.png`) — `_MCPTool._collect_dial_url_files` raises `InvalidToolCallParameterException` for `UrlScheme.DIAL_APPDIR_RELATIVE` just like for unsupported schemes (see `TODO(#445)` at the rejection branch).

Since #444 the `internal_attachments_get_content` tool resolves these references under the agent home via `HomePathResolver`, and the `internal_file_*` tools both speak and echo this convention. The model therefore reasonably tries the same reference form with MCP tools and gets rejected, forcing it to guess the absolute `files/...` form it has never seen.

### What is the feature you are proposing to solve the problem?

Resolve appdir-relative references before granting file permissions, instead of rejecting them:

- inject `HomePathResolver` (from `shared/home_path`) into `_MCPTool`
- in `_collect_dial_url_files`, resolve `UrlScheme.DIAL_APPDIR_RELATIVE` values via `resolve_appdata_url` (this makes collection async — the call chain needs adjusting)
- grant permissions on the resolved `files/...` URL and pass it to the MCP server

Detection must use the canonical predicate `is_appdir_relative` / `classify_url` from `common/url_classification.py` so the grammar stays consistent with `get_content`.

### What alternatives have you considered?

- **Keep rejecting with a clearer message** (current state after #444): the rejection is explicit and consistent, but the model still cannot pass workspace files to MCP tools without discovering the absolute URL, which the file tools never display.
- **Resolve in the model prompt/tool description** (instruct the model to expand references itself): the model does not know the `files/{appdata}/{home}` prefix, so it cannot.

Contributor guide

Open the contributing guide

Research direction

Start by reading _MCPTool._collect_dial_url_files and the rejection branch marked TODO(#445), then trace its call chain to account for making collection async. Review shared/home_path and common/url_classification.py, especially resolve_appdata_url and is_appdir_relative/classify_url. Done means appdir-relative values are resolved, permissions are granted for the resolved files/... URL, and that URL is passed to the MCP server.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.