Skip to content

azure-foundry-iq connector: knowledge_base_retrieve always fails (sends queries; live MCP server requires query_variants) #79145

Done

Description

@sudivate

Summary

The experimental azure-foundry-iq connector (#78937, shipped in v1.3.1, unchanged on main) declares and forwards knowledge_base_retrieve arguments as {"queries": ["…"]}. A live Azure AI Search knowledge-base MCP endpoint at api-version=2026-11-01-preview requires query_variants and sets additionalProperties: false. As a result, every knowledge_base_retrieve call through the connector fails.

The connector runtime also replaces the server's tool-error text with a generic message, so neither the agent nor the workflow author can see the cause.

Environment

  • gh-aw v1.3.1 (github/gh-aw-actions/[email protected]), connector import at 30aaa011
  • MCP gateway ghcr.io/github/gh-aw-mcpg:v0.5.10; connector runtime in node:lts-alpine
  • Engine: Copilot, with strict: true and staged: true
  • Azure AI Search (Basic, East US) with a knowledge base over one searchIndex knowledge source, retrievalReasoningEffort: minimal and outputMode: extractiveData
  • The server reports serverInfo.version: "1.2.0" and protocol 2025-03-26

Reproduction

imports:
  - uses: github/gh-aw/.github/workflows/connectors/azure-foundry-iq.md@main
    with:
      service: <search-service>
      knowledge-base: <kb-name>
      queries:
        - "<approved question>"
tools:
  azure-foundry-iq:
    knowledge-base: [knowledge_base_retrieve]
network:
  allowed: [defaults, "<search-service>.search.windows.net"]

The agent calls the tool correctly, using the exact granted string. From mcp-logs/rpc-messages.jsonl:

{"method":"tools/call","params":{"name":"knowledge-base__knowledge_base_retrieve","arguments":{"queries":["<approved question>"]}}}
{"result":{"content":[{"type":"text","text":"Connector HTTP MCP tool returned an error or requires unsupported interactive input"}],"isError":true}}

Analysis (root cause)

I replayed actions/setup/js/connector_runtime.cjs callMCP() locally, using the compiled GH_AW_CONNECTOR_PLAN from the .lock.yml, a fresh Entra token for https://search.azure.com/.default and a logging fetch wrapper. Every request goes to …/knowledgebases/<kb>/mcp?api-version=2026-11-01-preview.

  • initialize returns 200 (SSE) and notifications/initialized returns 202. Authentication and session handling work.
  • tools/call returns a tool error:
{"result":{"content":[{"type":"text","text":"An error occurred invoking 'knowledge_base_retrieve': The 'arguments.query_variants' field for the tool call is required and must be a JSON array."}],"isError":true},"id":2,"jsonrpc":"2.0"}

The live tools/list input schema:

{"type":"object","properties":{"query_variants":{"description":"1 to 3 search queries. Each query: max 150 characters; under 12 words. Cover distinct retrieval goals and alternate evidence wording. Do not add duplicates that only reorder terms.\n\nAlways return a JSON array of strings, even when issuing a single query. …","type":"array","items":{"type":"string","maxLength":150},"minItems":1,"maxItems":3}},"required":["query_variants"],"additionalProperties":false}
Connector (v1.3.1 / main) Live server (2026-11-01-preview)
Argument name queries query_variants
Items exactly 1 1–3
Max length per item 2048 150 (and "under 12 words")
Extra properties n/a additionalProperties: false

Verified fix. In the compiled plan I renamed the tool input to query_variants (with items.maxLength: 150) and set resources: {query_variants: queries}, then recomputed the plan digest the same way decodePlan() does. The same callMCP() call against the same server then returned cited extractive results (ref_id, title, content).

Probable origin. The reference cited in the connector's docs: and in ADR 78937, microsoft/azure-ai-search-foundry-iq-live-knowledge-sources src/liveks/mcp_client.py, sends {"queries": [query]}, both at the pinned commit f4c9985e and on main. The preview service appears to have changed its contract after that reference was written. The Learn page for the MCP endpoint (https://learn.microsoft.com/en-us/azure/search/agentic-retrieval-how-to-retrieve#call-the-mcp-endpoint) doesn't document the tool's arguments, so only tools/list defines the contract.

Secondary: masked upstream errors

actions/setup/js/connector_runtime.cjs callMCP() (around line 1386) and pkg/connectors/mcp.go:51 replace any upstream isError: true result with "Connector HTTP MCP tool returned an error or requires unsupported interactive input". Two different conditions share this message, and the server's text is dropped. In this case, the only way to diagnose the failure was to replay the runtime outside Actions.

Minor: token prefix in the gateway log

mcp-logs/<connector>.log prints the docker arguments with -e GH_AW_CONNECTOR_SECRET_<NAME>=eyJ0.... Only the first 4 characters appear, but redacting the whole value would be cleaner.

Implementation plan

  1. Connector contract (.github/workflows/connectors/azure-foundry-iq.md):
    • Rename the knowledge_base_retrieve input queries to query_variants, keeping type: array, required: true, minItems: 1 and items.minLength: 1.
    • Set items.maxLength: 150.
    • Keep maxItems: 1 to preserve the one-exact-grant-per-call model. Up to 3 would also work if each item is checked against the grants.
    • Map resources: {query_variants: queries}. Keep the import input name queries so existing with: blocks still work.
    • Update the queries import-schema description: "each call contains exactly one granted question of at most 150 characters (the server also asks for under 12 words)".
  2. Compile-time validation: reject with.queries grants longer than 150 characters, using the error style "[what's wrong]. [what's expected]. [example]".
  3. Tests (pkg/workflow/azure_foundry_iq_connector_test.go, pkg/workflow/connector_scenario_compile_test.go, actions/setup/js/connector_runtime.test.cjs):
    • Update the argument-shape cases from queries to query_variants.
    • Change the length bound from 2049 to 151.
    • Assert that the forwarded tools/call arguments are {query_variants:[question]}.
    • Keep the rejection cases for unknown arguments and ungranted questions.
  4. Golden and docs (pkg/cli/workflows/azure-foundry-iq-golden.md, docs/src/content/docs/reference/connectors.md around lines 726–745, and an ADR 78937 follow-up note): describe the native argument as query_variants and the 150-character bound, and note the contract change in the preview API.
  5. Error surfacing (connector_runtime.cjs callMCP and pkg/connectors/mcp.go):
    • Split the message into "upstream tool error" and "interactive input required".
    • For tool errors, include a bounded, sanitized excerpt of the upstream content[].text (for example, the first 300 characters with control characters stripped, marked untrusted), or at least write it to the connector's MCP log.
    • Add tests for both paths.
  6. Optional: redact the whole GH_AW_CONNECTOR_SECRET_* value in the gateway's docker-argument logging.

Workaround

A plain HTTP mcp-servers: entry works today, but it loses the connector's exact-question grants:

mcp-servers:
  foundry-kb:
    type: http
    url: "https://<service>.search.windows.net/knowledgebases/<kb>/mcp?api-version=2026-11-01-preview"
    headers:
      Authorization: "Bearer ${{ secrets.FOUNDRY_IQ_SEARCH_ACCESS_TOKEN }}"
    allowed: [knowledge_base_retrieve]

Activity

  1. locked and limited conversation to collaborators on Nov 19, 2026
  2. unlocked this conversation on Nov 19, 2026
  3. linked a pull request that will close this issueFix Foundry IQ retrieval arguments #79190on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions