declare_type adds #pragma pack(push, 2) and #pragma pack(pop)
Author: aybeCreated Jul 15, 2026Updated Jul 15, 2026
I've told the MCP server to add this struct to another IDB:
00000000 struct Skeleton // sizeof=0x50
00000000 {
00000000 MATRIX relative;
00000020 MATRIX absolute;
00000040 __int16 update;
00000042 // padding byte
00000043 // padding byte
00000044 struct Skeleton *super;
00000048 struct Skeleton *sub;
0000004C struct Skeleton *next;
00000050 };$ curl -s -X POST http://127.0.0.1:13338/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "declare_type",
"arguments": {
"decls": "struct Skeleton { MATRIX relative; MATRIX absolute; __int16 update; struct Skeleton *super; struct Skeleton *sub; struct Skeleton *next; };"
}
}
}'
{"jsonrpc": "2.0", "result": {"content": [{"type": "text", "text": "[{\"decl\":\"struct Skeleton { MATRIX relative; MATRIX absolute; __int16 update; struct Skeleton *super; struct Skeleton *sub; struct Skeleton *next; };\"}]"}], "structuredContent": {"result": [{"decl": "struct Skeleton { MATRIX relative; MATRIX absolute; __int16 update; struct Skeleton *super; struct Skeleton *sub; struct Skeleton *next; };"}]}, "isError": false}, "id": 1}Problem is, it adds #pragma pack(push, 2) and #pragma pack(pop), making the struct size being 0x4E instead of 0x50:
00000000 #pragma pack(push, 2)
00000000 struct Skeleton // sizeof=0x4E
00000000 {
00000000 MATRIX relative;
00000020 MATRIX absolute;
00000040 __int16 update;
00000042 struct Skeleton *super;
00000046 struct Skeleton *sub;
0000004A struct Skeleton *next;
0000004E };
0000004E #pragma pack(pop)Unless I've missed something, that's likely wrong?
Thanks!
Source: mrexodia/ida-pro-mcp