Skip to content

fix(vod): define the module-level api_info that BaseService.get_api_info returns - #431

Open
Anai-Guo wants to merge 1 commit into
volcengine:mainfrom
Anai-Guo:fix/vod-base-service-missing-api-info
Open

fix(vod): define the module-level api_info that BaseService.get_api_info returns#431
Anai-Guo wants to merge 1 commit into
volcengine:mainfrom
Anai-Guo:fix/vod-base-service-missing-api-info

Conversation

@Anai-Guo

@Anai-Guo Anai-Guo commented Sep 7, 2026

Copy link
Copy Markdown

Problem

server/mcp_server_vod/src/base/base_service.py declares an accessor that returns a name the module never defines:

# server/mcp_server_vod/src/base/base_service.py:47-49
@staticmethod
def get_api_info():
    return api_info      # <- api_info is not defined anywhere in this module

grep -n "api_info" server/mcp_server_vod/ shows the only api_info binding in that server lives in src/vod/api/config.py and is imported by src/vod/api/api.py — never by base_service.py. So calling BaseService.get_api_info() raises:

NameError: name 'api_info' is not defined

Verified by extracting the method from the file as it stands on main (5aeb8f0) and executing it:

BEFORE: NameError: name 'api_info' is not defined
AFTER (with module-level api_info = {}): {}

pyflakes reports it as undefined name 'api_info'.

Why this is a dropped line, not a design choice

Every other base class in this repository pairs the identical accessor with a module-level api_info:

# server/mcp_server_cdn/src/base/base_trait.py:9-11, 35-37
api_info = {

}

class BaseTrait(Service):
    ...
    @staticmethod
    def get_api_info():
        return api_info

The same pairing appears in mcp_server_alb, mcp_server_cdn, mcp_server_certificate_center, mcp_server_cloudsearch, mcp_server_cr, mcp_server_dcdn, mcp_server_domain_service, mcp_server_enterprise, mcp_server_ga, mcp_server_iga, mcp_server_iot, mcp_server_live, mcp_server_mcdn, mcp_server_rtc, mcp_server_traffic_route, mcp_server_veen, mcp_server_veimagex and mcp_server_vke — 18 copies, all with the constant. mcp_server_vod is the only one that carries the accessor without it.

Fix

Restore the missing module-level binding, matching the sibling files:

 from mcp.server.session import ServerSession
 
+api_info = {}
+
+
 class BaseService(VodService):

Scope

1 file, +3 / −0. get_api_info() now returns {} exactly as it does in all 18 sibling modules instead of raising NameError. Nothing in mcp_server_vod currently calls it, so no existing behaviour changes — this removes a latent crash from a public accessor and brings the file back in line with the rest of the repo.

🤖 Generated with Claude Code

…nfo returns

server/mcp_server_vod/src/base/base_service.py declares

    @staticmethod
    def get_api_info():
        return api_info

but the module never defines api_info, so any call raises
NameError: name 'api_info' is not defined.

Every other base_trait.py / base_service.py in this repository (alb, cdn,
certificate_center, cloudsearch, cr, dcdn, domain_service, enterprise, ga,
iga, iot, live, mcdn, rtc, traffic_route, veen, veimagex, vke) defines the
same module-level api_info next to the identical accessor. This restores the
line the vod copy dropped.
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