Repository navigation
Description
Summary
lookup_native_tool matches the query as a plain lowercase substring of the stored PascalCase name, so the canonical SCREAMING_SNAKE names used by the upstream native reference and most docs (for example GET_PLAYER_PED) return no results.
Where
mcp-server/tools/natives.py:53-60(lookup_native, match logic)mcp-server/tools/natives.py:29-33(gameinterpolated into the filename unvalidated)mcp-server/tools/natives.py:55-58,mcp-server/tools/natives.py:116(.lower()ondescription/hash, indexingp['type']/p['name']).github/workflows/validate.yml:25-55(native schema checks)
Details
Against the shipped data at 701824d:
lookup_native('GET_PLAYER_PED', 'gta5', None, './data')returnsNo natives found matching 'GET_PLAYER_PED' for gta5.lookup_native('GetPlayerPed', ...)returns 4 results.
game is used directly in natives_{game}.json, so game='rdr2' returns Error: native database not found at ./data/natives_rdr2.json (exposing the path) instead of an invalid-game message.
Lines 55-58 call .lower() on description and hash, and line 116 indexes p['type']/p['name'], but the CI schema step only asserts that keys exist. A future transform_natives.py run that emits "description": null or a param without type would crash every query. The current data is clean.
Impact
Native lookup is a core tool. An agent that follows the upstream reference or docs (which use SCREAMING_SNAKE) is told that natives such as GET_ENTITY_COORDS do not exist.
Steps to reproduce
cd mcp-serverpython -c "from tools.natives import lookup_native as l; print(l('GET_PLAYER_PED','gta5',None,'./data'))"- Output:
No natives found matching 'GET_PLAYER_PED' for gta5.
Suggested fix
- Normalise both the query and the native name by removing
_and lowercasing before the name comparison (keep the hash comparison as is, accepting with or without0x). - Validate
gameagainst{"gta5", "rdr3"}and return a clear error otherwise. - Use
str(native.get("description") or "")style access andp.get("type", "")so malformed entries do not raise. - Extend the validate.yml schema step to assert
descriptionandhashare strings and each param hastypeandname.
Acceptance criteria
-
GET_PLAYER_PED,GetPlayerPedandgetplayerpedall findGetPlayerPed. - Hash lookup works with and without
0x, in any case. -
game="rdr2"returns an invalid-game error without a file path. - A native with
description: nullor a param missingtypedoes not raise. - Tests (small fixture JSON plus one smoke test on real data) also cover:
side="server"includessharedand excludesclient;category="vehicle"matchesVEHICLE; empty query and category returns the category summary whose counts sum to the total; more than 25 results shows 25 plus "... and N more"; descriptions over 300 chars are truncated.
Getting started
- Relevant files:
mcp-server/tools/natives.py,.github/workflows/validate.yml - How to run checks: there is no test suite yet; run the MCP server with
cd mcp-server && pip install -r requirements.txt && python server.py, and CI checks live in.github/workflows/validate.yml - Related docs:
skills/native-functions/SKILL.md
Filed by repo-audit/full-audit at 701824d. Severity: medium. Effort: S. audit-key: bug|mcp-server/tools/natives.py|lookup_native
Activity
TMHSDigital commentedon Nov 21, 2026
Fixed in ef4d72f.
Names are compared with underscores removed and case folded, hashes match with or without 0x, game is validated, optional fields are read defensively, and validate.yml asserts hash/description/param shape.
Verified: GET_PLAYER_PED, GetPlayerPed and getplayerped all find GetPlayerPed; 0x6E31E993 and 6e31e993 match by hash; game="rdr2" errors without a path; null description / param without type do not raise. Covered by mcp-server/tests/test_natives.py.