Skip to content

Refactoring of mapping between the upstream tool/resource/prompt name - #124

Open
cafalchio wants to merge 20 commits into
mainfrom
mapping_upstream
Open

Refactoring of mapping between the upstream tool/resource/prompt name#124
cafalchio wants to merge 20 commits into
mainfrom
mapping_upstream

Conversation

@cafalchio

Copy link
Copy Markdown
Contributor

Updated VirtualHost in user_store.rs to receive tools, prompts and resources.

  • Simplified the "resolve_tool_route" in tools, resources, and prompts to use the new map.
  • Removed all the route_identifier functions that were not necessary
  • Fixed the failing tests.

closes IBM/mcp-context-forge#6450

@lucarlig lucarlig closed this Sep 1, 2026
@lucarlig lucarlig reopened this Sep 1, 2026
@lucarlig lucarlig closed this Sep 1, 2026
@lucarlig lucarlig reopened this Sep 1, 2026

@lucarlig lucarlig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes until the tuple order is confirmed and resource-template routing is accounted for.

Comment thread crates/contextforge-data-plane-apis/src/user_store.rs Outdated
Comment thread crates/contextforge-data-plane-apis/src/user_store.rs Outdated
@cafalchio
cafalchio requested a review from lucarlig September 1, 2026 14:38
lucarlig
lucarlig previously approved these changes Sep 1, 2026

@lucarlig lucarlig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Field name is wrong. resources_templates should be resource_templates, matching MCP terminology and the linked issue’s wire contract.
  • This changes the hot path and removes prefix/alias routing, but _context/wiki/routing.md was not updated, ask bob please.
  • Cleanup gap: NameAlias and the three backend alias sets now have no production consumer, leaving a redundant second routing model. They should be removed

lucarlig
lucarlig previously approved these changes Sep 1, 2026

@lucarlig lucarlig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

pub struct VirtualHost {
pub backends: HashMap<String, BackendMCPGateway>,
#[serde(default)]
pub tools: HashMap<String, ServiceRoute>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What the key here? Make it more descriptive in code so it is obvious without additional comments.
For example, instead of:
pub tools: HashMap<String, ServiceRoute>,
use

pub type DownstreamToolName= String;
pub tools: HashMap<DownstreamToolName, ServiceRoute>,```

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I learned about type alias Yesterday. Let me fix it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed


#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema)]
pub struct VirtualHost {
pub backends: HashMap<String, BackendMCPGateway>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same thing, as below. It is not clear what the key is here.

Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>

#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema)]
pub struct VirtualHost {
pub backends: HashMap<String, BackendMCPGateway>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what is this string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added DownstreamBackendName

@dawid-nowak dawid-nowak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

More changes around improving clarity of user_store

Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
pub backends: HashMap<String, BackendMCPGateway>,
pub backends: HashMap<DownstreamBackendName, BackendMCPGateway>,
#[serde(default)]
pub tools: HashMap<DownstreamToolName, ServiceRoute>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ServiceName.backend_name is still a string, it should mach DownstreamBackendName

@dawid-nowak dawid-nowak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

More changes

Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
Signed-off-by: cafalchio <mcafalchio@gmail.com>
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.

Refactoring of mapping between the upstream tool/resource/prompt name to downstream name

3 participants