mcpMethodDefined function
bool?
mcpMethodDefined(
- String method,
- McpDirection direction,
- String revision, {
- Set<
String> extensions = const {},
Whether method is a protocol method of revision in direction —
defined by the core revision, or by an extension in extensions (ids
such as io.modelcontextprotocol/tasks). Null when the method is not a
protocol method of any supported revision (an application method).
Implementation
bool? mcpMethodDefined(String method, McpDirection direction, String revision,
{Set<String> extensions = const {}}) {
var known = false;
for (final spec in mcpMethods) {
if (spec.method != method) continue;
known = true;
if (spec.direction != direction) continue;
if (spec.revisions.contains(revision)) return true;
if (extensions.contains('io.modelcontextprotocol/tasks') &&
spec.revisions.contains('ext-tasks/$revision')) {
return true;
}
}
return known ? false : null;
}