Skip to content

Upstream: mcpc pollTask() returns statusMessage instead of actual result #686

Description

@jirispilka

Problem

The mcpc pollTask() detached polling fallback (mcp-cli/src/core/mcp-client.ts, ~line 715) returns the statusMessage as fake content instead of fetching the actual stored result via tasks/result:

// Current behavior (incomplete):
if (task.status === 'completed') {
    return { content: [{ type: 'text', text: task.statusMessage || 'Task completed' }] };
}

// Fix:
if (task.status === 'completed') {
    const result = await this.getTaskResult(taskId);
    return result;
}

This means detached tasks polled via pollTask() lose their actual result — the client only sees the statusMessage text.

Scope clarification: this only affects the detached polling path (callToolDetached + manual pollTask). The normal callTool path is not affected:

mcpc callTool → callToolStream → requestStream → completed → getTaskResult ✅
mcpc pollTask → tasks/get loop → completed → statusMessage as content ❌ (detached only)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-aiIssues owned by the AI team.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions