mcpAliasesFor returns the set of local identifiers under which the given file imports the MCP go-sdk (MCPImportPath). The default unaliased import resolves to the package name "mcp". Blank (`_`) and dot (`.`) imports are skipped because tool literals cannot meaningfully be qualified through them.
(file *ast.File)
| 151 | // resolves to the package name "mcp". Blank (`_`) and dot (`.`) imports are |
| 152 | // skipped because tool literals cannot meaningfully be qualified through them. |
| 153 | func mcpAliasesFor(file *ast.File) map[string]struct{} { |
| 154 | aliases := map[string]struct{}{} |
| 155 | for _, imp := range file.Imports { |
| 156 | path, err := strconv.Unquote(imp.Path.Value) |
| 157 | if err != nil || path != MCPImportPath { |
| 158 | continue |
| 159 | } |
| 160 | if imp.Name != nil { |
| 161 | if imp.Name.Name == "_" || imp.Name.Name == "." { |
| 162 | continue |
| 163 | } |
| 164 | aliases[imp.Name.Name] = struct{}{} |
| 165 | continue |
| 166 | } |
| 167 | aliases["mcp"] = struct{}{} |
| 168 | } |
| 169 | return aliases |
| 170 | } |
| 171 | |
| 172 | // isQualifiedType reports whether expr is a SelectorExpr of the form |
| 173 | // <alias>.<typeName> where alias is in the provided alias set. |