Skip to content

feat: Sails IDL v2 MCP server#1274

Draft
vobradovich wants to merge 7 commits intomasterfrom
vo/sails-mcp
Draft

feat: Sails IDL v2 MCP server#1274
vobradovich wants to merge 7 commits intomasterfrom
vo/sails-mcp

Conversation

@vobradovich
Copy link
Copy Markdown
Member

No description provided.

@vobradovich vobradovich self-assigned this Apr 1, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new MCP server for Sails IDL and program development, including tools for IDL parsing, ABI encoding/decoding, and resource management. My review identified two high-severity issues: the attribute checking logic in abi-tools.ts is prone to false positives due to the use of includes(), and the type resolution logic in type-tools.ts is overly complex and potentially incorrect, which should be replaced by leveraging the existing TypeResolver.

Comment on lines +112 to +122
function isPayable(func: IServiceFunc): boolean {
return func.docs?.some((d) => d.includes('#[payable]')) ?? false;
}

function isReturnsValue(func: IServiceFunc): boolean {
return func.docs?.some((d) => d.includes('#[returns_value]')) ?? false;
}

function isIndexed(field: IStructField): boolean {
return field.docs?.some((d) => d.includes('#[indexed]')) ?? false;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The functions isPayable, isReturnsValue, and isIndexed use string.includes() to check for attributes like #[payable] within doc comments. This is not robust and can lead to false positives. For example, a comment // Note: this function is not #[payable] would cause isPayable to return true.

The check should be more specific by matching the trimmed doc string exactly against the attribute.

Suggested change
function isPayable(func: IServiceFunc): boolean {
return func.docs?.some((d) => d.includes('#[payable]')) ?? false;
}
function isReturnsValue(func: IServiceFunc): boolean {
return func.docs?.some((d) => d.includes('#[returns_value]')) ?? false;
}
function isIndexed(field: IStructField): boolean {
return field.docs?.some((d) => d.includes('#[indexed]')) ?? false;
}
function isPayable(func: IServiceFunc): boolean {
return func.docs?.some((d) => d.trim() === '#[payable]') ?? false;
}
function isReturnsValue(func: IServiceFunc): boolean {
return func.docs?.some((d) => d.trim() === '#[returns_value]') ?? false;
}
function isIndexed(field: IStructField): boolean {
return field.docs?.some((d) => d.trim() === '#[indexed]') ?? false;
}

Comment thread js/mcp-server/src/tools/type-tools.ts
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