Skip to content

fix(api-callers): resolve C# request URLs built in variables - #124

Merged
spelech merged 2 commits into
mainfrom
fix/csharp-url-variable-callers
Nov 12, 2026
Merged

spelech merged 2 commits into
mainfrom
fix/csharp-url-variable-callers

Conversation

@spelech

@spelech spelech commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Problem

find_api_callers did not find this C# client call (a real client library):

string url = assistantInstanceId.HasValue
    ? $"api/v2/Assistants/run/instance/{assistantInstanceId.Value}"
    : $"api/v2/Assistants/run/{assistantEntityId}";
using var httpRequest = new HttpRequestMessage(HttpMethod.Post, url) { Content = content };

The C# rule only knew httpClient|_httpClient|client.<Verb>Async("literal"). Also, the fetch rule allowed any text between httpRequest and a later (, so httpRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("text/event-stream")) became a false GET /text/event-stream call.

Fix

  • New app/services/chunking/csharp_client_calls.py (used for C# files only):
    • new HttpRequestMessage(HttpMethod.Post, ...) and new HttpRequestMessage(new HttpMethod("PATCH"), ...)
    • <anything>Client.<Verb>*Async(...), with an optional generic type argument
    • URL arguments: a literal, an interpolated string ($"..."), "path/" + id (becomes path/{id}), or a variable. A variable is resolved from its nearest assignment in the 40 lines above; each URL literal in that statement is one call (both branches of a conditional).
  • _FETCH_CALL now matches only the call itself (fetch(, requestJson<T>().
  • docs/mcp-tools-and-resources.md and REQUIREMENTS.md updated.

Tests

tests/test_csharp_client_calls.py: the conditional URL variable (both routes, matched against api/v{version}/assistants/run/{eid}), interpolated literals with a custom client name and generic arguments, concatenation, variables without a URL are ignored, and other languages are not affected. The existing tests/test_api_client_calls.py passes.

🤖 Generated with Claude Code

Steve Pelech and others added 2 commits November 12, 2026 12:14
find_api_callers did not find a C# client that builds the URL on an
earlier line and sends it with HttpRequestMessage, for example:

    string url = id.HasValue ? $"api/v2/a/run/instance/{id}" : $"api/v2/a/run/{eid}";
    new HttpRequestMessage(HttpMethod.Post, url)

C# files now also recognize HttpRequestMessage with HttpMethod.X or
new HttpMethod("X"), any *Client.<Verb>*Async call (generic type
arguments allowed), interpolated strings, "path/" + id concatenation,
and a URL variable resolved from its nearest assignment. Each URL
literal in that assignment is one call.

The fetch rule also matched text between `httpRequest` and a later
parenthesis, so httpRequest.Headers.Accept.Add(new X("text/event-stream"))
became a GET call. It now matches the call itself only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@spelech
spelech merged commit 3115d83 into main Nov 12, 2026
15 checks passed
@spelech
spelech deleted the fix/csharp-url-variable-callers branch November 12, 2026 19:21
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